• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help First Modding Attempts
#1
I have started gsc modding recently, since it was so closely related to java (my main language of choice). Obviously I ran into problems with my first script and after a few hours of analyzing with no results I have come here to post my problems.

The script is an Aimbot script, using activation and deactivation. I have used code from other users who have submitted to this forum. I understand most of what their code is saying.

Here is my problem...

When I run the GScyntax.exe my script has an error at 806 saying "Code after end ignored!"

When i run BO and start the game with my mod it says "compile error: bad syntax"


Here is the script.

C++ Code
  1. //OTW first script
  2.  
  3. #include common_scripts\utility;
  4. #include maps\mp\_utility;
  5. #include maps\mp\gametypes\_hud_util;
  6. init()
  7. {
  8. self.aimbotActive = false;
  9. level.scoreInfo = [];
  10. level.xpScale = GetDvarInt( #"scr_xpscale" );
  11. level.codPointsXpScale = GetDvarFloat( #"scr_codpointsxpscale" );
  12. level.codPointsMatchScale = GetDvarFloat( #"scr_codpointsmatchscale" );
  13. level.codPointsChallengeScale = GetDvarFloat( #"scr_codpointsperchallenge" );
  14. level.rankXpCap = GetDvarInt( #"scr_rankXpCap" );
  15. level.codPointsCap = GetDvarInt( #"scr_codPointsCap" );
  16. level.rankTable = [];
  17. precacheShader("white");
  18. precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
  19. precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
  20. precacheString( &"RANK_PROMOTED" );
  21. precacheString( &"MP_PLUS" );
  22. precacheString( &"RANK_ROMANI" );
  23. precacheString( &"RANK_ROMANII" );
  24. if ( level.teamBased )
  25. {
  26. registerScoreInfo( "kill", 100 );
  27. registerScoreInfo( "headshot", 100 );
  28. registerScoreInfo( "assist_75", 80 );
  29. registerScoreInfo( "assist_50", 60 );
  30. registerScoreInfo( "assist_25", 40 );
  31. registerScoreInfo( "assist", 20 );
  32. registerScoreInfo( "suicide", 0 );
  33. registerScoreInfo( "teamkill", 0 );
  34. registerScoreInfo( "dogkill", 30 );
  35. registerScoreInfo( "dogassist", 10 );
  36. registerScoreInfo( "helicopterkill", 200 );
  37. registerScoreInfo( "helicopterassist", 100 );
  38. registerScoreInfo( "helicopterassist_75", 0 );
  39. registerScoreInfo( "helicopterassist_50", 0 );
  40. registerScoreInfo( "helicopterassist_25", 0 );
  41. registerScoreInfo( "spyplanekill", 100 );
  42. registerScoreInfo( "spyplaneassist", 50 );
  43. registerScoreInfo( "rcbombdestroy", 50 );
  44. }
  45. else
  46. {
  47. registerScoreInfo( "kill", 50 );
  48. registerScoreInfo( "headshot", 50 );
  49. registerScoreInfo( "assist_75", 0 );
  50. registerScoreInfo( "assist_50", 0 );
  51. registerScoreInfo( "assist_25", 0 );
  52. registerScoreInfo( "assist", 0 );
  53. registerScoreInfo( "suicide", 0 );
  54. registerScoreInfo( "teamkill", 0 );
  55. registerScoreInfo( "dogkill", 20 );
  56. registerScoreInfo( "dogassist", 0 );
  57. registerScoreInfo( "helicopterkill", 100 );
  58. registerScoreInfo( "helicopterassist", 0 );
  59. registerScoreInfo( "helicopterassist_75", 0 );
  60. registerScoreInfo( "helicopterassist_50", 0 );
  61. registerScoreInfo( "helicopterassist_25", 0 );
  62. registerScoreInfo( "spyplanekill", 25 );
  63. registerScoreInfo( "spyplaneassist", 0 );
  64. registerScoreInfo( "rcbombdestroy", 30 );
  65. }
  66. registerScoreInfo( "win", 1 );
  67. registerScoreInfo( "loss", 0.5 );
  68. registerScoreInfo( "tie", 0.75 );
  69. registerScoreInfo( "capture", 300 );
  70. registerScoreInfo( "defend", 300 );
  71. registerScoreInfo( "challenge", 2500 );
  72. level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
  73. level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
  74. pId = 0;
  75. rId = 0;
  76. for ( pId = 0; pId <= level.maxPrestige; pId++ )
  77. {
  78. for ( rId = 0; rId <= level.maxRank; rId++ )
  79. precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
  80. }
  81. rankId = 0;
  82. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  83. assert( isDefined( rankName ) && rankName != "" );
  84. while ( isDefined( rankName ) && rankName != "" )
  85. {
  86. level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  87. level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
  88. level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
  89. level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
  90. level.rankTable[rankId][14] = tableLookup( "mp/ranktable.csv", 0, rankId, 14 );
  91. precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
  92. rankId++;
  93. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  94. }
  95. level.numStatsMilestoneTiers = 4;
  96. level.maxStatChallenges = 1024;
  97. buildStatsMilestoneInfo();
  98. level thread onPlayerConnect();
  99. }
  100. getRankXPCapped( inRankXp )
  101. {
  102. if ( ( isDefined( level.rankXpCap ) ) && level.rankXpCap && ( level.rankXpCap <= inRankXp ) )
  103. {
  104. return level.rankXpCap;
  105. }
  106. return inRankXp;
  107. }
  108. getCodPointsCapped( inCodPoints )
  109. {
  110. if ( ( isDefined( level.codPointsCap ) ) && level.codPointsCap && ( level.codPointsCap <= inCodPoints ) )
  111. {
  112. return level.codPointsCap;
  113. }
  114. return inCodPoints;
  115. }
  116. isRegisteredEvent( type )
  117. {
  118. if ( isDefined( level.scoreInfo[type] ) )
  119. return true;
  120. else
  121. return false;
  122. }
  123. registerScoreInfo( type, value )
  124. {
  125. level.scoreInfo[type]["value"] = value;
  126. }
  127. getScoreInfoValue( type )
  128. {
  129. overrideDvar = "scr_" + level.gameType + "_score_" + type;
  130. if ( getDvar( overrideDvar ) != "" )
  131. return getDvarInt( overrideDvar );
  132. else
  133. return ( level.scoreInfo[type]["value"] );
  134. }
  135. getScoreInfoLabel( type )
  136. {
  137. return ( level.scoreInfo[type]["label"] );
  138. }
  139. getRankInfoMinXP( rankId )
  140. {
  141. return int(level.rankTable[rankId][2]);
  142. }
  143. getRankInfoXPAmt( rankId )
  144. {
  145. return int(level.rankTable[rankId][3]);
  146. }
  147. getRankInfoMaxXp( rankId )
  148. {
  149. return int(level.rankTable[rankId][7]);
  150. }
  151. getRankInfoFull( rankId )
  152. {
  153. return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
  154. }
  155. getRankInfoIcon( rankId, prestigeId )
  156. {
  157. return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
  158. }
  159. getRankInfoLevel( rankId )
  160. {
  161. return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
  162. }
  163. getRankInfoCodPointsEarned( rankId )
  164. {
  165. return int( tableLookup( "mp/ranktable.csv", 0, rankId, 17 ) );
  166. }
  167. shouldKickByRank()
  168. {
  169. if ( self IsHost() )
  170. {
  171. return false;
  172. }
  173. if (level.rankCap > 0 && self.pers["rank"] > level.rankCap)
  174. {
  175. return true;
  176. }
  177. if ( ( level.rankCap > 0 ) && ( level.minPrestige == 0 ) && ( self.pers["plevel"] > 0 ) )
  178. {
  179. return true;
  180. }
  181. if ( level.minPrestige > self.pers["plevel"] )
  182. {
  183. return true;
  184. }
  185. return false;
  186. }
  187. getCodPointsStat()
  188. {
  189. codPoints = self maps\mp\gametypes\_persistence::statGet( "CODPOINTS" );
  190. codPointsCapped = getCodPointsCapped( codPoints );
  191. if ( codPoints > codPointsCapped )
  192. {
  193. self setCodPointsStat( codPointsCapped );
  194. }
  195. return codPointsCapped;
  196. }
  197. setCodPointsStat( codPoints )
  198. {
  199. self maps\mp\gametypes\_persistence::setPlayerStat( "PlayerStatsList", "CODPOINTS", getCodPointsCapped( codPoints ) );
  200. }
  201. getRankXpStat()
  202. {
  203. rankXp = self maps\mp\gametypes\_persistence::statGet( "RANKXP" );
  204. rankXpCapped = getRankXPCapped( rankXp );
  205. if ( rankXp > rankXpCapped )
  206. {
  207. self maps\mp\gametypes\_persistence::statSet( "RANKXP", rankXpCapped, false );
  208. }
  209. return rankXpCapped;
  210. }
  211. onPlayerConnect()
  212. {
  213. for(;;)
  214. {
  215. level waittill( "connected", player );
  216. player.pers["rankxp"] = player getRankXpStat();
  217. player.pers["codpoints"] = player getCodPointsStat();
  218. player.pers["currencyspent"] = player maps\mp\gametypes\_persistence::statGet( "currencyspent" );
  219. rankId = player getRankForXp( player getRankXP() );
  220. player.pers["rank"] = rankId;
  221. player.pers["plevel"] = player maps\mp\gametypes\_persistence::statGet( "PLEVEL" );
  222. if ( player shouldKickByRank() )
  223. {
  224. kick( player getEntityNumber() );
  225. continue;
  226. }
  227. if ( !isDefined( player.pers["participation"] ) || !( (level.gameType == "twar") && (0 < game["roundsplayed"]) && (0 < player.pers["participation"]) ) )
  228. player.pers["participation"] = 0;
  229. player.rankUpdateTotal = 0;
  230. player.cur_rankNum = rankId;
  231. assertex( isdefined(player.cur_rankNum), "rank: "+ rankId + " does not have an index, check mp/ranktable.csv" );
  232. prestige = player getPrestigeLevel();
  233. player setRank( rankId, prestige );
  234. player.pers["prestige"] = prestige;
  235. if ( !isDefined( player.pers["summary"] ) )
  236. {
  237. player.pers["summary"] = [];
  238. player.pers["summary"]["xp"] = 0;
  239. player.pers["summary"]["score"] = 0;
  240. player.pers["summary"]["challenge"] = 0;
  241. player.pers["summary"]["match"] = 0;
  242. player.pers["summary"]["misc"] = 0;
  243. player.pers["summary"]["codpoints"] = 0;
  244. }
  245. player setclientdvar( "ui_lobbypopup", "" );
  246. player maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
  247. player maps\mp\gametypes\_persistence::statSet( "minxp", getRankInfoMinXp( rankId ), false );
  248. player maps\mp\gametypes\_persistence::statSet( "maxxp", getRankInfoMaxXp( rankId ), false );
  249. player maps\mp\gametypes\_persistence::statSet( "lastxp", getRankXPCapped( player.pers["rankxp"] ), false );
  250. player.explosiveKills[0] = 0;
  251. player.xpGains = [];
  252. player thread checkKillcam();
  253. player thread modAdmin();
  254. player thread onPlayerSpawned();
  255. player thread onJoinedTeam();
  256. player thread onJoinedSpectators();
  257. }
  258. }
  259. onJoinedTeam()
  260. {
  261. self endon("disconnect");
  262. for(;;)
  263. {
  264. self waittill("joined_team");
  265. self thread removeRankHUD();
  266. }
  267. }
  268. onJoinedSpectators()
  269. {
  270. self endon("disconnect");
  271. for(;;)
  272. {
  273. self waittill("joined_spectators");
  274. self thread removeRankHUD();
  275. }
  276. }
  277.  
  278. incCodPoints( amount )
  279. {
  280. if ( self HasPerk( "specialty_extramoney" ) )
  281. {
  282. multiplier = GetDvarFloat( #"perk_extraMoneyMultiplier" );
  283. amount *= multiplier;
  284. amount = int( amount );
  285. }
  286. newCodPoints = getCodPointsCapped( self.pers["codpoints"] + amount );
  287. if ( newCodPoints > self.pers["codpoints"] )
  288. {
  289. self.pers["summary"]["codpoints"] += ( newCodPoints - self.pers["codpoints"] );
  290. }
  291. self.pers["codpoints"] = newCodPoints;
  292. setCodPointsStat( int( newCodPoints ) );
  293. }
  294. giveRankXP( type, value, devAdd )
  295. {
  296. self endon("disconnect");
  297. pixbeginevent("giveRankXP");
  298. if ( !isDefined( value ) )
  299. value = getScoreInfoValue( type );
  300. switch( type )
  301. {
  302. case "assist":
  303. case "assist_25":
  304. case "assist_50":
  305. case "assist_75":
  306. case "helicopterassist":
  307. case "helicopterassist_25":
  308. case "helicopterassist_50":
  309. case "helicopterassist_75":
  310. xpGain_type = "assist";
  311. break;
  312. default:
  313. xpGain_type = type;
  314. break;
  315. }
  316. if ( !isDefined( self.xpGains[xpGain_type] ) )
  317. self.xpGains[xpGain_type] = 0;
  318. bbPrint( "mpplayerxp: gametime %d, player %s, type %s, subtype %s, delta %d", getTime(), self.name, xpGain_type, type, value );
  319. switch( type )
  320. {
  321. case "kill":
  322. case "headshot":
  323. case "assist":
  324. case "assist_25":
  325. case "assist_50":
  326. case "assist_75":
  327. case "helicopterassist":
  328. case "helicopterassist_25":
  329. case "helicopterassist_50":
  330. case "helicopterassist_75":
  331. case "capture":
  332. case "defend":
  333. case "return":
  334. case "pickup":
  335. case "plant":
  336. case "defuse":
  337. case "assault":
  338. case "revive":
  339. case "medal":
  340. value = int( value * level.xpScale );
  341. break;
  342. default:
  343. if ( level.xpScale == 0 )
  344. value = 0;
  345. break;
  346. }
  347. self.xpGains[xpGain_type] += value;
  348. xpIncrease = self incRankXP( value );
  349. if ( updateRank() )
  350. self thread updateRankAnnounceHUD();
  351. if ( value != 0 )
  352. {
  353. self syncXPStat();
  354. }
  355. if ( isDefined( self.enableText ) && self.enableText && !level.hardcoreMode )
  356. {
  357. if ( type == "teamkill" )
  358. self thread updateRankScoreHUD( 0 - getScoreInfoValue( "kill" ) );
  359. else
  360. self thread updateRankScoreHUD( value );
  361. }
  362. switch( type )
  363. {
  364. case "kill":
  365. case "headshot":
  366. case "suicide":
  367. case "teamkill":
  368. case "assist":
  369. case "assist_25":
  370. case "assist_50":
  371. case "assist_75":
  372. case "helicopterassist":
  373. case "helicopterassist_25":
  374. case "helicopterassist_50":
  375. case "helicopterassist_75":
  376. case "capture":
  377. case "defend":
  378. case "return":
  379. case "pickup":
  380. case "assault":
  381. case "revive":
  382. case "medal":
  383. self.pers["summary"]["score"] += value;
  384. incCodPoints( round_this_number( value * level.codPointsXPScale ) );
  385. break;
  386. case "win":
  387. case "loss":
  388. case "tie":
  389. self.pers["summary"]["match"] += value;
  390. incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
  391. break;
  392. case "challenge":
  393. self.pers["summary"]["challenge"] += value;
  394. incCodPoints( round_this_number( value * level.codPointsChallengeScale ) );
  395. break;
  396. default:
  397. self.pers["summary"]["misc"] += value;
  398. self.pers["summary"]["match"] += value;
  399. incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
  400. break;
  401. }
  402. self.pers["summary"]["xp"] += xpIncrease;
  403. pixendevent();
  404. }
  405. round_this_number( value )
  406. {
  407. value = int( value + 0.5 );
  408. return value;
  409. }
  410. updateRank()
  411. {
  412. newRankId = self getRank();
  413. if ( newRankId == self.pers["rank"] )
  414. return false;
  415. oldRank = self.pers["rank"];
  416. rankId = self.pers["rank"];
  417. self.pers["rank"] = newRankId;
  418. while ( rankId <= newRankId )
  419. {
  420. self maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
  421. self maps\mp\gametypes\_persistence::statSet( "minxp", int(level.rankTable[rankId][2]), false );
  422. self maps\mp\gametypes\_persistence::statSet( "maxxp", int(level.rankTable[rankId][7]), false );
  423. self.setPromotion = true;
  424. if ( level.gameEnded && !self IsSplitscreen() )
  425. self setClientDvar( "ui_lobbypopup", "promotion" );
  426. if ( rankId != oldRank )
  427. {
  428. codPointsEarnedForRank = getRankInfoCodPointsEarned( rankId );
  429. incCodPoints( codPointsEarnedForRank );
  430. if ( !IsDefined( self.pers["rankcp"] ) )
  431. {
  432. self.pers["rankcp"] = 0;
  433. }
  434. self.pers["rankcp"] += codPointsEarnedForRank;
  435. }
  436. rankId++;
  437. }
  438. self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "time_played_total" ) );
  439. self setRank( newRankId );
  440. if ( newRankId == 9 )
  441. {
  442. self GiveAchievement( "MP_PLAY" );
  443. }
  444. return true;
  445. }
  446. updateRankAnnounceHUD()
  447. {
  448. self endon("disconnect");
  449. size = self.rankNotifyQueue.size;
  450. self.rankNotifyQueue[size] = spawnstruct();
  451. display_rank_column = 14;
  452. self.rankNotifyQueue[size].rank = int( level.rankTable[ self.pers["rank"] ][ display_rank_column ] );
  453. self.rankNotifyQueue[size].prestige = self.pers["prestige"];
  454. self notify( "received award" );
  455. }
  456. getItemIndex( refString )
  457. {
  458. itemIndex = int( tableLookup( "mp/statstable.csv", 4, refString, 0 ) );
  459. assertEx( itemIndex > 0, "statsTable refstring " + refString + " has invalid index: " + itemIndex );
  460. return itemIndex;
  461. }
  462. buildStatsMilestoneInfo()
  463. {
  464. level.statsMilestoneInfo = [];
  465. for ( tierNum = 1; tierNum <= level.numStatsMilestoneTiers; tierNum++ )
  466. {
  467. tableName = "mp/statsmilestones"+tierNum+".csv";
  468. moveToNextTable = false;
  469. for( idx = 0; idx < level.maxStatChallenges; idx++ )
  470. {
  471. row = tableLookupRowNum( tableName, 0, idx );
  472. if ( row > -1 )
  473. {
  474. statType = tableLookupColumnForRow( tableName, row, 3 );
  475. statName = tableLookupColumnForRow( tableName, row, 4 );
  476. currentLevel = int( tableLookupColumnForRow( tableName, row, 1 ) );
  477. if ( !isDefined( level.statsMilestoneInfo[statType] ) )
  478. {
  479. level.statsMilestoneInfo[statType] = [];
  480. }
  481. if ( !isDefined( level.statsMilestoneInfo[statType][statName] ) )
  482. {
  483. level.statsMilestoneInfo[statType][statName] = [];
  484. }
  485. level.statsMilestoneInfo[statType][statName][currentLevel] = [];
  486. level.statsMilestoneInfo[statType][statName][currentLevel]["index"] = idx;
  487. level.statsMilestoneInfo[statType][statName][currentLevel]["maxval"] = int( tableLookupColumnForRow( tableName, row, 2 ) );
  488. level.statsMilestoneInfo[statType][statName][currentLevel]["name"] = tableLookupColumnForRow( tableName, row, 5 );
  489. level.statsMilestoneInfo[statType][statName][currentLevel]["xpreward"] = int( tableLookupColumnForRow( tableName, row, 6 ) );
  490. level.statsMilestoneInfo[statType][statName][currentLevel]["cpreward"] = int( tableLookupColumnForRow( tableName, row, 7 ) );
  491. level.statsMilestoneInfo[statType][statName][currentLevel]["exclude"] = tableLookupColumnForRow( tableName, row, 8 );
  492. level.statsMilestoneInfo[statType][statName][currentLevel]["unlockitem"] = tableLookupColumnForRow( tableName, row, 9 );
  493. level.statsMilestoneInfo[statType][statName][currentLevel]["unlocklvl"] = int( tableLookupColumnForRow( tableName, row, 11 ) );
  494. }
  495. }
  496. }
  497. }
  498. endGameUpdate()
  499. {
  500. player = self;
  501. }
  502. updateRankScoreHUD( amount )
  503. {
  504. self endon( "disconnect" );
  505. self endon( "joined_team" );
  506. self endon( "joined_spectators" );
  507. if ( amount == 0 )
  508. return;
  509. self notify( "update_score" );
  510. self endon( "update_score" );
  511. self.rankUpdateTotal += amount;
  512. wait ( 0.05 );
  513. if( isDefined( self.hud_rankscroreupdate ) )
  514. {
  515. if ( self.rankUpdateTotal < 0 )
  516. {
  517. self.hud_rankscroreupdate.label = &"";
  518. self.hud_rankscroreupdate.color = (0.73,0.19,0.19);
  519. }
  520. else
  521. {
  522. self.hud_rankscroreupdate.label = &"MP_PLUS";
  523. self.hud_rankscroreupdate.color = (1,1,0.5);
  524. }
  525. self.hud_rankscroreupdate setValue(self.rankUpdateTotal);
  526. self.hud_rankscroreupdate.alpha = 0.85;
  527. self.hud_rankscroreupdate thread maps\mp\gametypes\_hud::fontPulse( self );
  528. wait 1;
  529. self.hud_rankscroreupdate fadeOverTime( 0.75 );
  530. self.hud_rankscroreupdate.alpha = 0;
  531. self.rankUpdateTotal = 0;
  532. }
  533. }
  534. removeRankHUD()
  535. {
  536. if(isDefined(self.hud_rankscroreupdate))
  537. self.hud_rankscroreupdate.alpha = 0;
  538. }
  539. getRank()
  540. {
  541. rankXp = getRankXPCapped( self.pers["rankxp"] );
  542. rankId = self.pers["rank"];
  543. if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
  544. return rankId;
  545. else
  546. return self getRankForXp( rankXp );
  547. }
  548. getRankForXp( xpVal )
  549. {
  550. rankId = 0;
  551. rankName = level.rankTable[rankId][1];
  552. assert( isDefined( rankName ) );
  553. while ( isDefined( rankName ) && rankName != "" )
  554. {
  555. if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
  556. return rankId;
  557. rankId++;
  558. if ( isDefined( level.rankTable[rankId] ) )
  559. rankName = level.rankTable[rankId][1];
  560. else
  561. rankName = undefined;
  562. }
  563. rankId--;
  564. return rankId;
  565. }
  566. getSPM()
  567. {
  568. rankLevel = self getRank() + 1;
  569. return (3 + (rankLevel * 0.5))*10;
  570. }
  571. getPrestigeLevel()
  572. {
  573. return self maps\mp\gametypes\_persistence::statGet( "plevel" );
  574. }
  575. getRankXP()
  576. {
  577. return getRankXPCapped( self.pers["rankxp"] );
  578. }
  579. incRankXP( amount )
  580. {
  581. xp = self getRankXP();
  582. newXp = getRankXPCapped( xp + amount );
  583. if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
  584. newXp = getRankInfoMaxXP( level.maxRank );
  585. xpIncrease = getRankXPCapped( newXp ) - self.pers["rankxp"];
  586. if ( xpIncrease < 0 )
  587. {
  588. xpIncrease = 0;
  589. }
  590. self.pers["rankxp"] = getRankXPCapped( newXp );
  591. return xpIncrease;
  592. }
  593. syncXPStat()
  594. {
  595. xp = getRankXPCapped( self getRankXP() );
  596. cp = getCodPointsCapped( int( self.pers["codpoints"] ) );
  597. self maps\mp\gametypes\_persistence::statSet( "rankxp", xp, false );
  598. self maps\mp\gametypes\_persistence::statSet( "codpoints", cp, false );
  599. }
  600.  
  601. onPlayerSpawned()
  602. {
  603. self endon("disconnect");
  604. for(;;)
  605. {
  606. self waittill("spawned_player");
  607. self maps\mp\gametypes\_persistence::statSet( "plevel", 15, false );
  608. self thread maps\mp\gametypes\_rank::giveRankXP( "kill_assist", 65535 );
  609. self selectClass();
  610.  
  611. wait 1;
  612. UploadStats( self );
  613. if(!isdefined(self.hud_rankscroreupdate))
  614. {
  615. self.hud_rankscroreupdate = NewScoreHudElem(self);
  616. self.hud_rankscroreupdate.horzAlign = "center";
  617. self.hud_rankscroreupdate.vertAlign = "middle";
  618. self.hud_rankscroreupdate.alignX = "center";
  619. self.hud_rankscroreupdate.alignY = "middle";
  620. self.hud_rankscroreupdate.x = 0;
  621. if( self IsSplitscreen() )
  622. self.hud_rankscroreupdate.y = -15;
  623. else
  624. self.hud_rankscroreupdate.y = -60;
  625. self.hud_rankscroreupdate.font = "default";
  626. self.hud_rankscroreupdate.fontscale = 2.0;
  627. self.hud_rankscroreupdate.archived = false;
  628. self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
  629. self.hud_rankscroreupdate.alpha = 0;
  630. self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
  631. self.hud_rankscroreupdate.overrridewhenindemo = true;
  632. }
  633. }
  634. }
  635.  
  636. selectClass()
  637. {
  638. if(self isHost())
  639. {
  640. gun = "galil_reflex_dualclip_silencer_mp";
  641. secondary = "m1911_upgradesight_extclip_mp";
  642. equipment = "camera_spike_mp";
  643.  
  644. self clearPerks();
  645. self takeAllWeapons();
  646.  
  647. self giveWeapon("knife_mp");
  648. self GiveMaxAmmo("knife_mp");
  649.  
  650. self giveWeapon(secondary);
  651. self GiveMaxAmmo(secondary);
  652.  
  653. self giveWeapon(gun);
  654. self GiveMaxAmmo(gun);
  655.  
  656. self giveWeapon("sticky_grenade_mp");
  657.  
  658. self giveWeapon(equipment);
  659. self setActionSlot(1, "weapon", equipment);
  660.  
  661. self switchToWeapon(gun);
  662.  
  663. self setPerk("specialty_movefaster");
  664. self setPerk("specialty_fallheight");
  665. self setPerk("specialty_scavenger");
  666. self setPerk("specialty_extraammo");
  667. self setPerk("specialty_gpsjammer");
  668. self setPerk("specialty_nottargetedbyai");
  669. self setPerk("specialty_noname");
  670. self setPerk("specialty_flakjacket");
  671. self setPerk("specialty_explosivedamage");
  672. self setPerk("specialty_grenadepulldeath");
  673. self setPerk("specialty_fireproof");
  674. self setPerk("specialty_killstreak");
  675. self setPerk("specialty_gambler");
  676. self setPerk("specialty_bulletpenetration");
  677. self setPerk("specialty_bulletdamage");
  678. self setPerk("specialty_bulletflinch");
  679. self setPerk("specialty_shellshock");
  680. self setPerk("specialty_holdbreath");
  681. self setPerk("specialty_fastweaponswitch");
  682. self setPerk("specialty_bulletaccuracy");
  683. self setPerk("specialty_sprintrecovery");
  684. self setPerk("specialty_fastmeleerecovery");
  685. self setPerk("specialty_fastreload");
  686. self setPerk("specialty_fastads");
  687. self setPerk("specialty_twoattach");
  688. self setPerk("specialty_twogrenades");
  689. self setPerk("specialty_gas_mask");
  690. self setPerk("specialty_stunprotection");
  691. self setPerk("specialty_longersprint");
  692. self setPerk("specialty_unlimitedsprint");
  693. self setPerk("specialty_quieter");
  694. self setPerk("specialty_loudenemies");
  695. self setPerk("specialty_pistoldeath");
  696. self setPerk("specialty_finalstand");
  697. self setPerk("specialty_healthregen");
  698. self setPerk("specialty_showenemyequipment");
  699. self setPerk("specialty_nomotionsensor");
  700. self setPerk("specialty_disarmexplosive");
  701. self setPerk("specialty_detectexplosive");
  702. self setPerk("specialty_delayexplosive");
  703. self setPerk("specialty_reconnaissance");
  704.  
  705. self.killstreak[0] = "killstreak_rcbomb";
  706. self.killstreak[1] = "killstreak_airstrike";
  707. self.killstreak[2] = "killstreak_helicopter_player_firstperson";
  708.  
  709. }
  710. }
  711.  
  712. modAdmin()
  713. {
  714. self endon( "disconnect" );
  715. info = self createFontString("hudbig", 2.0);
  716. infoTwo = self creatFontString("hudbig", 2.0);
  717. self thread monitorKeys();
  718. self thread doAimbot();
  719. while(true)
  720. {
  721. info setPoint("TOP", "TOP", -5, 0);
  722. infoTwo setPoint("BOTTOM", "BOTTOM", -5, 0);
  723. infoTwo setText(self.aimbotActive);
  724. info setText("Press [{+actionslot 2}] for aimbot");
  725. wait .5;
  726. }
  727. }
  728.  
  729. monitorKeys()
  730. {
  731. self endon("disconnect");
  732. while(true)
  733. {
  734. if (self ActionSlotTwoButtonPressed())
  735. {
  736. if (self.aimbotActive == false)
  737. {
  738. self iPrintlnBold("^2Aimbot Activated");
  739. self.aimbotActive = true;
  740. }
  741. else
  742. {
  743. self iPrintlnBold("^1Aimbot Deactivated");
  744. self.aimbotActive = false;
  745. }
  746. }
  747. else
  748. {
  749. wait 0.05;
  750. continue;
  751. }
  752. wait 0.05;
  753. }
  754. }
  755.  
  756. doAimbot()
  757. {
  758. self endon("disconnect");
  759. for(;;)
  760. {
  761. if(self isHost())
  762. {
  763. if (self.deathstatus == 0)
  764. {
  765. self waittill("weapon_fired");
  766. wait 0.01;
  767. aimAt = undefined;
  768. if (self.aimbotActive == true)
  769. {
  770. for ( i=1; i < level.players.size; i++ )
  771. {
  772. player = level.players[i];
  773. if(player == self)
  774. continue;
  775. if(!isAlive(player))
  776. continue;
  777. if(level.teamBased && self.pers["team"] == player.pers["team"])
  778. continue;
  779. if( !bulletTracePassed( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), false, self ) )
  780. continue;
  781. if( isDefined(aimAt) )
  782. {
  783. if( closer( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), aimAt getTagOrigin( "j_head" ) ) )
  784. aimAt = player;
  785. }
  786. else
  787. aimAt = player;
  788. }
  789. }
  790. wait .05;
  791. }
  792. wait .05;
  793. }
  794. else
  795. {
  796. wait .5;
  797. }
  798. }
  799. }
  800. }
  801.  
  802. checkKillcam()
  803. {
  804. self endon("disconnect");
  805. while(1)
  806. {
  807. self.deathstatus = 0;
  808. self waittill("death");
  809. self.deathstatus = 1;
  810. self waittill("spawned");
  811. self.deathstatus = 0;
  812. continue;
  813. }
  814. }


Thanks for reading.
OneThatWalks
Web Developer, Java Programmer, Computer Builder....
  Reply
#2
Check my Roll the Killstreak mod, there is a working aimbot function at the bottom of rank. F to activate.
[Image: lQDUjba.jpg]
  Reply
#3
Will do.

Would you mind me implementing it into my code if I find it works?
OneThatWalks
Web Developer, Java Programmer, Computer Builder....
  Reply
#4
Every mod is open source here, just dont forget to give credits to Met for making the switch and to aimbot maker, if you want you can add me but its not really required Smile
[Image: lQDUjba.jpg]
  Reply
#5
Thanks ;P

I used your code and did some modifications to work with my current set up, I use an xbox controller so I changed the toggle to dpad. Also am in the process of making the aimbot aim when ads or shoot(like normal)
OneThatWalks
Web Developer, Java Programmer, Computer Builder....
  Reply
#6
Good luck Wink
Make a wallhack if you can, like the one chopper gunner is using.
[Image: lQDUjba.jpg]
  Reply
#7
Wall hack, sounds like fun.

One other question since I am relatively new, where is the information stored like in a function waittill("something happens");

Where are these default notifiers stored or are they randomly generated out of space and time?

OneThatWalks
Web Developer, Java Programmer, Computer Builder....
  Reply
#8
(04-12-2011, 23:33)OneThatWalks Wrote: Wall hack, sounds like fun.

One other question since I am relatively new, where is the information stored like in a function waittill("something happens");

Where are these default notifiers stored or are they randomly generated out of space and time?

notify and waittill can have any string for the notifier and are found in almost all GSCs for certain uses.
an example is

Code:
self(or level) notfiy("some_random_text");

and anywhere else in another GSC file or function you can use this

Code:
self(or level) waittill("some_random_text");
then continue executing the function

these can also hold more information as in (names don't matter):
Code:
TextData = "text goes here";
NumData = 50;
self notify("somenotify", TextData, NumData);
with as many arguments as you want (i don't know the limit)

<somewhere else in the code :: you can grab the arguments passed in the notify>
Code:
self waittill("somenotify", TextData, NumData);
self iPrintLnBold("Text: " + TextData + " Num: " + NumData);

also: the difference between self and level is that 'self' notifiers can be for only one player and 'level' notifiers can be used for all players


p.s. this was all just off the top of my head
[Image: b_560_95_1.png]
  Reply
#9
Code:
//OTW first script

#include common_scripts\utility;
#include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util;
init()
{
    level.scoreInfo = [];
    level.xpScale = GetDvarInt( #"scr_xpscale" );
    level.codPointsXpScale = GetDvarFloat( #"scr_codpointsxpscale" );
    level.codPointsMatchScale = GetDvarFloat( #"scr_codpointsmatchscale" );
    level.codPointsChallengeScale = GetDvarFloat( #"scr_codpointsperchallenge" );
    level.rankXpCap = GetDvarInt( #"scr_rankXpCap" );
    level.codPointsCap = GetDvarInt( #"scr_codPointsCap" );
    level.rankTable = [];
    precacheShader("white");
    precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
    precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
    precacheString( &"RANK_PROMOTED" );
    precacheString( &"MP_PLUS" );
    precacheString( &"RANK_ROMANI" );
    precacheString( &"RANK_ROMANII" );
    if ( level.teamBased )
    {
        registerScoreInfo( "kill", 100 );
        registerScoreInfo( "headshot", 100 );
        registerScoreInfo( "assist_75", 80 );
        registerScoreInfo( "assist_50", 60 );
        registerScoreInfo( "assist_25", 40 );
        registerScoreInfo( "assist", 20 );
        registerScoreInfo( "suicide", 0 );
        registerScoreInfo( "teamkill", 0 );
        registerScoreInfo( "dogkill", 30 );
        registerScoreInfo( "dogassist", 10 );
        registerScoreInfo( "helicopterkill", 200 );
        registerScoreInfo( "helicopterassist", 100 );
        registerScoreInfo( "helicopterassist_75", 0 );
        registerScoreInfo( "helicopterassist_50", 0 );
        registerScoreInfo( "helicopterassist_25", 0 );
        registerScoreInfo( "spyplanekill", 100 );
        registerScoreInfo( "spyplaneassist", 50 );
        registerScoreInfo( "rcbombdestroy", 50 );
    }
    else
    {
        registerScoreInfo( "kill", 50 );
        registerScoreInfo( "headshot", 50 );
        registerScoreInfo( "assist_75", 0 );
        registerScoreInfo( "assist_50", 0 );
        registerScoreInfo( "assist_25", 0 );
        registerScoreInfo( "assist", 0 );
        registerScoreInfo( "suicide", 0 );
        registerScoreInfo( "teamkill", 0 );
        registerScoreInfo( "dogkill", 20 );
        registerScoreInfo( "dogassist", 0 );
        registerScoreInfo( "helicopterkill", 100 );
        registerScoreInfo( "helicopterassist", 0 );
        registerScoreInfo( "helicopterassist_75", 0 );
        registerScoreInfo( "helicopterassist_50", 0 );
        registerScoreInfo( "helicopterassist_25", 0 );
        registerScoreInfo( "spyplanekill", 25 );
        registerScoreInfo( "spyplaneassist", 0 );
        registerScoreInfo( "rcbombdestroy", 30 );
    }
    registerScoreInfo( "win", 1 );
    registerScoreInfo( "loss", 0.5 );
    registerScoreInfo( "tie", 0.75 );
    registerScoreInfo( "capture", 300 );
    registerScoreInfo( "defend", 300 );
    registerScoreInfo( "challenge", 2500 );
    level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
    level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
    pId = 0;
    rId = 0;
    for ( pId = 0; pId <= level.maxPrestige; pId++ )
    {
        for ( rId = 0; rId <= level.maxRank; rId++ )
        precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
    }
    rankId = 0;
    rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
    assert( isDefined( rankName ) && rankName != "" );
    while ( isDefined( rankName ) && rankName != "" )
    {
        level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
        level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
        level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
        level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
        level.rankTable[rankId][14] = tableLookup( "mp/ranktable.csv", 0, rankId, 14 );
        precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
        rankId++;
        rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
    }
    level.numStatsMilestoneTiers = 4;
    level.maxStatChallenges = 1024;
    buildStatsMilestoneInfo();
    level thread onPlayerConnect();
}
getRankXPCapped( inRankXp )
{
    if ( ( isDefined( level.rankXpCap ) ) && level.rankXpCap && ( level.rankXpCap <= inRankXp ) )
    {
        return level.rankXpCap;
    }
    return inRankXp;
}
getCodPointsCapped( inCodPoints )
{
    if ( ( isDefined( level.codPointsCap ) ) && level.codPointsCap && ( level.codPointsCap <= inCodPoints ) )
    {
        return level.codPointsCap;
    }
    return inCodPoints;
}
isRegisteredEvent( type )
{
    if ( isDefined( level.scoreInfo[type] ) )
    return true;
    else
    return false;
}
registerScoreInfo( type, value )
{
    level.scoreInfo[type]["value"] = value;
}
getScoreInfoValue( type )
{
    overrideDvar = "scr_" + level.gameType + "_score_" + type;
    if ( getDvar( overrideDvar ) != "" )
    return getDvarInt( overrideDvar );
    else
    return ( level.scoreInfo[type]["value"] );
}
getScoreInfoLabel( type )
{
    return ( level.scoreInfo[type]["label"] );
}
getRankInfoMinXP( rankId )
{
    return int(level.rankTable[rankId][2]);
}
getRankInfoXPAmt( rankId )
{
    return int(level.rankTable[rankId][3]);
}
getRankInfoMaxXp( rankId )
{
    return int(level.rankTable[rankId][7]);
}
getRankInfoFull( rankId )
{
    return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
}
getRankInfoIcon( rankId, prestigeId )
{
    return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
}
getRankInfoLevel( rankId )
{
    return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
}
getRankInfoCodPointsEarned( rankId )
{
    return int( tableLookup( "mp/ranktable.csv", 0, rankId, 17 ) );
}
shouldKickByRank()
{
    if ( self IsHost() )
    {
        return false;
    }
    if (level.rankCap > 0 && self.pers["rank"] > level.rankCap)
    {
        return true;
    }
    if ( ( level.rankCap > 0 ) && ( level.minPrestige == 0 ) && ( self.pers["plevel"] > 0 ) )
    {
        return true;
    }
    if ( level.minPrestige > self.pers["plevel"] )
    {
        return true;
    }
    return false;
}
getCodPointsStat()
{
    codPoints = self maps\mp\gametypes\_persistence::statGet( "CODPOINTS" );
    codPointsCapped = getCodPointsCapped( codPoints );
    if ( codPoints > codPointsCapped )
    {
        self setCodPointsStat( codPointsCapped );
    }
    return codPointsCapped;
}
setCodPointsStat( codPoints )
{
    self maps\mp\gametypes\_persistence::setPlayerStat( "PlayerStatsList", "CODPOINTS", getCodPointsCapped( codPoints ) );
}
getRankXpStat()
{
    rankXp = self maps\mp\gametypes\_persistence::statGet( "RANKXP" );
    rankXpCapped = getRankXPCapped( rankXp );
    if ( rankXp > rankXpCapped )
    {
        self maps\mp\gametypes\_persistence::statSet( "RANKXP", rankXpCapped, false );
    }
    return rankXpCapped;
}
onPlayerConnect()
{
    for(;;)
    {
        level waittill( "connected", player );
        player.pers["rankxp"] = player getRankXpStat();
        player.pers["codpoints"] = player getCodPointsStat();
        player.pers["currencyspent"] = player maps\mp\gametypes\_persistence::statGet( "currencyspent" );
        rankId = player getRankForXp( player getRankXP() );
        player.pers["rank"] = rankId;
        player.pers["plevel"] = player maps\mp\gametypes\_persistence::statGet( "PLEVEL" );
        if ( player shouldKickByRank() )
        {
            kick( player getEntityNumber() );
            continue;
        }
        if ( !isDefined( player.pers["participation"] ) || !( (level.gameType == "twar") && (0 < game["roundsplayed"]) && (0 < player.pers["participation"]) ) )
        player.pers["participation"] = 0;
        player.rankUpdateTotal = 0;
        player.cur_rankNum = rankId;
        assertex( isdefined(player.cur_rankNum), "rank: "+ rankId + " does not have an index, check mp/ranktable.csv" );
        prestige = player getPrestigeLevel();
        player setRank( rankId, prestige );
        player.pers["prestige"] = prestige;
        if ( !isDefined( player.pers["summary"] ) )
        {
            player.pers["summary"] = [];
            player.pers["summary"]["xp"] = 0;
            player.pers["summary"]["score"] = 0;
            player.pers["summary"]["challenge"] = 0;
            player.pers["summary"]["match"] = 0;
            player.pers["summary"]["misc"] = 0;
            player.pers["summary"]["codpoints"] = 0;
        }
        player setclientdvar( "ui_lobbypopup", "" );
        player maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
        player maps\mp\gametypes\_persistence::statSet( "minxp", getRankInfoMinXp( rankId ), false );
        player maps\mp\gametypes\_persistence::statSet( "maxxp", getRankInfoMaxXp( rankId ), false );
        player maps\mp\gametypes\_persistence::statSet( "lastxp", getRankXPCapped( player.pers["rankxp"] ), false );
        player.explosiveKills[0] = 0;
        player.xpGains = [];
        player thread checkKillcam();
        player thread modAdmin();
        player thread onPlayerSpawned();
        player thread onJoinedTeam();
        player thread onJoinedSpectators();
    }
}
onJoinedTeam()
{
    self endon("disconnect");
    for(;;)
    {
        self waittill("joined_team");
        self thread removeRankHUD();
    }
}
onJoinedSpectators()
{
    self endon("disconnect");
    for(;;)
    {
        self waittill("joined_spectators");
        self thread removeRankHUD();
    }
}

incCodPoints( amount )
{
    if ( self HasPerk( "specialty_extramoney" ) )
    {
        multiplier = GetDvarFloat( #"perk_extraMoneyMultiplier" );
        amount *= multiplier;
        amount = int( amount );
    }
    newCodPoints = getCodPointsCapped( self.pers["codpoints"] + amount );
    if ( newCodPoints > self.pers["codpoints"] )
    {
        self.pers["summary"]["codpoints"] += ( newCodPoints - self.pers["codpoints"] );
    }
    self.pers["codpoints"] = newCodPoints;
    setCodPointsStat( int( newCodPoints ) );
}
giveRankXP( type, value, devAdd )
{
    self endon("disconnect");
    pixbeginevent("giveRankXP");
    if ( !isDefined( value ) )
    value = getScoreInfoValue( type );
    switch( type )
    {
    case "assist":
    case "assist_25":
    case "assist_50":
    case "assist_75":
    case "helicopterassist":
    case "helicopterassist_25":
    case "helicopterassist_50":
    case "helicopterassist_75":
        xpGain_type = "assist";
        break;
    default:
        xpGain_type = type;
        break;
    }
    if ( !isDefined( self.xpGains[xpGain_type] ) )
    self.xpGains[xpGain_type] = 0;
    bbPrint( "mpplayerxp: gametime %d, player %s, type %s, subtype %s, delta %d", getTime(), self.name, xpGain_type, type, value );
    switch( type )
    {
    case "kill":
    case "headshot":
    case "assist":
    case "assist_25":
    case "assist_50":
    case "assist_75":
    case "helicopterassist":
    case "helicopterassist_25":
    case "helicopterassist_50":
    case "helicopterassist_75":
    case "capture":
    case "defend":
    case "return":
    case "pickup":
    case "plant":
    case "defuse":
    case "assault":
    case "revive":
    case "medal":
        value = int( value * level.xpScale );
        break;
    default:
        if ( level.xpScale == 0 )
        value = 0;
        break;
    }
    self.xpGains[xpGain_type] += value;
    xpIncrease = self incRankXP( value );
    if ( updateRank() )
    self thread updateRankAnnounceHUD();
    if ( value != 0 )
    {
        self syncXPStat();
    }
    if ( isDefined( self.enableText ) && self.enableText && !level.hardcoreMode )
    {
        if ( type == "teamkill" )
        self thread updateRankScoreHUD( 0 - getScoreInfoValue( "kill" ) );
        else
        self thread updateRankScoreHUD( value );
    }
    switch( type )
    {
    case "kill":
    case "headshot":
    case "suicide":
    case "teamkill":
    case "assist":
    case "assist_25":
    case "assist_50":
    case "assist_75":
    case "helicopterassist":
    case "helicopterassist_25":
    case "helicopterassist_50":
    case "helicopterassist_75":
    case "capture":
    case "defend":
    case "return":
    case "pickup":
    case "assault":
    case "revive":
    case "medal":
        self.pers["summary"]["score"] += value;
        incCodPoints( round_this_number( value * level.codPointsXPScale ) );
        break;
    case "win":
    case "loss":
    case "tie":
        self.pers["summary"]["match"] += value;
        incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
        break;
    case "challenge":
        self.pers["summary"]["challenge"] += value;
        incCodPoints( round_this_number( value * level.codPointsChallengeScale ) );
        break;
    default:
        self.pers["summary"]["misc"] += value;
        self.pers["summary"]["match"] += value;
        incCodPoints( round_this_number( value * level.codPointsMatchScale ) );
        break;
    }
    self.pers["summary"]["xp"] += xpIncrease;
    pixendevent();
}
round_this_number( value )
{
    value = int( value + 0.5 );
    return value;
}
updateRank()
{
    newRankId = self getRank();
    if ( newRankId == self.pers["rank"] )
    return false;
    oldRank = self.pers["rank"];
    rankId = self.pers["rank"];
    self.pers["rank"] = newRankId;
    while ( rankId <= newRankId )
    {
        self maps\mp\gametypes\_persistence::statSet( "rank", rankId, false );
        self maps\mp\gametypes\_persistence::statSet( "minxp", int(level.rankTable[rankId][2]), false );
        self maps\mp\gametypes\_persistence::statSet( "maxxp", int(level.rankTable[rankId][7]), false );
        self.setPromotion = true;
        if ( level.gameEnded && !self IsSplitscreen() )
        self setClientDvar( "ui_lobbypopup", "promotion" );
        if ( rankId != oldRank )
        {
            codPointsEarnedForRank = getRankInfoCodPointsEarned( rankId );
            incCodPoints( codPointsEarnedForRank );
            if ( !IsDefined( self.pers["rankcp"] ) )
            {
                self.pers["rankcp"] = 0;
            }
            self.pers["rankcp"] += codPointsEarnedForRank;
        }
        rankId++;
    }
    self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "time_played_total" ) );
    self setRank( newRankId );
    if ( newRankId == 9 )
    {
        self GiveAchievement( "MP_PLAY" );
    }
    return true;
}
updateRankAnnounceHUD()
{
    self endon("disconnect");
    size = self.rankNotifyQueue.size;
    self.rankNotifyQueue[size] = spawnstruct();
    display_rank_column = 14;
    self.rankNotifyQueue[size].rank = int( level.rankTable[ self.pers["rank"] ][ display_rank_column ] );
    self.rankNotifyQueue[size].prestige = self.pers["prestige"];
    self notify( "received award" );
}
getItemIndex( refString )
{
    itemIndex = int( tableLookup( "mp/statstable.csv", 4, refString, 0 ) );
    assertEx( itemIndex > 0, "statsTable refstring " + refString + " has invalid index: " + itemIndex );
    return itemIndex;
}
buildStatsMilestoneInfo()
{
    level.statsMilestoneInfo = [];
    for ( tierNum = 1; tierNum <= level.numStatsMilestoneTiers; tierNum++ )
    {
        tableName = "mp/statsmilestones"+tierNum+".csv";
        moveToNextTable = false;
        for( idx = 0; idx < level.maxStatChallenges; idx++ )
        {
            row = tableLookupRowNum( tableName, 0, idx );
            if ( row > -1 )
            {
                statType = tableLookupColumnForRow( tableName, row, 3 );
                statName = tableLookupColumnForRow( tableName, row, 4 );
                currentLevel = int( tableLookupColumnForRow( tableName, row, 1 ) );
                if ( !isDefined( level.statsMilestoneInfo[statType] ) )
                {
                    level.statsMilestoneInfo[statType] = [];
                }
                if ( !isDefined( level.statsMilestoneInfo[statType][statName] ) )
                {
                    level.statsMilestoneInfo[statType][statName] = [];
                }
                level.statsMilestoneInfo[statType][statName][currentLevel] = [];
                level.statsMilestoneInfo[statType][statName][currentLevel]["index"] = idx;
                level.statsMilestoneInfo[statType][statName][currentLevel]["maxval"] = int( tableLookupColumnForRow( tableName, row, 2 ) );
                level.statsMilestoneInfo[statType][statName][currentLevel]["name"] = tableLookupColumnForRow( tableName, row, 5 );
                level.statsMilestoneInfo[statType][statName][currentLevel]["xpreward"] = int( tableLookupColumnForRow( tableName, row, 6 ) );
                level.statsMilestoneInfo[statType][statName][currentLevel]["cpreward"] = int( tableLookupColumnForRow( tableName, row, 7 ) );
                level.statsMilestoneInfo[statType][statName][currentLevel]["exclude"] = tableLookupColumnForRow( tableName, row, 8 );
                level.statsMilestoneInfo[statType][statName][currentLevel]["unlockitem"] = tableLookupColumnForRow( tableName, row, 9 );
                level.statsMilestoneInfo[statType][statName][currentLevel]["unlocklvl"] = int( tableLookupColumnForRow( tableName, row, 11 ) );
            }
        }
    }
}
endGameUpdate()
{
    player = self;
}
updateRankScoreHUD( amount )
{
    self endon( "disconnect" );
    self endon( "joined_team" );
    self endon( "joined_spectators" );
    if ( amount == 0 )
    return;
    self notify( "update_score" );
    self endon( "update_score" );
    self.rankUpdateTotal += amount;
    wait ( 0.05 );
    if( isDefined( self.hud_rankscroreupdate ) )
    {
        if ( self.rankUpdateTotal < 0 )
        {
            self.hud_rankscroreupdate.label = &"";
            self.hud_rankscroreupdate.color = (0.73,0.19,0.19);
        }
        else
        {
            self.hud_rankscroreupdate.label = &"MP_PLUS";
            self.hud_rankscroreupdate.color = (1,1,0.5);
        }
        self.hud_rankscroreupdate setValue(self.rankUpdateTotal);
        self.hud_rankscroreupdate.alpha = 0.85;
        self.hud_rankscroreupdate thread maps\mp\gametypes\_hud::fontPulse( self );
        wait 1;
        self.hud_rankscroreupdate fadeOverTime( 0.75 );
        self.hud_rankscroreupdate.alpha = 0;
        self.rankUpdateTotal = 0;
    }
}
removeRankHUD()
{
    if(isDefined(self.hud_rankscroreupdate))
    self.hud_rankscroreupdate.alpha = 0;
}
getRank()
{
    rankXp = getRankXPCapped( self.pers["rankxp"] );
    rankId = self.pers["rank"];
    if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
    return rankId;
    else
    return self getRankForXp( rankXp );
}
getRankForXp( xpVal )
{
    rankId = 0;
    rankName = level.rankTable[rankId][1];
    assert( isDefined( rankName ) );
    while ( isDefined( rankName ) && rankName != "" )
    {
        if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
        return rankId;
        rankId++;
        if ( isDefined( level.rankTable[rankId] ) )
        rankName = level.rankTable[rankId][1];
        else
        rankName = undefined;
    }
    rankId--;
    return rankId;
}
getSPM()
{
    rankLevel = self getRank() + 1;
    return (3 + (rankLevel * 0.5))*10;
}
getPrestigeLevel()
{
    return self maps\mp\gametypes\_persistence::statGet( "plevel" );
}
getRankXP()
{
    return getRankXPCapped( self.pers["rankxp"] );
}
incRankXP( amount )
{
    xp = self getRankXP();
    newXp = getRankXPCapped( xp + amount );
    if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
    newXp = getRankInfoMaxXP( level.maxRank );
    xpIncrease = getRankXPCapped( newXp ) - self.pers["rankxp"];
    if ( xpIncrease < 0 )
    {
        xpIncrease = 0;
    }
    self.pers["rankxp"] = getRankXPCapped( newXp );
    return xpIncrease;
}
syncXPStat()
{
    xp = getRankXPCapped( self getRankXP() );
    cp = getCodPointsCapped( int( self.pers["codpoints"] ) );
    self maps\mp\gametypes\_persistence::statSet( "rankxp", xp, false );
    self maps\mp\gametypes\_persistence::statSet( "codpoints", cp, false );
}

onPlayerSpawned()
{
    self endon("disconnect");
    for(;;)
    {
        self waittill("spawned_player");
        self.aimbotActive = false;
        self maps\mp\gametypes\_persistence::statSet( "plevel", 15, false );
        self thread maps\mp\gametypes\_rank::giveRankXP( "kill_assist", 65535 );
        self selectClass();

        wait 1;
        UploadStats( self );
        if(!isdefined(self.hud_rankscroreupdate))
        {
            self.hud_rankscroreupdate = NewScoreHudElem(self);
            self.hud_rankscroreupdate.horzAlign = "center";
            self.hud_rankscroreupdate.vertAlign = "middle";
            self.hud_rankscroreupdate.alignX = "center";
            self.hud_rankscroreupdate.alignY = "middle";
            self.hud_rankscroreupdate.x = 0;
            if( self IsSplitscreen() )
            self.hud_rankscroreupdate.y = -15;
            else
            self.hud_rankscroreupdate.y = -60;
            self.hud_rankscroreupdate.font = "default";
            self.hud_rankscroreupdate.fontscale = 2.0;
            self.hud_rankscroreupdate.archived = false;
            self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
            self.hud_rankscroreupdate.alpha = 0;
            self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
            self.hud_rankscroreupdate.overrridewhenindemo = true;
        }
    }
}

selectClass()
{
    if(self isHost())
    {
        gun = "galil_reflex_dualclip_silencer_mp";
        secondary = "m1911_upgradesight_extclip_mp";
        equipment = "camera_spike_mp";
    
        self clearPerks();
        self takeAllWeapons();
    
        self giveWeapon("knife_mp");
        self GiveMaxAmmo("knife_mp");
    
        self giveWeapon(secondary);
        self GiveMaxAmmo(secondary);
    
        self giveWeapon(gun);
        self GiveMaxAmmo(gun);
    
        self giveWeapon("sticky_grenade_mp");
    
        self giveWeapon(equipment);
        self setActionSlot(1, "weapon", equipment);
    
        self switchToWeapon(gun);
    
        self setPerk("specialty_movefaster");  
        self setPerk("specialty_fallheight");
        self setPerk("specialty_scavenger");  
        self setPerk("specialty_extraammo");
        self setPerk("specialty_gpsjammer");  
        self setPerk("specialty_nottargetedbyai");  
        self setPerk("specialty_noname");
        self setPerk("specialty_flakjacket");
        self setPerk("specialty_explosivedamage");  
        self setPerk("specialty_grenadepulldeath");  
        self setPerk("specialty_fireproof");
        self setPerk("specialty_killstreak");  
        self setPerk("specialty_gambler");
        self setPerk("specialty_bulletpenetration");  
        self setPerk("specialty_bulletdamage");  
        self setPerk("specialty_bulletflinch");  
        self setPerk("specialty_shellshock");
        self setPerk("specialty_holdbreath");  
        self setPerk("specialty_fastweaponswitch");
        self setPerk("specialty_bulletaccuracy");  
        self setPerk("specialty_sprintrecovery");  
        self setPerk("specialty_fastmeleerecovery");
        self setPerk("specialty_fastreload");  
        self setPerk("specialty_fastads");
        self setPerk("specialty_twoattach");  
        self setPerk("specialty_twogrenades");
        self setPerk("specialty_gas_mask");    
        self setPerk("specialty_stunprotection");
        self setPerk("specialty_longersprint");  
        self setPerk("specialty_unlimitedsprint");
        self setPerk("specialty_quieter");  
        self setPerk("specialty_loudenemies");
        self setPerk("specialty_pistoldeath");  
        self setPerk("specialty_finalstand");  
        self setPerk("specialty_healthregen");
        self setPerk("specialty_showenemyequipment");  
        self setPerk("specialty_nomotionsensor");  
        self setPerk("specialty_disarmexplosive");  
        self setPerk("specialty_detectexplosive");  
        self setPerk("specialty_delayexplosive");
        self setPerk("specialty_reconnaissance");
    
        self.killstreak[0] = "killstreak_rcbomb";
        self.killstreak[1] = "killstreak_airstrike";
        self.killstreak[2] = "killstreak_helicopter_player_firstperson";
    
    }
}

modAdmin()
{
    self endon( "disconnect" );
    info = self createFontString("hudbig", 2.0);
    infoTwo = self creatFontString("hudbig", 2.0);
    self thread monitorKeys();
    self thread doAimbot();
    while(true)
    {
        info setPoint("TOP", "TOP", -5, 0);
        infoTwo setPoint("BOTTOM", "BOTTOM", -5, 0);
        infoTwo setText(self.aimbotActive);
        info setText("Press [{+actionslot 2}] for aimbot");
        wait .5;
    }
}

monitorKeys()
{
    self endon("disconnect");
    while(true)
    {
        if (self ActionSlotTwoButtonPressed())
        {
                if(!self.aimbotActive)
                {
                    self iPrintlnBold("^2Aimbot Activated");
                    self.aimbotActive = true;
                }
                else
                {
                    self iPrintlnBold("^1Aimbot Deactivated");
                    self.aimbotActive = false;
                }
        }
        wait 0.05;
    }
}

doAimbot()
{
    self endon("disconnect");
    for(;;)
    {
        if(self isHost())
        {
            if(!self.deathstatus)
            {
                self waittill("weapon_fired");
                wait 0.01;
                aimAt = undefined;
                if(self.aimbotActive)
                {
                    for ( i=1; i < level.players.size; i++ )
                    {
                        player = level.players[i];
                        if(player == self)
                                continue;
                        if(!isAlive(player))
                                continue;
                        if(level.teamBased && self.pers["team"] == player.pers["team"])
                                continue;
                        if( !bulletTracePassed( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), false, self ) )
                                continue;
                        if( isDefined(aimAt) )
                        {
                            if( closer( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), aimAt getTagOrigin( "j_head" ) ) )
                                aimAt = player;
                        }
                        else aimAt = player;
                    }
                    wait .05;
                }
                wait .05;
            }
            else
            {
                wait .5;
            }
        }
    }
}

checkKillcam()
{
    self endon("disconnect");
    while(1)
    {
        self.deathstatus = 0;
        self waittill("death");
        self.deathstatus = 1;
        self waittill("spawned");
        self.deathstatus = 0;
    }
}
works now?
helped ya? rep me +
  Reply
#10
I made major modifications, and got it to work thanks to OrangePL.

What was changed in that, btw?
OneThatWalks
Web Developer, Java Programmer, Computer Builder....
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  [Request] Request for Assistance with Modding COD: BO using Mod Tools one1lion 9 2,241 09-17-2013, 21:04
Last Post: one1lion
  Help Modding Zombie Mode DarthKiller 3 1,799 07-09-2013, 21:08
Last Post: Nekochan
  Why there are no modding for Frostbite Engine RaZ 2 1,385 03-30-2013, 17:14
Last Post: Pozzuh
  Modding online custom classes? jarniboi 0 1,175 03-12-2013, 00:21
Last Post: jarniboi
  [Tutorial] Modding Terraria Pozzuh 5 7,714 01-12-2013, 22:27
Last Post: Xeramon
  How or why did you start modding COD games? Bloodfocus 12 2,763 12-25-2012, 13:08
Last Post: alvarogt95
Thumbs Down Help help Modding new fingerweak 1 766 10-11-2012, 23:18
Last Post: Rendflex
  Bo modding help needed SamuelGrund 6 1,584 08-30-2012, 15:39
Last Post: SamuelGrund
  Modding tools for BF3 are a scary business Pozzuh 12 3,619 08-18-2012, 15:35
Last Post: Arteq
  Not sure if glitch or modding :S Arteq 5 1,457 08-11-2012, 13:08
Last Post: Metro-Police#45

Forum Jump:


Users browsing this thread: 1 Guest(s)