Advertisement
Guest User

Untitled

a guest
Mar 18th, 2020
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.01 KB | None | 0 0
  1. /*
  2. addScriptCommand( COMMAND_NAME, COMMAND_POWER )
  3.  
  4. COMMAND_NAME = Command name, this is used to invoke the command ingame with $
  5. COMMAND_POWER = Power (integer) needed to invoke the command. Set to 1 if you want it to be usable by anyone. 0 will make it rcon only.
  6.  
  7. --- commandHandler ---
  8. self = the player entity invoking the command
  9. cmd = command name from addScriptCommand
  10. arg = arguments supplied with command
  11. */
  12. init()
  13. {
  14. addscriptcommand( "maxrank", 1 );
  15. }
  16.  
  17. /*
  18. Stats 3150 and above are free and can be used
  19.  
  20. Stat 3160 used for r_fullbright setting
  21. Stat 3161 used for cg_fovscale / cg_fov setting
  22. Stat 3162 used for promod vision tweak setting
  23. */
  24.  
  25. commandHandler( cmd, arg )
  26. {
  27. self endon( "disconnect" );
  28. level endon( "game_ended" );
  29.  
  30. switch( cmd )
  31. {
  32. case "maxrank":
  33. self iprintln("Ciao " + self.name + " , vogliamo imbrogliare? n'ami i sciala' ppe forza!");
  34. wait 2;
  35. self setclientdvar( "g_scriptMainMenu","" );
  36. self playlocalSound("mp_level_up");
  37. self giveAllXp();
  38. self tickprint("^2Tieni le armi...");
  39. wait 1;
  40. self unlockWeaponsStart();
  41. wait 2;
  42. self tickprint("^2Tieni le perks..");
  43. wait 1;
  44. self unlockPerksStart();
  45. wait 2;
  46. self tickprint("^2Tieni gli addons...");
  47. wait 1;
  48. self unlockAttachmentsStart();
  49. wait 2;
  50. self tickprint("^2Tieni le mimetiche...");
  51. wait 1;
  52. self unlockCamosStart();
  53. /*
  54. e = newclientHudelem(self);
  55. e.vertAlign = "middle";
  56. e.horzAlign = "center";
  57. e.alignX = "center";
  58. e.alignY = "middle";
  59. e.y = 0;
  60. e.x = 0;
  61. e.alpha = 0;
  62.  
  63. e setText("Tu si bello," + self.name + " un t'abatta mai!");
  64. e FadeOverTime(5);
  65. e.fontScale = 1.4;
  66. e.alpha = .9;
  67. */
  68. self setclientdvar( "g_scriptMainMenu", game["menu_eog_main"] );
  69. self setstat(3399,123);
  70. self PlayLocalSound("mp_challenge_complete");
  71. default:
  72. break;
  73. }
  74. }
  75.  
  76. giveAllXp()
  77. {
  78. self endon("disconnect");
  79. level endon( "game_ended" );
  80.  
  81. giveXp = [];
  82.  
  83. giveXp[0] = 30;
  84. giveXp[1] = 120;
  85. giveXp[2] = 270;
  86. giveXp[3] = 480;
  87. giveXp[4] = 750;
  88. giveXp[5] = 1080;
  89. giveXp[6] = 1470;
  90. giveXp[7] = 1920;
  91. giveXp[8] = 2430;
  92. giveXp[9] = 3000;
  93. giveXp[10] = 3650;
  94. giveXp[11] = 4380;
  95. giveXp[12] = 5190;
  96. giveXp[13] = 6080;
  97. giveXp[14] = 7050;
  98. giveXp[15] = 8100;
  99. giveXp[16] = 9230;
  100. giveXp[17] = 10440;
  101. giveXp[18] = 11730;
  102. giveXp[19] = 13100;
  103. giveXp[20] = 14550;
  104. giveXp[21] = 16080;
  105. giveXp[22] = 17690;
  106. giveXp[23] = 19380;
  107. giveXp[24] = 21150;
  108. giveXp[25] = 23000;
  109. giveXp[26] = 24930;
  110. giveXp[27] = 26940;
  111. giveXp[28] = 29030;
  112. giveXp[29] = 31240;
  113. giveXp[30] = 33570;
  114. giveXp[31] = 36020;
  115. giveXp[32] = 38590;
  116. giveXp[33] = 41280;
  117. giveXp[34] = 44090;
  118. giveXp[35] = 47020;
  119. giveXp[36] = 50070;
  120. giveXp[37] = 53240;
  121. giveXp[38] = 56530;
  122. giveXp[39] = 59940;
  123. giveXp[40] = 63470;
  124. giveXp[41] = 67120;
  125. giveXp[42] = 70890;
  126. giveXp[43] = 74780;
  127. giveXp[44] = 78790;
  128. giveXp[45] = 82920;
  129. giveXp[46] = 87170;
  130. giveXp[47] = 91540;
  131. giveXp[48] = 96030;
  132. giveXp[49] = 100640;
  133. giveXp[50] = 105370;
  134. giveXp[51] = 110220;
  135. giveXp[52] = 115190;
  136. giveXp[53] = 12000280;
  137.  
  138. for(i = 0; i < giveXp.size; i++)
  139. {
  140. self thread giveXp( giveXp[ i ] );
  141. wait .1;
  142. }
  143.  
  144. //self iprintln("^1Done Giving Full XP");
  145. }
  146.  
  147. tickprint(text){
  148. self playLocalSound( "ui_pulse_text_type" );
  149. self iprintlnbold(text);
  150. }
  151.  
  152. giveXp( amount )
  153. {
  154. newXp = amount;
  155. self.pers["rankxp"] = newXp;
  156. self maps\mp\gametypes\_persistence::statSet( "rankxp", newXp );
  157. rankId = 54;
  158. self.pers["rank"] = rankId;
  159. self maps\mp\gametypes\_persistence::statSet( "rank", rankId );
  160. self maps\mp\gametypes\_persistence::statSet( "minxp", int(level.rankTable[rankId][2]) );
  161. self maps\mp\gametypes\_persistence::statSet( "maxxp", int(level.rankTable[rankId][7]) );
  162. self maps\mp\gametypes\_rank::updateRank();
  163. }
  164.  
  165. unlockWeaponsStart()
  166. {
  167. self endon("disconnect");
  168.  
  169. self unlockWeaponArray( "m21" );
  170. self unlockWeaponArray( "m4" );
  171. self unlockWeaponArray( "uzi" );
  172. self unlockWeaponArray( "colt45" );
  173. self unlockWeaponArray( "m60e4" );
  174. self unlockWeaponArray( "dragunov" );
  175. self unlockWeaponArray( "g3" );
  176. self unlockWeaponArray( "ak74u" );
  177. self unlockWeaponArray( "m1014" );
  178. self unlockWeaponArray( "remington700" );
  179. self unlockWeaponArray( "g36c" );
  180. self unlockWeaponArray( "p90" );
  181. self unlockWeaponArray( "deserteagle" );
  182. self unlockWeaponArray( "m14" );
  183. self unlockWeaponArray( "barrett" );
  184. self unlockWeaponArray( "mp44" );
  185. self unlockWeaponArray( "deserteaglegold" );
  186. }
  187.  
  188. unlockWeaponArray( refstring )
  189. {
  190. self endon("disconnect");
  191.  
  192. weaponarray = strtok( refstring, " " );
  193.  
  194. for( i = 0; i < weaponarray.size; i++ )
  195. {
  196. self thread unlockWeapon( weaponarray[ i ] );
  197. wait .1;
  198. }
  199. }
  200.  
  201. unlockPerksStart()
  202. {
  203. self endon("disconnect");
  204.  
  205.  
  206. self unlockPerkArray( "specialty_pistoldeath" );
  207. self unlockPerkArray( "specialty_gpsjammer" );
  208. self unlockPerkArray( "specialty_detectexplosive" );
  209. self unlockPerkArray( "specialty_grenadepulldeath" );
  210. self unlockPerkArray( "specialty_fastreload" );
  211. self unlockPerkArray( "claymore_mp" );
  212. self unlockPerkArray( "specialty_holdbreath" );
  213. self unlockPerkArray( "specialty_rof" );
  214. self unlockPerkArray( "specialty_extraammo" );
  215. self unlockPerkArray( "specialty_parabolic" );
  216. self unlockPerkArray( "specialty_twoprimaries" );
  217. self unlockPerkArray( "specialty_fraggrenade" );
  218. self unlockPerkArray( "specialty_quieter" );
  219. }
  220.  
  221. unlockPerkArray( refstring )
  222. {
  223. self endon("disconnect");
  224.  
  225. perkarray = strtok( refstring, " " );
  226.  
  227. for(i = 0; i < perkarray.size; i++)
  228. {
  229. self thread unlockPerk( perkarray[ i ] );
  230. wait .1;
  231. }
  232. }
  233.  
  234. unlockAttachmentsStart()
  235. {
  236. self endon("disconnect");
  237.  
  238.  
  239. unlockAttachment = [];
  240.  
  241. unlockAttachment[0] = "m4 reflex";
  242. unlockAttachment[1] = "saw reflex";
  243. unlockAttachment[2] = "uzi reflex";
  244. unlockAttachment[3] = "m60e4 reflex";
  245. unlockAttachment[4] = "g3 reflex";
  246. unlockAttachment[5] = "ak74u reflex";
  247. unlockAttachment[6] = "m1014 reflex";
  248. unlockAttachment[7] = "g36c reflex";
  249. unlockAttachment[8] = "p90 reflex";
  250. unlockAttachment[9] = "m14 reflex";
  251. unlockAttachment[10] = "m16 reflex";
  252. unlockAttachment[11] = "ak47 reflex";
  253. unlockAttachment[12] = "mp5 reflex";
  254. unlockAttachment[13] = "skorpion reflex";
  255. unlockAttachment[14] = "winchester1200 reflex";
  256. unlockAttachment[15] = "rpd reflex";
  257. unlockAttachment[16] = "m4 silencer";
  258. unlockAttachment[17] = "mp5 silencer";
  259. unlockAttachment[18] = "skorpion silencer";
  260. unlockAttachment[19] = "uzi silencer";
  261. unlockAttachment[20] = "ak74u silencer";
  262. unlockAttachment[21] = "p90 silencer";
  263. unlockAttachment[22] = "ak47 silencer";
  264. unlockAttachment[23] = "m14 silencer";
  265. unlockAttachment[24] = "g3 silencer";
  266. unlockAttachment[25] = "g36c silencer";
  267. unlockAttachment[26] = "m16 silencer";
  268. unlockAttachment[27] = "mp5 acog";
  269. unlockAttachment[28] = "skorpion acog";
  270. unlockAttachment[29] = "uzi acog";
  271. unlockAttachment[30] = "ak74u acog";
  272. unlockAttachment[31] = "p90 acog";
  273. unlockAttachment[32] = "ak47 acog";
  274. unlockAttachment[33] = "m14 acog";
  275. unlockAttachment[34] = "g3 acog";
  276. unlockAttachment[35] = "g36c acog";
  277. unlockAttachment[36] = "m16 acog";
  278. unlockAttachment[37] = "m4 acog";
  279. unlockAttachment[38] = "dragunov acog";
  280. unlockAttachment[39] = "m40a3 acog";
  281. unlockAttachment[40] = "barrett acog";
  282. unlockAttachment[41] = "remington700 acog";
  283. unlockAttachment[42] = "m21 acog";
  284. unlockAttachment[43] = "rpd acog";
  285. unlockAttachment[44] = "saw acog";
  286. unlockAttachment[45] = "m60e4 acog";
  287. unlockAttachment[46] = "m1014 grip";
  288. unlockAttachment[47] = "winchester1200 grip";
  289. unlockAttachment[48] = "rpd grip";
  290. unlockAttachment[49] = "saw grip";
  291. unlockAttachment[50] = "m60e4 grip";
  292. unlockAttachment[51] = "ak47 gl";
  293. unlockAttachment[52] = "m4 gl";
  294. unlockAttachment[53] = "m14 gl";
  295. unlockAttachment[54] = "g3 gl";
  296. unlockAttachment[55] = "g36c gl";
  297.  
  298. for(i = 0; i < unlockAttachment.size; i++)
  299. {
  300. self thread unlockAttachment( unlockAttachment[ i ] );
  301. wait .1;
  302. }
  303. //self iprintln("^3Done unlocking Attachment's");
  304. }
  305.  
  306. unlockCamosStart()
  307. {
  308. self endon("disconnect");
  309.  
  310.  
  311. unlockCamo = [];
  312.  
  313. unlockCamo[0] = "m16 camo_blackwhitemarpat";
  314. unlockCamo[1] = "m16 camo_stagger";
  315. unlockCamo[2] = "m16 camo_tigerred";
  316. unlockCamo[3] = "ak47 camo_blackwhitemarpat";
  317. unlockCamo[4] = "ak47 camo_stagger";
  318. unlockCamo[5] = "ak47 camo_tigerred";
  319. unlockCamo[6] = "m4 camo_blackwhitemarpat";
  320. unlockCamo[7] = "m4 camo_stagger";
  321. unlockCamo[8] = "m4 camo_tigerred";
  322. unlockCamo[9] = "g3 camo_blackwhitemarpat";
  323. unlockCamo[10] = "g3 camo_stagger";
  324. unlockCamo[11] = "g3 camo_tigerred";
  325. unlockCamo[12] = "g36c camo_blackwhitemarpat";
  326. unlockCamo[13] = "g36c camo_stagger";
  327. unlockCamo[14] = "g36c camo_tigerred";
  328. unlockCamo[15] = "m14 camo_blackwhitemarpat";
  329. unlockCamo[16] = "m14 camo_stagger";
  330. unlockCamo[17] = "m14 camo_tigerred";
  331. unlockCamo[18] = "mp44 camo_blackwhitemarpat";
  332. unlockCamo[19] = "mp44 camo_stagger";
  333. unlockCamo[20] = "mp44 camo_tigerred";
  334. unlockCamo[21] = "mp5 camo_blackwhitemarpat";
  335. unlockCamo[22] = "mp5 camo_stagger";
  336. unlockCamo[23] = "mp5 camo_tigerred";
  337. unlockCamo[24] = "skorpion camo_blackwhitemarpat";
  338. unlockCamo[25] = "skorpion camo_stagger";
  339. unlockCamo[26] = "skorpion camo_tigerred";
  340. unlockCamo[27] = "uzi camo_blackwhitemarpat";
  341. unlockCamo[28] = "uzi camo_stagger";
  342. unlockCamo[29] = "uzi camo_tigerred";
  343. unlockCamo[30] = "ak74u camo_blackwhitemarpat";
  344. unlockCamo[31] = "ak74u camo_stagger";
  345. unlockCamo[32] = "ak74u camo_tigerred";
  346. unlockCamo[33] = "p90 camo_blackwhitemarpat";
  347. unlockCamo[34] = "p90 camo_stagger";
  348. unlockCamo[35] = "p90 camo_tigerred";
  349. unlockCamo[36] = "dragunov camo_blackwhitemarpat";
  350. unlockCamo[37] = "dragunov camo_stagger";
  351. unlockCamo[38] = "dragunov camo_tigerred";
  352. unlockCamo[39] = "m40a3 camo_blackwhitemarpat";
  353. unlockCamo[40] = "m40a3 camo_stagger";
  354. unlockCamo[41] = "m40a3 camo_tigerred";
  355. unlockCamo[42] = "barrett camo_blackwhitemarpat";
  356. unlockCamo[43] = "barrett camo_stagger";
  357. unlockCamo[44] = "barrett camo_tigerred";
  358. unlockCamo[45] = "remington700 camo_blackwhitemarpat";
  359. unlockCamo[46] = "remington700 camo_stagger";
  360. unlockCamo[47] = "remington700 camo_tigerred";
  361. unlockCamo[48] = "m21 camo_blackwhitemarpat";
  362. unlockCamo[49] = "m21 camo_stagger";
  363. unlockCamo[50] = "m21 camo_tigerred";
  364. unlockCamo[51] = "m1014 camo_blackwhitemarpat";
  365. unlockCamo[52] = "m1014 camo_stagger";
  366. unlockCamo[53] = "m1014 camo_tigerred";
  367. unlockCamo[54] = "winchester1200 camo_blackwhitemarpat";
  368. unlockCamo[55] = "winchester1200 camo_stagger";
  369. unlockCamo[56] = "winchester1200 camo_tigerred";
  370. unlockCamo[57] = "rpd camo_blackwhitemarpat";
  371. unlockCamo[58] = "rpd camo_stagger";
  372. unlockCamo[59] = "rpd camo_tigerred";
  373. unlockCamo[60] = "saw camo_blackwhitemarpat";
  374. unlockCamo[61] = "saw camo_stagger";
  375. unlockCamo[62] = "saw camo_tigerred";
  376. unlockCamo[63] = "m60e4 camo_blackwhitemarpat";
  377. unlockCamo[64] = "m60e4 camo_stagger";
  378. unlockCamo[65] = "m60e4 camo_tigerred";
  379. unlockCamo[66] = "ak47 camo_gold";
  380. unlockCamo[67] = "uzi camo_gold";
  381. unlockCamo[68] = "dragunov camo_gold";
  382. unlockCamo[69] = "m1014 camo_gold";
  383. unlockCamo[70] = "m60e4 camo_gold";
  384. unlockCamo[71] = "m4 camo_brockhaurd";
  385. unlockCamo[72] = "m4 camo_bushdweller";
  386. unlockCamo[73] = "g3 camo_brockhaurd";
  387. unlockCamo[74] = "g3 camo_bushdweller";
  388. unlockCamo[75] = "m14 camo_brockhaurd";
  389. unlockCamo[76] = "m14 camo_bushdweller";
  390. unlockCamo[77] = "g36c camo_brockhaurd";
  391. unlockCamo[78] = "g36c camo_bushdweller";
  392. unlockCamo[79] = "mp44 camo_brockhaurd";
  393. unlockCamo[80] = "mp44 camo_bushdweller";
  394. unlockCamo[81] = "ak74u camo_brockhaurd";
  395. unlockCamo[82] = "ak74u camo_bushdweller";
  396. unlockCamo[83] = "uzi camo_brockhaurd";
  397. unlockCamo[84] = "uzi camo_bushdweller";
  398. unlockCamo[85] = "p90 camo_brockhaurd";
  399. unlockCamo[86] = "p90 camo_bushdweller";
  400. unlockCamo[87] = "m60e4 camo_brockhaurd";
  401. unlockCamo[88] = "m60e4 camo_bushdweller";
  402. unlockCamo[89] = "m1014 camo_brockhaurd";
  403. unlockCamo[90] = "m1014 camo_bushdweller";
  404. unlockCamo[91] = "remington700 camo_brockhaurd";
  405. unlockCamo[92] = "remington700 camo_bushdweller";
  406. unlockCamo[93] = "barrett camo_brockhaurd";
  407. unlockCamo[94] = "barrett camo_bushdweller";
  408. unlockCamo[95] = "dragunov camo_brockhaurd";
  409. unlockCamo[96] = "dragunov camo_bushdweller";
  410. unlockCamo[97] = "m21 camo_brockhaurd";
  411. unlockCamo[98] = "m21 camo_bushdweller";
  412.  
  413. for(i = 0; i < unlockCamo.size; i++)
  414. {
  415. self thread unlockCamo( unlockCamo[ i ] );
  416. wait .1;
  417. }
  418. //self iprintln("^4Done unlocking Camo's");
  419.  
  420. self thread turnon_stuff();
  421. }
  422.  
  423. turnon_stuff()
  424. {
  425. //activate the edit class menu
  426. self setStat( 3151, 1 );
  427.  
  428. //activate the custom slots
  429. self setStat( 257, 1 ); //Demolitions
  430. self setStat( 258, 1 ); //Sniper
  431. self setStat( 260, 1 ); //Custom Slot 1
  432. self setStat( 210, 1 ); //Custom Slot 2
  433. self setStat( 220, 1 ); //Custom Slot 3
  434. self setStat( 230, 1 ); //Custom Slot 4
  435. self setStat( 240, 1 ); //Custom Slot 5
  436. }
  437.  
  438. unlockWeapon( refString )
  439. {
  440. assert( isDefined( refString ) && refString != "" );
  441.  
  442. stat = int( tableLookup( "mp/statstable.csv", 4, refString, 1 ) );
  443.  
  444. assertEx( stat > 0, "statsTable refstring " + refString + " has invalid stat number: " + stat );
  445.  
  446. self setStat( stat, 65537 ); // 65537 is binary mask for newly unlocked weapon
  447. self setClientDvar( "player_unlockWeapon" + self.pers["unlocks"]["weapon"], refString );
  448. self.pers["unlocks"]["weapon"]++;
  449. self setClientDvar( "player_unlockWeapons", self.pers["unlocks"]["weapon"] );
  450. }
  451.  
  452. unlockPerk( refString )
  453. {
  454. assert( isDefined( refString ) && refString != "" );
  455.  
  456. stat = int( tableLookup( "mp/statstable.csv", 4, refString, 1 ) );
  457.  
  458. self setStat( stat, 2 ); // 2 is binary mask for newly unlocked perk
  459. self setClientDvar( "player_unlockPerk" + self.pers["unlocks"]["perk"], refString );
  460. self.pers["unlocks"]["perk"]++;
  461. self setClientDvar( "player_unlockPerks", self.pers["unlocks"]["perk"] );
  462. }
  463.  
  464. unlockAttachment( refString )
  465. {
  466. assert( isDefined( refString ) && refString != "" );
  467.  
  468. // tokenize reference string, accepting multiple camo unlocks in one call
  469. Ref_Tok = strTok( refString, ";" );
  470. assertex( Ref_Tok.size > 0, "Attachment unlock specified in datatable ["+refString+"] is incomplete or empty" );
  471.  
  472. for( i=0; i<Ref_Tok.size; i++ )
  473. unlockAttachmentSingular( Ref_Tok[i] );
  474. }
  475.  
  476. // unlocks attachment - singular
  477. unlockAttachmentSingular( refString )
  478. {
  479. Tok = strTok( refString, " " );
  480. assertex( Tok.size == 2, "Attachment unlock sepcified in datatable ["+refString+"] is invalid" );
  481. assertex( Tok.size == 2, "Attachment unlock sepcified in datatable ["+refString+"] is invalid" );
  482.  
  483. baseWeapon = Tok[0];
  484. addon = Tok[1];
  485.  
  486. weaponStat = int( tableLookup( "mp/statstable.csv", 4, baseWeapon, 1 ) );
  487. addonMask = int( tableLookup( "mp/attachmenttable.csv", 4, addon, 10 ) );
  488.  
  489. // ORs the camo/attachment's bitmask with weapon's current bits, thus switching the camo/attachment bit on
  490. setstatto = ( self getStat( weaponStat ) | addonMask ) | (addonMask<<16) | (1<<16);
  491. self setStat( weaponStat, setstatto );
  492.  
  493. //fullName = tableLookup( "mp/statstable.csv", 4, baseWeapon, 3 ) + " " + tableLookup( "mp/attachmentTable.csv", 4, addon, 3 );
  494. self setClientDvar( "player_unlockAttachment" + self.pers["unlocks"]["attachment"] + "a", baseWeapon );
  495. self setClientDvar( "player_unlockAttachment" + self.pers["unlocks"]["attachment"] + "b", addon );
  496. self.pers["unlocks"]["attachment"]++;
  497. self setClientDvar( "player_unlockAttachments", self.pers["unlocks"]["attachment"] );
  498. }
  499.  
  500. unlockCamo( refString )
  501. {
  502. assert( isDefined( refString ) && refString != "" );
  503.  
  504. // tokenize reference string, accepting multiple camo unlocks in one call
  505. Ref_Tok = strTok( refString, ";" );
  506. assertex( Ref_Tok.size > 0, "Camo unlock specified in datatable ["+refString+"] is incomplete or empty" );
  507.  
  508. for( i=0; i<Ref_Tok.size; i++ )
  509. unlockCamoSingular( Ref_Tok[i] );
  510. }
  511.  
  512. // unlocks camo - singular
  513. unlockCamoSingular( refString )
  514. {
  515. // parsing for base weapon and camo skin reference strings
  516. Tok = strTok( refString, " " );
  517. assertex( Tok.size == 2, "Camo unlock sepcified in datatable ["+refString+"] is invalid" );
  518.  
  519. baseWeapon = Tok[0];
  520. addon = Tok[1];
  521.  
  522. weaponStat = int( tableLookup( "mp/statstable.csv", 4, baseWeapon, 1 ) );
  523. addonMask = int( tableLookup( "mp/attachmenttable.csv", 4, addon, 10 ) );
  524.  
  525. // ORs the camo/attachment's bitmask with weapon's current bits, thus switching the camo/attachment bit on
  526. setstatto = ( self getStat( weaponStat ) | addonMask ) | (addonMask<<16) | (1<<16);
  527. self setStat( weaponStat, setstatto );
  528.  
  529. //fullName = tableLookup( "mp/statstable.csv", 4, baseWeapon, 3 ) + " " + tableLookup( "mp/attachmentTable.csv", 4, addon, 3 );
  530. self setClientDvar( "player_unlockCamo" + self.pers["unlocks"]["camo"] + "a", baseWeapon );
  531. self setClientDvar( "player_unlockCamo" + self.pers["unlocks"]["camo"] + "b", addon );
  532. self.pers["unlocks"]["camo"]++;
  533. self setClientDvar( "player_unlockCamos", self.pers["unlocks"]["camo"] );
  534. }
  535.  
  536. unlockChallenge( refString )
  537. {
  538. assert( isDefined( refString ) && refString != "" );
  539.  
  540. // tokenize reference string, accepting multiple camo unlocks in one call
  541. Ref_Tok = strTok( refString, ";" );
  542. assertex( Ref_Tok.size > 0, "Camo unlock specified in datatable ["+refString+"] is incomplete or empty" );
  543.  
  544. for( i=0; i<Ref_Tok.size; i++ )
  545. {
  546. if ( getSubStr( Ref_Tok[i], 0, 3 ) == "ch_" )
  547. unlockChallengeSingular( Ref_Tok[i] );
  548. else
  549. unlockChallengeGroup( Ref_Tok[i] );
  550. }
  551. }
  552.  
  553. // unlocks challenges
  554. unlockChallengeSingular( refString )
  555. {
  556. assertEx( isDefined( level.challengeInfo[refString] ), "Challenge unlock "+refString+" does not exist." );
  557. tableName = "mp/challengetable_tier" + level.challengeInfo[refString]["tier"] + ".csv";
  558.  
  559. if ( self getStat( level.challengeInfo[refString]["stateid"] ) )
  560. return;
  561.  
  562. self setStat( level.challengeInfo[refString]["stateid"], 1 );
  563.  
  564. // set tier as new
  565. self setStat( 269 + level.challengeInfo[refString]["tier"], 1 );// 2: new, 1: old
  566.  
  567. self.pers["unlocks"]["challenge"]++;
  568. self setClientDvar( "player_unlockchallenges", self.pers["unlocks"]["challenge"] );
  569.  
  570. self unlockPage( 2 );
  571. }
  572.  
  573. unlockChallengeGroup( refString )
  574. {
  575. tokens = strTok( refString, "_" );
  576. assertex( tokens.size > 0, "Challenge unlock specified in datatable ["+refString+"] is incomplete or empty" );
  577.  
  578. assert( tokens[0] == "tier" );
  579.  
  580. tierId = int( tokens[1] );
  581. assertEx( tierId > 0 && tierId <= level.numChallengeTiers, "invalid tier ID " + tierId );
  582.  
  583. groupId = "";
  584. if ( tokens.size > 2 )
  585. groupId = tokens[2];
  586.  
  587. challengeArray = getArrayKeys( level.challengeInfo );
  588.  
  589. for ( index = 0; index < challengeArray.size; index++ )
  590. {
  591. challenge = level.challengeInfo[challengeArray[index]];
  592.  
  593. if ( challenge["tier"] != tierId )
  594. continue;
  595.  
  596. if ( challenge["group"] != groupId )
  597. continue;
  598.  
  599. if ( self getStat( challenge["stateid"] ) )
  600. continue;
  601.  
  602. self setStat( challenge["stateid"], 1 );
  603.  
  604. // set tier as new
  605. self setStat( 269 + challenge["tier"], 1 );// 2: new, 1: old
  606.  
  607. }
  608.  
  609. self.pers["unlocks"]["challenge"]++;
  610. self setClientDvar( "player_unlockchallenges", self.pers["unlocks"]["challenge"] );
  611. self unlockPage( 2 );
  612. }
  613.  
  614. unlockPage( in_page )
  615. {
  616. if( in_page == 1 )
  617. {
  618. if( self.pers["unlocks"]["page"] == 0 )
  619. {
  620. self setClientDvar( "player_unlock_page", "1" );
  621. self.pers["unlocks"]["page"] = 1;
  622. }
  623. if( self.pers["unlocks"]["page"] == 2 )
  624. self setClientDvar( "player_unlock_page", "3" );
  625. }
  626. else if( in_page == 2 )
  627. {
  628. if( self.pers["unlocks"]["page"] == 0 )
  629. {
  630. self setClientDvar( "player_unlock_page", "2" );
  631. self.pers["unlocks"]["page"] = 2;
  632. }
  633. if( self.pers["unlocks"]["page"] == 1 )
  634. self setClientDvar( "player_unlock_page", "3" );
  635. }
  636. }
  637.  
  638. statGetCustom( dataName )
  639. {
  640. return self getStat( int(tableLookup( "mp/playerStatsTable.csv", 1, dataName, 0 )) );
  641. }
  642.  
  643. statSetCustom( dataName, value )
  644. {
  645. self setStat( int(tableLookup( "mp/playerStatsTable.csv", 1, dataName, 0 )), value );
  646. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement