HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fun>
  4. #include <nvault>
  5. #include <hamsandwich>
  6. #include <fakemeta>
  7.  
  8.  
  9. /* --| Let's force the semicolon on every endline */
  10. #pragma semicolon 1
  11.  
  12. /* --| Some defines :) */
  13. #define PICKUP_SND "items/gunpickup2.wav"
  14. #define HEALTH_SOUND "items/smallmedkit1.wav"
  15. #define ARMOR_SOUND "items/ammopickup2.wav"
  16. #define CLOACK_SOUND "hornet/ag_buzz1.wav"
  17. #define LJ_SOUND "fvox/powermove_on.wav"
  18. #define SOUND_NVGOFF "items/nvg_off.wav"
  19. #define ADMIN_ACCESS_CMD ADMIN_KICK
  20. #define HAS_NVGS (1<<0)
  21. #define USES_NVGS (1<<8)
  22. #define get_user_nvg(%1) (get_pdata_int(%1,m_iNvg) & HAS_NVGS)
  23.  
  24. /* --| Plugin informations */
  25. new const PLUGIN[] = "Deathrun Shop";
  26. new const VERSION[] = "4.0";
  27. new const AUTHOR[] = "tuty";
  28.  
  29. /* --| Zomg lot of globals :) */
  30. new gDrShopOn;
  31. new gHeCost;
  32. new gBothGrenadesCost;
  33. new gSilentCost;
  34. new gHealthCost;
  35. new gArmorCost;
  36. new gSpeedCost;
  37. new gGravityCost;
  38. new gInvisCost;
  39. new gSpeedCvar;
  40. new gGravityCvar;
  41. new gAdvertiseCvar;
  42. new gHealthPointCvar;
  43. new gArmorPointCvar;
  44. new gAdvertiseTimeCvar;
  45. new gInvisPercent;
  46. new gKillerPointsCvar;
  47. new gSuiciderPointsCvar;
  48. new gSavePlayerPoints;
  49. new gNoclipCost;
  50. new gVault;
  51. new gNoclipTime;
  52. new gJetSprite;
  53. new gJetPackCost;
  54. new gJetTime;
  55. new gDeagleCost;
  56. new gMsgItemPickup;
  57. new gLongJumpTime;
  58. new gLongJumpCost;
  59. new gGlowCost;
  60. new gNvgCost;
  61. new gMessageNVG;
  62.  
  63. /* --| Item variables */
  64. new HasHe[ 33 ];
  65. new HasBothGren[ 33 ];
  66. new HasSilent[ 33 ];
  67. new HasHealth[ 33 ];
  68. new HasArmor[ 33 ];
  69. new HasSpeed[ 33 ];
  70. new HasGravity[ 33 ];
  71. new HasInvis[ 33 ];
  72. new HasNoclip[ 33 ];
  73. new HasJet[ 33 ];
  74. new HasDeagle[ 33 ];
  75. new HasLongJump[ 33 ];
  76. new HasGlow[ 33 ];
  77. new HasNVG[ 33 ];
  78. new gName[ 32 char ];
  79. new gSteamID[ 32 ];
  80. new vKey[ 64 ];
  81. new vData[ 64 ];
  82.  
  83. /* --| Player points, need this to save points, load points, etc */
  84. new gKillerPoints[ 33 ];
  85.  
  86. /* --| Offsets for nvg */
  87. const m_iNvg = 129;
  88. const m_iLinuxDiff = 5;
  89.  
  90. /* --| So, let's get started */
  91. public plugin_init()
  92. {
  93. /* --| Registering the plugin to show when you type amx_plugins.. */
  94. register_plugin( PLUGIN, VERSION, AUTHOR );
  95.  
  96. /* --| Registering a little cvar to see wich servers using this plugin */
  97. register_cvar( "drshop_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
  98.  
  99. /* --| Register some usefull events */
  100. register_logevent( "logevent_round_start", 2, "1=Round_Start" );
  101. register_event( "DeathMsg", "Hook_Deathmessage", "a" );
  102. register_event( "CurWeapon", "HookCurWeapon", "be", "1=1" );
  103.  
  104. /* --| Called when a player is performing a jump */
  105. RegisterHam( Ham_Player_Jump, "player", "bacon_playerJumping" );
  106.  
  107. /* --| We need this forward to find if player has suicided with kill in console */
  108. /* --| We can't do that on deathmsg because player die in traps by suicide,.. trigger_hurt or world.. etc */
  109. register_forward( FM_ClientKill, "forward_kill" );
  110.  
  111. /* --| Command for setting points to player/@all */
  112. register_concmd( "deathrun_set_points", "cmdSetPoints", ADMIN_ACCESS_CMD, "<name/@all> <points> - set points to a player" );
  113.  
  114. /* --| Command for reseting points to palyer/@all */
  115. register_concmd( "deathrun_reset_points", "cmdResetPoints", ADMIN_ACCESS_CMD, "<name/@all> - reset player points" );
  116.  
  117. /* --| Command for opening the menu */
  118. register_clcmd( "say /drshop", "DeathrunShop" );
  119. register_clcmd( "say_team /drshop", "DeathrunShop" );
  120.  
  121. /* --| Command to see our points :) */
  122. register_clcmd( "say /mypoints", "ShowPoints" );
  123. register_clcmd( "say_team /mypoints", "ShowPoints" );
  124.  
  125.  
  126. /* --| Let's register the cvars, a lot of cvars but huh.. stf :) */
  127. gDrShopOn = register_cvar( "deathrun_shop", "1" );
  128. gHeCost = register_cvar( "deathrun_he_cost", "10" );
  129. gBothGrenadesCost = register_cvar( "deathrun_bothgrenades_cost", "20" );
  130. gSilentCost = register_cvar( "deathrun_silent_cost", "24" );
  131. gHealthCost = register_cvar( "deathrun_health_cost", "30" );
  132. gArmorCost = register_cvar( "deathrun_armor_cost", "15" );
  133. gSpeedCost = register_cvar( "deathrun_speed_cost", "39" );
  134. gGravityCost = register_cvar( "deathrun_gravity_cost", "41" );
  135. gNoclipCost = register_cvar( "deathrun_noclip_cost", "50" );
  136. gJetPackCost = register_cvar( "deathrun_jetpack_cost", "60" );
  137. gInvisCost = register_cvar( "deathrun_invisibility_cost", "69" );
  138. gSpeedCvar = register_cvar( "deathrun_speed_power", "400.0" );
  139. gNoclipTime = register_cvar( "deathrun_noclip_duration", "2" );
  140. gJetTime = register_cvar( "deathrun_jetpack_duration", "10" );
  141. gDeagleCost = register_cvar( "deathrun_deagle_cost", "31" );
  142. gGravityCvar = register_cvar( "deathrun_gravity_power", "0.7" );
  143. gAdvertiseCvar = register_cvar( "deathrun_advertise_message", "1" );
  144. gHealthPointCvar = register_cvar( "deathrun_health_points", "255" );
  145. gArmorPointCvar = register_cvar( "deathrun_armor_points", "400" );
  146. gAdvertiseTimeCvar = register_cvar( "deathrun_advertise_time", "7.0" );
  147. gInvisPercent = register_cvar( "deathrun_invisibility_percentage", "111" );
  148. gKillerPointsCvar = register_cvar( "deathrun_killer_bonuspoints", "5" );
  149. gSuiciderPointsCvar = register_cvar( "deathrun_suicider_loose_points", "3" );
  150. gSavePlayerPoints = register_cvar( "deathrun_save_points", "1" );
  151. gLongJumpTime = register_cvar( "deathrun_longjump_duration", "6" );
  152. gLongJumpCost = register_cvar( "deathrun_longjump_cost", "46" );
  153. gGlowCost = register_cvar( "deathrun_glow_cost", "8" );
  154. gNvgCost = register_cvar( "deathrun_nvg_cost", "33" );
  155.  
  156. /* --| Let's find/do some stuff here */
  157. gMsgItemPickup = get_user_msgid( "ItemPickup" );
  158. gMessageNVG = get_user_msgid( "NVGToggle" );
  159.  
  160. /* --| Register the multilingual file */
  161. register_dictionary( "DeathrunShopLang.txt" );
  162. }
  163.  
  164. /* --| Precache stuff */
  165. public plugin_precache()
  166. {
  167. gJetSprite = precache_model( "sprites/explode1.spr" );
  168. precache_sound( PICKUP_SND );
  169. precache_sound( HEALTH_SOUND );
  170. precache_sound( ARMOR_SOUND );
  171. precache_sound( CLOACK_SOUND );
  172. precache_sound( LJ_SOUND );
  173. }
  174.  
  175. /* --| Plugin cfg, here we do some ugly shit ever -.- */
  176. public plugin_cfg()
  177. {
  178. new iCfgDir[ 32 ], iFile[ 192 ];
  179.  
  180. /* --| We need to find the configs directory, and to add the configuration file */
  181. get_configsdir( iCfgDir, charsmax( iCfgDir ) );
  182. formatex( iFile, charsmax( iFile ), "%s/DeathrunShop_Cfg.cfg", iCfgDir );
  183.  
  184. /* --| If file not exists, let's create one but empty */
  185. if( !file_exists( iFile ) )
  186. {
  187. server_print( "[DrShop] %L", LANG_SERVER, "DRSHOP_SVPRINT", iFile );
  188. write_file( iFile, " ", -1 );
  189. }
  190.  
  191. /* --| Else, let's load the cvars from cfg */
  192. else
  193. {
  194. server_print( "[DrShop] %L", LANG_SERVER, "DRSHOP_SVPRINT_DONE", iFile );
  195. server_cmd( "exec %s", iFile );
  196. }
  197.  
  198. /* --| Set the server maxspeed to a high value, need it for speed item */
  199. server_cmd( "sv_maxspeed 99999999.0" );
  200. }
  201.  
  202. /* --| When client is connecting, let's reset stuff and load client's points */
  203. public client_connect( id )
  204. {
  205. HasHe[ id ] = false;
  206. HasBothGren[ id ] = false;
  207. HasSilent[ id ] = false;
  208. HasHealth[ id ] = false;
  209. HasArmor[ id] = false;
  210. HasSpeed[ id ] = false;
  211. HasGravity[ id ] = false;
  212. HasInvis[ id ] = false;
  213. HasNoclip[ id ] = false;
  214. HasJet[ id ] = false;
  215. HasDeagle[ id ] = false;
  216. HasLongJump[ id ] = false;
  217. HasGlow[ id ] = false;
  218. HasNVG[ id ] = false;
  219.  
  220. /* --| Load client points */
  221. load_client_points( id );
  222. }
  223.  
  224. /* --| When client has disconnected let's reset stuff and save points */
  225. public client_disconnect( id )
  226. {
  227. HasHe[ id ] = false;
  228. HasBothGren[ id ] = false;
  229. HasSilent[ id ] = false;
  230. HasHealth[ id ] = false;
  231. HasArmor[ id] = false;
  232. HasSpeed[ id ] = false;
  233. HasGravity[ id ] = false;
  234. HasInvis[ id ] = false;
  235. HasNoclip[ id ] = false;
  236. HasJet[ id ] = false;
  237. HasDeagle[ id ] = false;
  238. HasLongJump[ id ] = false;
  239. HasGlow[ id ] = false;
  240. HasNVG[ id ] = false;
  241.  
  242. /* --| If player is not a bot, let's save the points */
  243. if( get_pcvar_num( gSavePlayerPoints ) != 0 && !is_user_bot( id ) )
  244. {
  245. /* --| Save player points is cvar is 1 */
  246. save_client_points( id );
  247. }
  248. }
  249.  
  250. /* --| When client has entered on sv, need to show him a hudmessage :) */
  251. public client_putinserver( id )
  252. {
  253. if( get_pcvar_num( gAdvertiseCvar ) != 0 )
  254. {
  255. /* --| Need to set task, 7 default because need to wait for player choosing a team or something */
  256. set_task( get_pcvar_float( gAdvertiseTimeCvar ), "ShowPlayerInfo", id );
  257. }
  258. }
  259.  
  260. /* --| Deathrun shop menu with items ^^ */
  261. public DeathrunShop( id )
  262. {
  263. /* --| If cvar is set to 0, player can't open the shop */
  264. if( get_pcvar_num( gDrShopOn ) != 1 )
  265. {
  266. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_DISABLED" );
  267. return PLUGIN_HANDLED;
  268. }
  269.  
  270. /* --| If player is dead, cant buy items :) */
  271. if( !is_user_alive( id ) )
  272. {
  273. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_ONLY_ALIVE" );
  274. return PLUGIN_HANDLED;
  275. }
  276.  
  277. /* --| Menu stuff */
  278. new szText[ 555 char ];
  279. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_MENU_TITLE", VERSION, gKillerPoints[ id ] );
  280.  
  281. new menu = menu_create( szText, "shop_handler" );
  282.  
  283. /* --| Menu item 1 */
  284. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_1", get_pcvar_num( gHeCost ) );
  285. menu_additem( menu, szText, "1", 0 );
  286.  
  287. /* --| Menu item 2 */
  288. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_2", get_pcvar_num( gBothGrenadesCost ) );
  289. menu_additem( menu, szText, "2", 0 );
  290.  
  291. /* --| Menu item 3 */
  292. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_3", get_pcvar_num( gSilentCost ) );
  293. menu_additem( menu, szText, "3", 0 );
  294.  
  295. /* --| Menu item 4 */
  296. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_4", get_pcvar_num( gHealthPointCvar ), get_pcvar_num( gHealthCost ) );
  297. menu_additem( menu, szText, "4", 0 );
  298.  
  299. /* --| Menu item 5 */
  300. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_5", get_pcvar_num( gArmorPointCvar ), get_pcvar_num( gArmorCost ) );
  301. menu_additem( menu, szText, "5", 0 );
  302.  
  303. /* --| Menu item 6 */
  304. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_6", get_pcvar_num( gSpeedCost ) );
  305. menu_additem( menu, szText, "6", 0 );
  306.  
  307. /* --| Menu item 7 */
  308. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_7", get_pcvar_num( gGravityCost ) );
  309. menu_additem( menu, szText, "7", 0 );
  310.  
  311. /* --| Menu item 8 */
  312. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_8", get_pcvar_num( gInvisPercent ), get_pcvar_num( gInvisCost ) );
  313. menu_additem( menu, szText, "8", 0 );
  314.  
  315. /* --| Menu item 9 */
  316. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_9", get_pcvar_num( gNoclipTime ), get_pcvar_num( gNoclipCost ) );
  317. menu_additem( menu, szText, "9", 0 );
  318.  
  319. /* --| Menu item 10 */
  320. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_10", get_pcvar_num( gJetTime ), get_pcvar_num( gJetPackCost ) );
  321. menu_additem( menu, szText, "10", 0 );
  322.  
  323. /* --| Menu item 11 */
  324. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_11", get_pcvar_num( gDeagleCost ) );
  325. menu_additem( menu, szText, "11", 0 );
  326.  
  327. /* --| Menu item 12 */
  328. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_12", get_pcvar_num( gLongJumpTime ), get_pcvar_num( gLongJumpCost ) );
  329. menu_additem( menu, szText, "12", 0 );
  330.  
  331. /* --| Menu item 13 */
  332. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_13", get_pcvar_num( gGlowCost ) );
  333. menu_additem( menu, szText, "13", 0 );
  334.  
  335. /* --| Menu item 14 */
  336. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_14", get_pcvar_num( gNvgCost ) );
  337. menu_additem( menu, szText, "14", 0 );
  338.  
  339. menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
  340.  
  341. /* --| Show the menu, with current page 0 */
  342. menu_display( id, menu, 0 );
  343.  
  344. return PLUGIN_CONTINUE;
  345. }
  346.  
  347. /* --| Menu commands */
  348. public shop_handler( id, menu, item )
  349. {
  350. /* --| If key is 0, let's close the menu */
  351. if( item == MENU_EXIT )
  352. {
  353. menu_destroy( menu );
  354. return PLUGIN_HANDLED;
  355. }
  356.  
  357. /* --| Getting the menu information */
  358. new data[ 6 ], iName[ 64 ], access, callback;
  359. menu_item_getinfo( menu, item, access, data, charsmax( data ), iName, charsmax( iName ), callback );
  360.  
  361. /* --| Get menu keys */
  362. new key = str_to_num( data );
  363.  
  364. /* --| Here we find the player points */
  365. new points = gKillerPoints[ id ];
  366.  
  367. switch( key )
  368. {
  369. /* --| Menu item 1 */
  370. case 1:
  371. {
  372. /* --| If already has item, show a damn print and return */
  373. if( HasHe[ id ] )
  374. {
  375. allready_have( id );
  376. return PLUGIN_HANDLED;
  377. }
  378.  
  379. /* --| If player does not have enough points, show a print and return */
  380. if( points < get_pcvar_num( gHeCost ) )
  381. {
  382. dont_have( id );
  383. return PLUGIN_HANDLED;
  384. }
  385.  
  386. /* --| Let's give the item, and do some stuff */
  387. give_item( id, "weapon_hegrenade" );
  388.  
  389. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_GRENADE_ITEM" );
  390. HasHe[ id ] = true;
  391.  
  392. gKillerPoints[ id ] -= get_pcvar_num( gHeCost );
  393. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  394. menu_display( id, menu, 0 );
  395. }
  396.  
  397. /* --| Menu item 2 */
  398. case 2:
  399. {
  400. /* --| If already has item, show a damn print and return */
  401. if( HasBothGren[ id ] )
  402. {
  403. allready_have( id );
  404. return PLUGIN_HANDLED;
  405. }
  406.  
  407. /* --| If player does not have enough points, show a print and return */
  408. if( points < get_pcvar_num( gBothGrenadesCost ) )
  409. {
  410. dont_have( id );
  411. return PLUGIN_HANDLED;
  412. }
  413.  
  414. /* --| Let's give the item, and do some stuff */
  415. give_item( id, "weapon_hegrenade" );
  416. give_item( id, "weapon_flashbang" );
  417. give_item( id, "weapon_flashbang" );
  418.  
  419. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_BOTHGREN_ITEM" );
  420. HasBothGren[ id ] = true;
  421.  
  422. gKillerPoints[ id ] -= get_pcvar_num( gBothGrenadesCost );
  423. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  424. menu_display( id, menu, 0 );
  425. }
  426.  
  427. /* --| Menu item 3 */
  428. case 3:
  429. {
  430. /* --| If already has item, show a damn print and return */
  431. if( HasSilent[ id ] )
  432. {
  433. allready_have( id );
  434. return PLUGIN_HANDLED;
  435. }
  436.  
  437. /* --| If player does not have enough points, show a print and return */
  438. if( points < get_pcvar_num( gSilentCost ) )
  439. {
  440. dont_have( id );
  441. return PLUGIN_HANDLED;
  442. }
  443.  
  444. /* --| Let's give the item, and do some stuff */
  445. set_user_footsteps( id, 1 );
  446.  
  447. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_SILENTWALK_ITEM" );
  448. HasSilent[ id ] = true;
  449.  
  450. gKillerPoints[ id ] -= get_pcvar_num( gSilentCost );
  451. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  452. menu_display( id, menu, 0 );
  453. }
  454.  
  455. /* --| Menu item 4 */
  456. case 4:
  457. {
  458. /* --| If already has item, show a damn print and return */
  459. if( HasHealth[ id ] )
  460. {
  461. allready_have( id );
  462. return PLUGIN_HANDLED;
  463. }
  464.  
  465. /* --| If player does not have enough points, show a print and return */
  466. if( points < get_pcvar_num( gHealthCost ) )
  467. {
  468. dont_have( id );
  469. return PLUGIN_HANDLED;
  470. }
  471.  
  472. /* --| Let's give the item, and do some stuff */
  473. set_user_health( id, get_user_health( id ) + get_pcvar_num( gHealthPointCvar ) );
  474.  
  475. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_HEALTH_ITEM", get_pcvar_num( gHealthPointCvar ) );
  476. HasHealth[ id ] = true;
  477.  
  478. gKillerPoints[ id ] -= get_pcvar_num( gHealthCost );
  479. emit_sound( id, CHAN_ITEM, HEALTH_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  480. menu_display( id, menu, 0 );
  481. }
  482.  
  483. /* --| Menu item 5 */
  484. case 5:
  485. {
  486. /* --| If already has item, show a damn print and return */
  487. if( HasArmor[ id ] )
  488. {
  489. allready_have( id );
  490. return PLUGIN_HANDLED;
  491. }
  492.  
  493. /* --| If player does not have enough points, show a print and return */
  494. if( points < get_pcvar_num( gArmorCost ) )
  495. {
  496. dont_have( id );
  497. return PLUGIN_HANDLED;
  498. }
  499.  
  500. /* --| Let's give the item, and do some stuff */
  501. set_user_armor( id, get_user_armor( id ) + get_pcvar_num( gArmorPointCvar ) );
  502.  
  503. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_ARMOR_ITEM", get_pcvar_num( gArmorPointCvar ) );
  504. HasArmor[ id ] = true;
  505.  
  506. gKillerPoints[ id ] -= get_pcvar_num( gArmorCost );
  507. emit_sound( id, CHAN_ITEM, ARMOR_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  508. menu_display( id, menu, 0 );
  509. }
  510.  
  511. /* --| Menu item 6 */
  512. case 6:
  513. {
  514. /* --| If already has item, show a damn print and return */
  515. if( HasSpeed[ id ] )
  516. {
  517. allready_have( id );
  518. return PLUGIN_HANDLED;
  519. }
  520.  
  521. /* --| If player does not have enough points, show a print and return */
  522. if( points < get_pcvar_num( gSpeedCost ) )
  523. {
  524. dont_have( id );
  525. return PLUGIN_HANDLED;
  526. }
  527.  
  528. /* --| Let's give the item, and do some stuff */
  529. set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
  530.  
  531. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_SPEED_ITEM" );
  532. HasSpeed[ id ] = true;
  533.  
  534. gKillerPoints[ id ] -= get_pcvar_num( gSpeedCost );
  535. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  536. menu_display( id, menu, 0 );
  537. }
  538.  
  539. /* --| Menu item 7 */
  540. case 7:
  541. {
  542. /* --| If already has item, show a damn print and return */
  543. if( HasGravity[ id ] )
  544. {
  545. allready_have( id );
  546. return PLUGIN_HANDLED;
  547. }
  548.  
  549. /* --| If player does not have enough points, show a print and return */
  550. if( points < get_pcvar_num( gGravityCost ) )
  551. {
  552. dont_have( id );
  553. return PLUGIN_HANDLED;
  554. }
  555.  
  556. /* --| Let's give the item, and do some stuff */
  557. set_user_gravity( id, get_pcvar_float( gGravityCvar ) );
  558.  
  559. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_GRAVITY_ITEM" );
  560. HasGravity[ id ] = true;
  561.  
  562. gKillerPoints[ id ] -= get_pcvar_num( gGravityCost );
  563. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  564. menu_display( id, menu, 0 );
  565. }
  566.  
  567. /* --| Menu item 8 */
  568. case 8:
  569. {
  570. /* --| If already has item, show a damn print and return */
  571. if( HasInvis[ id ] )
  572. {
  573. allready_have( id );
  574. return PLUGIN_HANDLED;
  575. }
  576.  
  577. /* --| If player does not have enough points, show a print and return */
  578. if( points < get_pcvar_num( gInvisCost ) )
  579. {
  580. dont_have( id );
  581. return PLUGIN_HANDLED;
  582. }
  583.  
  584. /* --| Let's give the item, and do some stuff */
  585. set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, get_pcvar_num( gInvisPercent ) );
  586.  
  587. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_INVISIBILITY_ITEM" );
  588. HasInvis[ id ] = true;
  589.  
  590. gKillerPoints[ id ] -= get_pcvar_num( gInvisCost );
  591. emit_sound( id, CHAN_ITEM, CLOACK_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  592. menu_display( id, menu, 1 );
  593. }
  594.  
  595. /* --| Menu item 9 */
  596. case 9:
  597. {
  598. /* --| If already has item, show a damn print and return */
  599. if( HasNoclip[ id ] )
  600. {
  601. allready_have( id );
  602. return PLUGIN_HANDLED;
  603. }
  604.  
  605. /* --| If player does not have enough points, show a print and return */
  606. if( points < get_pcvar_num( gNoclipCost ) )
  607. {
  608. dont_have( id );
  609. return PLUGIN_HANDLED;
  610. }
  611.  
  612. /* --| Let's give the item, and do some stuff */
  613. set_task( float( get_pcvar_num( gNoclipTime ) ), "remove_noclip", id );
  614. set_user_noclip( id, 1 );
  615.  
  616. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_NOCLIP_ITEM" );
  617. HasNoclip[ id ] = true;
  618.  
  619. gKillerPoints[ id ] -= get_pcvar_num( gNoclipCost );
  620. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  621. menu_display( id, menu, 1 );
  622. }
  623.  
  624. /* --| Menu item 10 */
  625. case 10:
  626. {
  627. /* --| If already has item, show a damn print and return */
  628. if( HasJet[ id ] )
  629. {
  630. allready_have( id );
  631. return PLUGIN_HANDLED;
  632. }
  633.  
  634. /* --| If player does not have enough points, show a print and return */
  635. if( points < get_pcvar_num( gJetPackCost ) )
  636. {
  637. dont_have( id );
  638. return PLUGIN_HANDLED;
  639. }
  640.  
  641. /* --| Let's give the item, and do some stuff */
  642. set_task( float( get_pcvar_num( gJetTime ) ), "remove_jetpack", id );
  643.  
  644. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_JETPACK_ITEM" );
  645. HasJet[ id ] = true;
  646.  
  647. gKillerPoints[ id ] -= get_pcvar_num( gJetPackCost );
  648. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  649. menu_display( id, menu, 1 );
  650. }
  651.  
  652. /* --| Menu item 11 */
  653. case 11:
  654. {
  655. /* --| If already has item, show a damn print and return */
  656. if( HasDeagle[ id ] || user_has_weapon( id, CSW_DEAGLE ) )
  657. {
  658. allready_have( id );
  659. return PLUGIN_HANDLED;
  660. }
  661.  
  662. /* --| If player does not have enough points, show a print and return */
  663. if( points < get_pcvar_num( gDeagleCost ) )
  664. {
  665. dont_have( id );
  666. return PLUGIN_HANDLED;
  667. }
  668.  
  669. /* --| Let's give the item, and do some stuff */
  670. strip_user_weapons( id );
  671. give_item( id, "weapon_knife" );
  672. give_item( id, "weapon_deagle" );
  673.  
  674. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_DEAGLE_ITEM" );
  675. HasDeagle[ id ] = true;
  676.  
  677. gKillerPoints[ id ] -= get_pcvar_num( gDeagleCost );
  678. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  679. menu_display( id, menu, 1 );
  680. }
  681.  
  682. /* --| Menu item 12 */
  683. case 12:
  684. {
  685. /* --| If already has item, show a damn print and return */
  686. if( HasLongJump[ id ] )
  687. {
  688. allready_have( id );
  689. return PLUGIN_HANDLED;
  690. }
  691.  
  692. /* --| If player does not have enough points, show a print and return */
  693. if( points < get_pcvar_num( gLongJumpCost ) )
  694. {
  695. dont_have( id );
  696. return PLUGIN_HANDLED;
  697. }
  698.  
  699. /* --| Let's give the item, and do some stuff */
  700. /* --| Setting the temporary long jump */
  701. set_temporary_longjump( id );
  702.  
  703. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_LJ_ITEM" );
  704. HasLongJump[ id ] = true;
  705.  
  706. gKillerPoints[ id ] -= get_pcvar_num( gLongJumpCost );
  707. emit_sound( id, CHAN_ITEM, LJ_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  708. menu_display( id, menu, 1 );
  709. }
  710.  
  711. /* --| Menu item 13 */
  712. case 13:
  713. {
  714. /* --| If already has item, show a damn print and return */
  715. if( HasGlow[ id ] )
  716. {
  717. allready_have( id );
  718. return PLUGIN_HANDLED;
  719. }
  720.  
  721. /* --| If player does not have enough points, show a print and return */
  722. if( points < get_pcvar_num( gGlowCost ) )
  723. {
  724. dont_have( id );
  725. return PLUGIN_HANDLED;
  726. }
  727.  
  728. /* --| Let's give the item, and do some stuff */
  729. set_user_rendering( id, kRenderFxGlowShell, random( 256 ), random( 256 ), random( 256 ), kRenderNormal, random( 256 ) );
  730.  
  731. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_GLOW_ITEM" );
  732. HasGlow[ id ] = true;
  733.  
  734. gKillerPoints[ id ] -= get_pcvar_num( gGlowCost );
  735. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  736. menu_display( id, menu, 1 );
  737. }
  738.  
  739. /* --| Menu item 13 */
  740. case 14:
  741. {
  742. /* --| If already has item, show a damn print and return */
  743. if( HasNVG[ id ] || get_user_nvg( id ) )
  744. {
  745. allready_have( id );
  746. return PLUGIN_HANDLED;
  747. }
  748.  
  749. /* --| If player does not have enough points, show a print and return */
  750. if( points < get_pcvar_num( gNvgCost ) )
  751. {
  752. dont_have( id );
  753. return PLUGIN_HANDLED;
  754. }
  755.  
  756. /* --| Let's give the item, and do some stuff */
  757. set_user_nvg( id, 1 );
  758.  
  759. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_NVG_ITEM" );
  760. HasNVG[ id ] = true;
  761.  
  762. gKillerPoints[ id ] -= get_pcvar_num( gNvgCost );
  763. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  764. menu_display( id, menu, 1 );
  765. }
  766. }
  767.  
  768. return PLUGIN_HANDLED;
  769. }
  770.  
  771. /* --| Command for setting points | admin only ;/ */
  772. public cmdSetPoints( id, level, cid )
  773. {
  774. /* --| If user doesn't have acces to command, return */
  775. if( !cmd_access( id, level, cid, 2 ) || !get_pcvar_num( gDrShopOn ) )
  776. {
  777. return PLUGIN_HANDLED;
  778. }
  779.  
  780. /* --| Need to read the first argument */
  781. new argument[ 32 ];
  782. read_argv( 1, argument, charsmax( argument ) );
  783.  
  784. /* --| Need to read second argument */
  785. new give_points[ 5 ];
  786. read_argv( 2, give_points, charsmax( give_points ) );
  787.  
  788. /* --| We are getting the gift from second argument */
  789. new gift = str_to_num( give_points );
  790.  
  791. new iPlayer[ 32 ], iNum, all;
  792. get_players( iPlayer, iNum, "c" );
  793.  
  794. /* --| Lets see if argument 1 is @all */
  795. if( equal( argument, "@all" ) )
  796. {
  797. for( new i; i < iNum; i++ )
  798. {
  799. /* --| Find the index :) */
  800. all = iPlayer[ i ];
  801.  
  802. /* --| Set points to all */
  803. gKillerPoints[ all ] = gKillerPoints[ all ] + gift;
  804.  
  805. /* --| Show a print in chat */
  806. get_user_name( id, gName, charsmax( gName ) );
  807. client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOW_ALLCMD", gName, gift );
  808. }
  809. }
  810.  
  811. else
  812. {
  813. /* --| Now, we find the target */
  814. new player = cmd_target( id, argument, 10 );
  815.  
  816. /* --| If is not a valid target, return */
  817. if( !player )
  818. {
  819. return PLUGIN_HANDLED;
  820. }
  821.  
  822.  
  823. /* --| Get admin, and target name */
  824. new TargetName[ 32 char ];
  825. get_user_name( player, TargetName, charsmax( TargetName ) );
  826. get_user_name( id, gName, charsmax( gName ) );
  827.  
  828. /* --| Setting target points */
  829. gKillerPoints[ player ] = gKillerPoints[ player ] + gift;
  830. client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOW_CMD", gName, gift, TargetName );
  831. }
  832.  
  833. return PLUGIN_HANDLED;
  834. }
  835.  
  836. /* --| Command for reseting points | admin only ;/ */
  837. public cmdResetPoints( id, level, cid )
  838. {
  839. /* --| If user doesn't have acces to command, return */
  840. if( !cmd_access( id, level, cid, 2 ) || !get_pcvar_num( gDrShopOn ) )
  841. {
  842. return PLUGIN_HANDLED;
  843. }
  844.  
  845. /* --| Need to read the first argument */
  846. new argument[ 32 ];
  847. read_argv( 1, argument, charsmax( argument ) );
  848.  
  849. new iPlayer[ 32 ], iNum, all;
  850. get_players( iPlayer, iNum, "c" );
  851.  
  852. /* --| Lets see if argument 1 is @all */
  853. if( equal( argument, "@all" ) )
  854. {
  855. for( new i; i < iNum; i++ )
  856. {
  857. /* --| Find the index :) */
  858. all = iPlayer[ i ];
  859.  
  860. /* --| Set points to all */
  861. gKillerPoints[ all ] = 0;
  862.  
  863. /* --| Show a print in chat */
  864. get_user_name( id, gName, charsmax( gName ) );
  865. client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOWRESET_ALLCMD", gName );
  866. }
  867. }
  868.  
  869. else
  870. {
  871. /* --| Now, we find the target */
  872. new player = cmd_target( id, argument, 10 );
  873.  
  874. /* --| If is not a valid target, return */
  875. if( !player )
  876. {
  877. return PLUGIN_HANDLED;
  878. }
  879.  
  880.  
  881. /* --| Get admin, and target name */
  882. new TargetName[ 32 char ];
  883. get_user_name( player, TargetName, charsmax( TargetName ) );
  884. get_user_name( id, gName, charsmax( gName ) );
  885.  
  886. /* --| Setting target points */
  887. gKillerPoints[ player ] = 0;
  888. client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOWRESET_CMD", gName, TargetName );
  889. }
  890.  
  891. return PLUGIN_HANDLED;
  892. }
  893.  
  894. /* --| We need to find if player has performed a jump, and set some velocity */
  895. public bacon_playerJumping( id )
  896. {
  897. /* --| If plugin is on, and user has jetpack item */
  898. if( get_pcvar_num( gDrShopOn ) != 0 && HasJet[ id ] )
  899. {
  900. /* --| Get user origins from feet */
  901. new iOrigin[ 3 ];
  902. get_user_origin( id, iOrigin, 0 );
  903.  
  904. /* --| Modify origin a bit */
  905. iOrigin[ 2 ] -= 20;
  906.  
  907. /* --| Get player velocity */
  908. new Float:fVelocity[ 3 ];
  909. pev( id, pev_velocity, fVelocity );
  910.  
  911. /* --| Modify velocity a bit */
  912. fVelocity[ 2 ] += 93;
  913.  
  914. /* --| Set the player velocity and add a flame effect, jetpack style */
  915. set_pev( id, pev_velocity, fVelocity );
  916. create_flame( iOrigin );
  917. }
  918. }
  919.  
  920. /* --| We need to check is player has changed his weapon */
  921. public HookCurWeapon( id )
  922. {
  923. /* --| If plugin is on, and user has speed item, let's set the speed again */
  924. if( get_pcvar_num( gDrShopOn ) != 0 && HasSpeed[ id ] )
  925. {
  926. set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
  927. }
  928. }
  929.  
  930. /* --| Command for show points */
  931. public ShowPoints( id )
  932. {
  933. /* --| Set a hud message */
  934. set_hudmessage( 255, 42, 212, 0.03, 0.86, 2, 6.0, 5.0 );
  935.  
  936. /* --| We show player points on hud */
  937. show_hudmessage( id, "[DrShop] %L", id, "DRSHOP_POINTS_INFO", gKillerPoints[ id ] );
  938.  
  939. /* --| We show player points on chat */
  940. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_POINTS_INFO", gKillerPoints[ id ] );
  941.  
  942. return PLUGIN_CONTINUE;
  943. }
  944.  
  945. /* --| Here we show player hud information about this god damn shop */
  946. public ShowPlayerInfo( id )
  947. {
  948. /* --| Set a hud message */
  949. set_hudmessage( 0, 0, 255, -1.0, 0.82, 0, 6.0, 12.0 );
  950.  
  951. /* --| Now we show the info message in hud channel */
  952. show_hudmessage( id, "%L", id, "DRSHOP_HUD_INFO" );
  953. }
  954.  
  955. /* --| If player has suicided by console */
  956. public forward_kill( id )
  957. {
  958. /* --| Check if plugin is on, and user is alive */
  959. if( get_pcvar_num( gDrShopOn ) == 1 && is_user_alive( id ) )
  960. {
  961. /* --| Set player points with suicide cvar */
  962. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_SHOW_LOOSER", get_pcvar_num( gSuiciderPointsCvar ) );
  963. gKillerPoints[ id ] -= get_pcvar_num( gSuiciderPointsCvar );
  964. }
  965. }
  966.  
  967. /* --| Event for round start */
  968. public logevent_round_start()
  969. {
  970. /* --| If plugin is on... */
  971. if( get_pcvar_num( gDrShopOn ) == 1 )
  972. {
  973. /* --| I used this native because with get_maxplayers will recieve a damn error with invalid player id.. */
  974. /* --| This is good because we can skip the damn bots */
  975. new iPlayers[ 32 ], iNum, i, id;
  976. get_players( iPlayers, iNum, "c" );
  977.  
  978. for( i = 0; i < iNum; i++ )
  979. {
  980. /* --| Find the index :) */
  981. id = iPlayers[ i ];
  982.  
  983. /* --| Reseting items */
  984. HasHe[ id ] = false;
  985. HasBothGren[ id ] = false;
  986. HasSilent[ id ] = false;
  987. HasHealth[ id ] = false;
  988. HasArmor[ id] = false;
  989. HasSpeed[ id ] = false;
  990. HasGravity[ id ] = false;
  991. HasInvis[ id ] = false;
  992. HasNoclip[ id ] = false;
  993. HasJet[ id ] = false;
  994. HasDeagle[ id ] = false;
  995. HasLongJump[ id ] = false;
  996. HasGlow[ id ] = false;
  997. HasNVG[ id ] = false;
  998.  
  999. set_user_gravity( id, 1.0 );
  1000. set_user_maxspeed( id, 0.0 );
  1001. set_user_footsteps( id, 0 );
  1002. set_user_noclip( id, 0 );
  1003. set_user_rendering( id );
  1004. set_user_nvg( id, 0 );
  1005. remove_user_nvg( id );
  1006. remove_task( id );
  1007. }
  1008. }
  1009. }
  1010.  
  1011. /* --| Event when player died */
  1012. public Hook_Deathmessage()
  1013. {
  1014. /* --| If plugin is on... */
  1015. if( get_pcvar_num( gDrShopOn ) == 1 )
  1016. {
  1017. /* --| Get the killer and attacker */
  1018. new killer = read_data( 1 );
  1019. new victim = read_data( 2 );
  1020.  
  1021. /* --| If player has died with world / trigger_hurt */
  1022. if( killer == victim )
  1023. {
  1024. return PLUGIN_HANDLED;
  1025. }
  1026.  
  1027. /* --| Setting killer points when killed a enemy */
  1028. gKillerPoints[ killer ] += get_pcvar_num( gKillerPointsCvar );
  1029.  
  1030. /* --| Reseting items */
  1031. HasHe[ victim ] = false;
  1032. HasBothGren[ victim ] = false;
  1033. HasSilent[ victim ] = false;
  1034. HasHealth[ victim ] = false;
  1035. HasArmor[ victim ] = false;
  1036. HasSpeed[ victim ] = false;
  1037. HasGravity[ victim ] = false;
  1038. HasInvis[ victim ] = false;
  1039. HasNoclip[ victim ] = false;
  1040. HasJet[ victim ] = false;
  1041. HasDeagle[ victim ] = false;
  1042. HasLongJump[ victim ] = false;
  1043. HasGlow[ victim ] = false;
  1044. HasNVG[ victim ] = false;
  1045.  
  1046. set_user_gravity( victim, 1.0 );
  1047. set_user_maxspeed( victim, 0.0 );
  1048. set_user_footsteps( victim, 0 );
  1049. set_user_noclip( victim, 0 );
  1050. set_user_rendering( victim );
  1051. set_user_nvg( victim, 0 );
  1052. remove_user_nvg( victim );
  1053. remove_task( victim );
  1054. }
  1055.  
  1056. return PLUGIN_CONTINUE;
  1057. }
  1058.  
  1059. /* --| Now we need to remove the noclip */
  1060. public remove_noclip( id )
  1061. {
  1062. HasNoclip[ id ] = false;
  1063. set_user_noclip( id, 0 );
  1064. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_NOCLIP_OFF", get_pcvar_num( gNoclipTime ) );
  1065. }
  1066.  
  1067. /* --| Now we need to remove the jetpack */
  1068. public remove_jetpack( id )
  1069. {
  1070. HasJet[ id ] = false;
  1071. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_JETPACK_OFF", get_pcvar_num( gJetTime ) );
  1072. }
  1073.  
  1074. /* --| Now we need to remove the longjump */
  1075. public remove_lj( index )
  1076. {
  1077. HasLongJump[ index ] = false;
  1078. engfunc( EngFunc_SetPhysicsKeyValue, index, "slj", "0" );
  1079. client_print( index, print_chat, "[DrShop] %L", index, "DRSHOP_LJ_OFF", get_pcvar_num( gLongJumpTime ) );
  1080. }
  1081.  
  1082. /* --| Usefull stocks on this plugin */
  1083. /* --| Display a message in chat if player already have the item */
  1084. stock allready_have( id )
  1085. {
  1086. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_ALLREADY_HAVE" );
  1087. }
  1088.  
  1089. /* --| Display a message in chat if player don't have enough points */
  1090. stock dont_have( id )
  1091. {
  1092. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_DONTHAVE_POINTS" );
  1093. }
  1094.  
  1095. /* --| Saving player points */
  1096. stock save_client_points( index )
  1097. {
  1098. /* --| Open the vault file */
  1099. gVault = nvault_open( "DeathrunShop_SavedPoints" );
  1100.  
  1101. /* --| If vault return -1, lets stop this shit */
  1102. if( gVault == INVALID_HANDLE )
  1103. {
  1104. set_fail_state( "[DrShop] nValut ERROR: =-> Invalid-Handle" );
  1105. }
  1106.  
  1107. /* --| Get the player steamid */
  1108. get_user_authid( index, gSteamID, charsmax( gSteamID ) );
  1109.  
  1110. /* --| Setting stuff on vault file, and close the file */
  1111. formatex( vKey, charsmax( vKey ), "%sPOINTS", gSteamID );
  1112. formatex( vData, charsmax( vData ), "%d", gKillerPoints[ index ] );
  1113. nvault_set( gVault, vKey, vData );
  1114. nvault_close( gVault );
  1115. }
  1116.  
  1117. /* --| Loading client points */
  1118. stock load_client_points( index )
  1119. {
  1120. /* --| Open the vault file */
  1121. gVault = nvault_open( "DeathrunShop_SavedPoints" );
  1122.  
  1123. /* --| If vault return -1, lets stop this shit */
  1124. if( gVault == INVALID_HANDLE )
  1125. {
  1126. set_fail_state( "[DrShop] nValut ERROR: =-> Invalid-Handle" );
  1127. }
  1128.  
  1129. /* --| Get the player steamid */
  1130. get_user_authid( index, gSteamID, charsmax( gSteamID ) );
  1131.  
  1132. /* --| Get the player points, then, close the nvault vile */
  1133. formatex( vKey, charsmax( vKey ), "%sPOINTS", gSteamID );
  1134. gKillerPoints[ index ] = nvault_get( gVault, vKey );
  1135. nvault_close( gVault );
  1136. }
  1137.  
  1138. /* --| Flame jetpack effect stock */
  1139. stock create_flame( origin[ 3 ] )
  1140. {
  1141. message_begin( MSG_PVS, SVC_TEMPENTITY, origin );
  1142. write_byte( TE_SPRITE );
  1143. write_coord( origin[ 0 ] );
  1144. write_coord( origin[ 1 ] );
  1145. write_coord( origin[ 2 ] );
  1146. write_short( gJetSprite );
  1147. write_byte( 3 );
  1148. write_byte( 99 );
  1149. message_end();
  1150. }
  1151.  
  1152. /* --| Setting temporary longjump stock */
  1153. stock set_temporary_longjump( index )
  1154. {
  1155. /* --| Let's show to player the jetpack item on hud */
  1156. message_begin( MSG_ONE_UNRELIABLE, gMsgItemPickup, _, index );
  1157. write_string( "item_longjump" );
  1158. message_end();
  1159.  
  1160. /* --| Setting the jetpack on */
  1161. engfunc( EngFunc_SetPhysicsKeyValue, index, "slj", "1" );
  1162.  
  1163. /* --| Setting the time before jetpack will go off */
  1164. set_task( float( get_pcvar_num( gLongJumpTime ) ), "remove_lj", index );
  1165. }
  1166.  
  1167. /* --| Stock for setting user nightvision */
  1168. /* --| This stock is more good than cstrike native( give errors ) */
  1169. stock set_user_nvg( index, nvgoggles = 1 )
  1170. {
  1171. if( nvgoggles )
  1172. {
  1173. set_pdata_int( index, m_iNvg, get_pdata_int( index, m_iNvg ) | HAS_NVGS );
  1174. }
  1175.  
  1176. else
  1177. {
  1178. set_pdata_int( index, m_iNvg, get_pdata_int( index, m_iNvg ) & ~HAS_NVGS );
  1179. }
  1180. }
  1181.  
  1182. /* --| Stock for removing turned on nightvision from players. Let's call, force remove nvg :) */
  1183. stock remove_user_nvg( index )
  1184. {
  1185. new iNvgs = get_pdata_int( index, m_iNvg, m_iLinuxDiff );
  1186.  
  1187. if( !iNvgs )
  1188. {
  1189. return;
  1190. }
  1191.  
  1192. if( iNvgs & USES_NVGS )
  1193. {
  1194. emit_sound( index, CHAN_ITEM, SOUND_NVGOFF, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  1195.  
  1196. emessage_begin( MSG_ONE_UNRELIABLE, gMessageNVG, _, index );
  1197. ewrite_byte( 0 );
  1198. emessage_end();
  1199. }
  1200.  
  1201. set_pdata_int( index, m_iNvg, 0, m_iLinuxDiff );
  1202. }
  1203.  
  1204. /* --| Enf of plugin... */