Advertisement
Guest User

here

a guest
Oct 20th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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", "5" );
  131. gHealthCost = register_cvar( "deathrun_health_cost", "30" );
  132. gArmorCost = register_cvar( "deathrun_armor_cost", "15" );
  133. gSpeedCost = register_cvar( "deathrun_speed_cost", "30" );
  134. gGravityCost = register_cvar( "deathrun_gravity_cost", "30" );
  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", "40" );
  149. gSuiciderPointsCvar = register_cvar( "deathrun_suicider_loose_points", "5" );
  150. gSavePlayerPoints = register_cvar( "deathrun_save_points", "1" );
  151. gLongJumpTime = register_cvar( "deathrun_longjump_duration", "6" );
  152. gLongJumpCost = register_cvar( "deathrun_longjump_cost", "30" );
  153. gGlowCost = register_cvar( "deathrun_glow_cost", "10" );
  154. gNvgCost = register_cvar( "deathrun_nvg_cost", "20" );
  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_12", get_pcvar_num( gLongJumpTime ), get_pcvar_num( gLongJumpCost ) );
  317. menu_additem( menu, szText, "9", 0 );
  318.  
  319. /* --| Menu item 10 */
  320. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_13", get_pcvar_num( gGlowCost ) );
  321. menu_additem( menu, szText, "10", 0 );
  322.  
  323. /* --| Menu item 11 */
  324. formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_14", get_pcvar_num( gNvgCost ) );
  325. menu_additem( menu, szText, "11", 0 );
  326.  
  327. menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
  328.  
  329. /* --| Show the menu, with current page 0 */
  330. menu_display( id, menu, 0 );
  331.  
  332. return PLUGIN_CONTINUE;
  333. }
  334.  
  335. /* --| Menu commands */
  336. public shop_handler( id, menu, item )
  337. {
  338. /* --| If key is 0, let's close the menu */
  339. if( item == MENU_EXIT )
  340. {
  341. menu_destroy( menu );
  342. return PLUGIN_HANDLED;
  343. }
  344.  
  345. /* --| Getting the menu information */
  346. new data[ 6 ], iName[ 64 ], access, callback;
  347. menu_item_getinfo( menu, item, access, data, charsmax( data ), iName, charsmax( iName ), callback );
  348.  
  349. /* --| Get menu keys */
  350. new key = str_to_num( data );
  351.  
  352. /* --| Here we find the player points */
  353. new points = gKillerPoints[ id ];
  354.  
  355. switch( key )
  356. {
  357. /* --| Menu item 1 */
  358. case 1:
  359. {
  360. /* --| If already has item, show a damn print and return */
  361. if( HasHe[ id ] )
  362. {
  363. allready_have( id );
  364. return PLUGIN_HANDLED;
  365. }
  366.  
  367. /* --| If player does not have enough points, show a print and return */
  368. if( points < get_pcvar_num( gHeCost ) )
  369. {
  370. dont_have( id );
  371. return PLUGIN_HANDLED;
  372. }
  373.  
  374. /* --| Let's give the item, and do some stuff */
  375. give_item( id, "weapon_hegrenade" );
  376.  
  377. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_GRENADE_ITEM" );
  378. HasHe[ id ] = true;
  379.  
  380. gKillerPoints[ id ] -= get_pcvar_num( gHeCost );
  381. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  382. menu_display( id, menu, 0 );
  383. }
  384.  
  385. /* --| Menu item 2 */
  386. case 2:
  387. {
  388. /* --| If already has item, show a damn print and return */
  389. if( HasBothGren[ id ] )
  390. {
  391. allready_have( id );
  392. return PLUGIN_HANDLED;
  393. }
  394.  
  395. /* --| If player does not have enough points, show a print and return */
  396. if( points < get_pcvar_num( gBothGrenadesCost ) )
  397. {
  398. dont_have( id );
  399. return PLUGIN_HANDLED;
  400. }
  401.  
  402. /* --| Let's give the item, and do some stuff */
  403. give_item( id, "weapon_hegrenade" );
  404. give_item( id, "weapon_flashbang" );
  405. give_item( id, "weapon_flashbang" );
  406.  
  407. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_BOTHGREN_ITEM" );
  408. HasBothGren[ id ] = true;
  409.  
  410. gKillerPoints[ id ] -= get_pcvar_num( gBothGrenadesCost );
  411. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  412. menu_display( id, menu, 0 );
  413. }
  414.  
  415. /* --| Menu item 3 */
  416. case 3:
  417. {
  418. /* --| If already has item, show a damn print and return */
  419. if( HasSilent[ id ] )
  420. {
  421. allready_have( id );
  422. return PLUGIN_HANDLED;
  423. }
  424.  
  425. /* --| If player does not have enough points, show a print and return */
  426. if( points < get_pcvar_num( gSilentCost ) )
  427. {
  428. dont_have( id );
  429. return PLUGIN_HANDLED;
  430. }
  431.  
  432. /* --| Let's give the item, and do some stuff */
  433. set_user_footsteps( id, 1 );
  434.  
  435. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_SILENTWALK_ITEM" );
  436. HasSilent[ id ] = true;
  437.  
  438. gKillerPoints[ id ] -= get_pcvar_num( gSilentCost );
  439. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  440. menu_display( id, menu, 0 );
  441. }
  442.  
  443. /* --| Menu item 4 */
  444. case 4:
  445. {
  446. /* --| If already has item, show a damn print and return */
  447. if( HasHealth[ id ] )
  448. {
  449. allready_have( id );
  450. return PLUGIN_HANDLED;
  451. }
  452.  
  453. /* --| If player does not have enough points, show a print and return */
  454. if( points < get_pcvar_num( gHealthCost ) )
  455. {
  456. dont_have( id );
  457. return PLUGIN_HANDLED;
  458. }
  459.  
  460. /* --| Let's give the item, and do some stuff */
  461. set_user_health( id, get_user_health( id ) + get_pcvar_num( gHealthPointCvar ) );
  462.  
  463. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_HEALTH_ITEM", get_pcvar_num( gHealthPointCvar ) );
  464. HasHealth[ id ] = true;
  465.  
  466. gKillerPoints[ id ] -= get_pcvar_num( gHealthCost );
  467. emit_sound( id, CHAN_ITEM, HEALTH_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  468. menu_display( id, menu, 0 );
  469. }
  470.  
  471. /* --| Menu item 5 */
  472. case 5:
  473. {
  474. /* --| If already has item, show a damn print and return */
  475. if( HasArmor[ id ] )
  476. {
  477. allready_have( id );
  478. return PLUGIN_HANDLED;
  479. }
  480.  
  481. /* --| If player does not have enough points, show a print and return */
  482. if( points < get_pcvar_num( gArmorCost ) )
  483. {
  484. dont_have( id );
  485. return PLUGIN_HANDLED;
  486. }
  487.  
  488. /* --| Let's give the item, and do some stuff */
  489. set_user_armor( id, get_user_armor( id ) + get_pcvar_num( gArmorPointCvar ) );
  490.  
  491. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_ARMOR_ITEM", get_pcvar_num( gArmorPointCvar ) );
  492. HasArmor[ id ] = true;
  493.  
  494. gKillerPoints[ id ] -= get_pcvar_num( gArmorCost );
  495. emit_sound( id, CHAN_ITEM, ARMOR_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  496. menu_display( id, menu, 0 );
  497. }
  498.  
  499. /* --| Menu item 6 */
  500. case 6:
  501. {
  502. /* --| If already has item, show a damn print and return */
  503. if( HasSpeed[ id ] )
  504. {
  505. allready_have( id );
  506. return PLUGIN_HANDLED;
  507. }
  508.  
  509. /* --| If player does not have enough points, show a print and return */
  510. if( points < get_pcvar_num( gSpeedCost ) )
  511. {
  512. dont_have( id );
  513. return PLUGIN_HANDLED;
  514. }
  515.  
  516. /* --| Let's give the item, and do some stuff */
  517. set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
  518.  
  519. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_SPEED_ITEM" );
  520. HasSpeed[ id ] = true;
  521.  
  522. gKillerPoints[ id ] -= get_pcvar_num( gSpeedCost );
  523. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  524. menu_display( id, menu, 0 );
  525. }
  526.  
  527. /* --| Menu item 7 */
  528. case 7:
  529. {
  530. /* --| If already has item, show a damn print and return */
  531. if( HasGravity[ id ] )
  532. {
  533. allready_have( id );
  534. return PLUGIN_HANDLED;
  535. }
  536.  
  537. /* --| If player does not have enough points, show a print and return */
  538. if( points < get_pcvar_num( gGravityCost ) )
  539. {
  540. dont_have( id );
  541. return PLUGIN_HANDLED;
  542. }
  543.  
  544. /* --| Let's give the item, and do some stuff */
  545. set_user_gravity( id, get_pcvar_float( gGravityCvar ) );
  546.  
  547. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_GRAVITY_ITEM" );
  548. HasGravity[ id ] = true;
  549.  
  550. gKillerPoints[ id ] -= get_pcvar_num( gGravityCost );
  551. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  552. menu_display( id, menu, 0 );
  553. }
  554.  
  555. /* --| Menu item 8 */
  556. case 8:
  557. {
  558. /* --| If already has item, show a damn print and return */
  559. if( HasInvis[ id ] )
  560. {
  561. allready_have( id );
  562. return PLUGIN_HANDLED;
  563. }
  564.  
  565. /* --| If player does not have enough points, show a print and return */
  566. if( points < get_pcvar_num( gInvisCost ) )
  567. {
  568. dont_have( id );
  569. return PLUGIN_HANDLED;
  570. }
  571.  
  572. /* --| Let's give the item, and do some stuff */
  573. set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, get_pcvar_num( gInvisPercent ) );
  574.  
  575. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_INVISIBILITY_ITEM" );
  576. HasInvis[ id ] = true;
  577.  
  578. gKillerPoints[ id ] -= get_pcvar_num( gInvisCost );
  579. emit_sound( id, CHAN_ITEM, CLOACK_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  580. menu_display( id, menu, 1 );
  581. }
  582.  
  583. /* --| Menu item 9 */
  584. case 9:
  585. {
  586. /* --| If already has item, show a damn print and return */
  587. if( HasNoclip[ id ] )
  588. {
  589. allready_have( id );
  590. return PLUGIN_HANDLED;
  591. }
  592.  
  593. /* --| If player does not have enough points, show a print and return */
  594. if( points < get_pcvar_num( gNoclipCost ) )
  595. {
  596. dont_have( id );
  597. return PLUGIN_HANDLED;
  598. }
  599.  
  600. /* --| Let's give the item, and do some stuff */
  601. set_task( float( get_pcvar_num( gNoclipTime ) ), "remove_noclip", id );
  602. set_user_noclip( id, 1 );
  603.  
  604. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_NOCLIP_ITEM" );
  605. HasNoclip[ id ] = true;
  606.  
  607. gKillerPoints[ id ] -= get_pcvar_num( gNoclipCost );
  608. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  609. menu_display( id, menu, 1 );
  610. }
  611.  
  612. /* --| Menu item 10 */
  613. case 10:
  614. {
  615. /* --| If already has item, show a damn print and return */
  616. if( HasJet[ id ] )
  617. {
  618. allready_have( id );
  619. return PLUGIN_HANDLED;
  620. }
  621.  
  622. /* --| If player does not have enough points, show a print and return */
  623. if( points < get_pcvar_num( gJetPackCost ) )
  624. {
  625. dont_have( id );
  626. return PLUGIN_HANDLED;
  627. }
  628.  
  629. /* --| Let's give the item, and do some stuff */
  630. set_task( float( get_pcvar_num( gJetTime ) ), "remove_jetpack", id );
  631.  
  632. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_JETPACK_ITEM" );
  633. HasJet[ id ] = true;
  634.  
  635. gKillerPoints[ id ] -= get_pcvar_num( gJetPackCost );
  636. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  637. menu_display( id, menu, 1 );
  638. }
  639.  
  640. /* --| Menu item 11 */
  641. case 11:
  642. {
  643. /* --| If already has item, show a damn print and return */
  644. if( HasDeagle[ id ] || user_has_weapon( id, CSW_DEAGLE ) )
  645. {
  646. allready_have( id );
  647. return PLUGIN_HANDLED;
  648. }
  649.  
  650. /* --| If player does not have enough points, show a print and return */
  651. if( points < get_pcvar_num( gDeagleCost ) )
  652. {
  653. dont_have( id );
  654. return PLUGIN_HANDLED;
  655. }
  656.  
  657. /* --| Let's give the item, and do some stuff */
  658. strip_user_weapons( id );
  659. give_item( id, "weapon_knife" );
  660. give_item( id, "weapon_deagle" );
  661.  
  662. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_DEAGLE_ITEM" );
  663. HasDeagle[ id ] = true;
  664.  
  665. gKillerPoints[ id ] -= get_pcvar_num( gDeagleCost );
  666. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  667. menu_display( id, menu, 1 );
  668. }
  669.  
  670. /* --| Menu item 12 */
  671. case 12:
  672. {
  673. /* --| If already has item, show a damn print and return */
  674. if( HasLongJump[ id ] )
  675. {
  676. allready_have( id );
  677. return PLUGIN_HANDLED;
  678. }
  679.  
  680. /* --| If player does not have enough points, show a print and return */
  681. if( points < get_pcvar_num( gLongJumpCost ) )
  682. {
  683. dont_have( id );
  684. return PLUGIN_HANDLED;
  685. }
  686.  
  687. /* --| Let's give the item, and do some stuff */
  688. /* --| Setting the temporary long jump */
  689. set_temporary_longjump( id );
  690.  
  691. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_LJ_ITEM" );
  692. HasLongJump[ id ] = true;
  693.  
  694. gKillerPoints[ id ] -= get_pcvar_num( gLongJumpCost );
  695. emit_sound( id, CHAN_ITEM, LJ_SOUND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  696. menu_display( id, menu, 1 );
  697. }
  698.  
  699. /* --| Menu item 13 */
  700. case 13:
  701. {
  702. /* --| If already has item, show a damn print and return */
  703. if( HasGlow[ id ] )
  704. {
  705. allready_have( id );
  706. return PLUGIN_HANDLED;
  707. }
  708.  
  709. /* --| If player does not have enough points, show a print and return */
  710. if( points < get_pcvar_num( gGlowCost ) )
  711. {
  712. dont_have( id );
  713. return PLUGIN_HANDLED;
  714. }
  715.  
  716. /* --| Let's give the item, and do some stuff */
  717. set_user_rendering( id, kRenderFxGlowShell, random( 256 ), random( 256 ), random( 256 ), kRenderNormal, random( 256 ) );
  718.  
  719. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_GLOW_ITEM" );
  720. HasGlow[ id ] = true;
  721.  
  722. gKillerPoints[ id ] -= get_pcvar_num( gGlowCost );
  723. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  724. menu_display( id, menu, 1 );
  725. }
  726.  
  727. /* --| Menu item 13 */
  728. case 14:
  729. {
  730. /* --| If already has item, show a damn print and return */
  731. if( HasNVG[ id ] || get_user_nvg( id ) )
  732. {
  733. allready_have( id );
  734. return PLUGIN_HANDLED;
  735. }
  736.  
  737. /* --| If player does not have enough points, show a print and return */
  738. if( points < get_pcvar_num( gNvgCost ) )
  739. {
  740. dont_have( id );
  741. return PLUGIN_HANDLED;
  742. }
  743.  
  744. /* --| Let's give the item, and do some stuff */
  745. set_user_nvg( id, 1 );
  746.  
  747. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_NVG_ITEM" );
  748. HasNVG[ id ] = true;
  749.  
  750. gKillerPoints[ id ] -= get_pcvar_num( gNvgCost );
  751. emit_sound( id, CHAN_ITEM, PICKUP_SND, VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
  752. menu_display( id, menu, 1 );
  753. }
  754. }
  755.  
  756. return PLUGIN_HANDLED;
  757. }
  758.  
  759. /* --| Command for setting points | admin only ;/ */
  760. public cmdSetPoints( id, level, cid )
  761. {
  762. /* --| If user doesn't have acces to command, return */
  763. if( !cmd_access( id, level, cid, 2 ) || !get_pcvar_num( gDrShopOn ) )
  764. {
  765. return PLUGIN_HANDLED;
  766. }
  767.  
  768. /* --| Need to read the first argument */
  769. new argument[ 32 ];
  770. read_argv( 1, argument, charsmax( argument ) );
  771.  
  772. /* --| Need to read second argument */
  773. new give_points[ 5 ];
  774. read_argv( 2, give_points, charsmax( give_points ) );
  775.  
  776. /* --| We are getting the gift from second argument */
  777. new gift = str_to_num( give_points );
  778.  
  779. new iPlayer[ 32 ], iNum, all;
  780. get_players( iPlayer, iNum, "c" );
  781.  
  782. /* --| Lets see if argument 1 is @all */
  783. if( equal( argument, "@all" ) )
  784. {
  785. for( new i; i < iNum; i++ )
  786. {
  787. /* --| Find the index :) */
  788. all = iPlayer[ i ];
  789.  
  790. /* --| Set points to all */
  791. gKillerPoints[ all ] = gKillerPoints[ all ] + gift;
  792.  
  793. /* --| Show a print in chat */
  794. get_user_name( id, gName, charsmax( gName ) );
  795. client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOW_ALLCMD", gName, gift );
  796. }
  797. }
  798.  
  799. else
  800. {
  801. /* --| Now, we find the target */
  802. new player = cmd_target( id, argument, 10 );
  803.  
  804. /* --| If is not a valid target, return */
  805. if( !player )
  806. {
  807. return PLUGIN_HANDLED;
  808. }
  809.  
  810.  
  811. /* --| Get admin, and target name */
  812. new TargetName[ 32 char ];
  813. get_user_name( player, TargetName, charsmax( TargetName ) );
  814. get_user_name( id, gName, charsmax( gName ) );
  815.  
  816. /* --| Setting target points */
  817. gKillerPoints[ player ] = gKillerPoints[ player ] + gift;
  818. client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOW_CMD", gName, gift, TargetName );
  819. }
  820.  
  821. return PLUGIN_HANDLED;
  822. }
  823.  
  824. /* --| Command for reseting points | admin only ;/ */
  825. public cmdResetPoints( id, level, cid )
  826. {
  827. /* --| If user doesn't have acces to command, return */
  828. if( !cmd_access( id, level, cid, 2 ) || !get_pcvar_num( gDrShopOn ) )
  829. {
  830. return PLUGIN_HANDLED;
  831. }
  832.  
  833. /* --| Need to read the first argument */
  834. new argument[ 32 ];
  835. read_argv( 1, argument, charsmax( argument ) );
  836.  
  837. new iPlayer[ 32 ], iNum, all;
  838. get_players( iPlayer, iNum, "c" );
  839.  
  840. /* --| Lets see if argument 1 is @all */
  841. if( equal( argument, "@all" ) )
  842. {
  843. for( new i; i < iNum; i++ )
  844. {
  845. /* --| Find the index :) */
  846. all = iPlayer[ i ];
  847.  
  848. /* --| Set points to all */
  849. gKillerPoints[ all ] = 0;
  850.  
  851. /* --| Show a print in chat */
  852. get_user_name( id, gName, charsmax( gName ) );
  853. client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOWRESET_ALLCMD", gName );
  854. }
  855. }
  856.  
  857. else
  858. {
  859. /* --| Now, we find the target */
  860. new player = cmd_target( id, argument, 10 );
  861.  
  862. /* --| If is not a valid target, return */
  863. if( !player )
  864. {
  865. return PLUGIN_HANDLED;
  866. }
  867.  
  868.  
  869. /* --| Get admin, and target name */
  870. new TargetName[ 32 char ];
  871. get_user_name( player, TargetName, charsmax( TargetName ) );
  872. get_user_name( id, gName, charsmax( gName ) );
  873.  
  874. /* --| Setting target points */
  875. gKillerPoints[ player ] = 0;
  876. client_print( 0, print_chat, "[DrShop] %L", LANG_PLAYER, "DRSHOP_SHOWRESET_CMD", gName, TargetName );
  877. }
  878.  
  879. return PLUGIN_HANDLED;
  880. }
  881.  
  882. /* --| We need to find if player has performed a jump, and set some velocity */
  883. public bacon_playerJumping( id )
  884. {
  885. /* --| If plugin is on, and user has jetpack item */
  886. if( get_pcvar_num( gDrShopOn ) != 0 && HasJet[ id ] )
  887. {
  888. /* --| Get user origins from feet */
  889. new iOrigin[ 3 ];
  890. get_user_origin( id, iOrigin, 0 );
  891.  
  892. /* --| Modify origin a bit */
  893. iOrigin[ 2 ] -= 20;
  894.  
  895. /* --| Get player velocity */
  896. new Float:fVelocity[ 3 ];
  897. pev( id, pev_velocity, fVelocity );
  898.  
  899. /* --| Modify velocity a bit */
  900. fVelocity[ 2 ] += 93;
  901.  
  902. /* --| Set the player velocity and add a flame effect, jetpack style */
  903. set_pev( id, pev_velocity, fVelocity );
  904. create_flame( iOrigin );
  905. }
  906. }
  907.  
  908. /* --| We need to check is player has changed his weapon */
  909. public HookCurWeapon( id )
  910. {
  911. /* --| If plugin is on, and user has speed item, let's set the speed again */
  912. if( get_pcvar_num( gDrShopOn ) != 0 && HasSpeed[ id ] )
  913. {
  914. set_user_maxspeed( id, get_pcvar_float( gSpeedCvar ) );
  915. }
  916. }
  917.  
  918. /* --| Command for show points */
  919. public ShowPoints( id )
  920. {
  921. /* --| Set a hud message */
  922. set_hudmessage( 255, 42, 212, 0.03, 0.86, 2, 6.0, 5.0 );
  923.  
  924. /* --| We show player points on hud */
  925. show_hudmessage( id, "[DrShop] %L", id, "DRSHOP_POINTS_INFO", gKillerPoints[ id ] );
  926.  
  927. /* --| We show player points on chat */
  928. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_POINTS_INFO", gKillerPoints[ id ] );
  929.  
  930. return PLUGIN_CONTINUE;
  931. }
  932.  
  933. /* --| Here we show player hud information about this god damn shop */
  934. public ShowPlayerInfo( id )
  935. {
  936. /* --| Set a hud message */
  937. set_hudmessage( 0, 0, 255, -1.0, 0.82, 0, 6.0, 12.0 );
  938.  
  939. /* --| Now we show the info message in hud channel */
  940. show_hudmessage( id, "%L", id, "DRSHOP_HUD_INFO" );
  941. }
  942.  
  943. /* --| If player has suicided by console */
  944. public forward_kill( id )
  945. {
  946. /* --| Check if plugin is on, and user is alive */
  947. if( get_pcvar_num( gDrShopOn ) == 1 && is_user_alive( id ) )
  948. {
  949. /* --| Set player points with suicide cvar */
  950. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_SHOW_LOOSER", get_pcvar_num( gSuiciderPointsCvar ) );
  951. gKillerPoints[ id ] -= get_pcvar_num( gSuiciderPointsCvar );
  952. }
  953. }
  954.  
  955. /* --| Event for round start */
  956. public logevent_round_start()
  957. {
  958. /* --| If plugin is on... */
  959. if( get_pcvar_num( gDrShopOn ) == 1 )
  960. {
  961. /* --| I used this native because with get_maxplayers will recieve a damn error with invalid player id.. */
  962. /* --| This is good because we can skip the damn bots */
  963. new iPlayers[ 32 ], iNum, i, id;
  964. get_players( iPlayers, iNum, "c" );
  965.  
  966. for( i = 0; i < iNum; i++ )
  967. {
  968. /* --| Find the index :) */
  969. id = iPlayers[ i ];
  970.  
  971. /* --| Reseting items */
  972. HasHe[ id ] = false;
  973. HasBothGren[ id ] = false;
  974. HasSilent[ id ] = false;
  975. HasHealth[ id ] = false;
  976. HasArmor[ id] = false;
  977. HasSpeed[ id ] = false;
  978. HasGravity[ id ] = false;
  979. HasInvis[ id ] = false;
  980. HasNoclip[ id ] = false;
  981. HasJet[ id ] = false;
  982. HasDeagle[ id ] = false;
  983. HasLongJump[ id ] = false;
  984. HasGlow[ id ] = false;
  985. HasNVG[ id ] = false;
  986.  
  987. set_user_gravity( id, 1.0 );
  988. set_user_maxspeed( id, 0.0 );
  989. set_user_footsteps( id, 0 );
  990. set_user_noclip( id, 0 );
  991. set_user_rendering( id );
  992. set_user_nvg( id, 0 );
  993. remove_user_nvg( id );
  994. remove_task( id );
  995. }
  996. }
  997. }
  998.  
  999. /* --| Event when player died */
  1000. public Hook_Deathmessage()
  1001. {
  1002. /* --| If plugin is on... */
  1003. if( get_pcvar_num( gDrShopOn ) == 1 )
  1004. {
  1005. /* --| Get the killer and attacker */
  1006. new killer = read_data( 1 );
  1007. new victim = read_data( 2 );
  1008.  
  1009. /* --| If player has died with world / trigger_hurt */
  1010. if( killer == victim )
  1011. {
  1012. return PLUGIN_HANDLED;
  1013. }
  1014.  
  1015. /* --| Setting killer points when killed a enemy */
  1016. gKillerPoints[ killer ] += get_pcvar_num( gKillerPointsCvar );
  1017.  
  1018. /* --| Reseting items */
  1019. HasHe[ victim ] = false;
  1020. HasBothGren[ victim ] = false;
  1021. HasSilent[ victim ] = false;
  1022. HasHealth[ victim ] = false;
  1023. HasArmor[ victim ] = false;
  1024. HasSpeed[ victim ] = false;
  1025. HasGravity[ victim ] = false;
  1026. HasInvis[ victim ] = false;
  1027. HasNoclip[ victim ] = false;
  1028. HasJet[ victim ] = false;
  1029. HasDeagle[ victim ] = false;
  1030. HasLongJump[ victim ] = false;
  1031. HasGlow[ victim ] = false;
  1032. HasNVG[ victim ] = false;
  1033.  
  1034. set_user_gravity( victim, 1.0 );
  1035. set_user_maxspeed( victim, 0.0 );
  1036. set_user_footsteps( victim, 0 );
  1037. set_user_noclip( victim, 0 );
  1038. set_user_rendering( victim );
  1039. set_user_nvg( victim, 0 );
  1040. remove_user_nvg( victim );
  1041. remove_task( victim );
  1042. }
  1043.  
  1044. return PLUGIN_CONTINUE;
  1045. }
  1046.  
  1047. /* --| Now we need to remove the noclip */
  1048. public remove_noclip( id )
  1049. {
  1050. HasNoclip[ id ] = false;
  1051. set_user_noclip( id, 0 );
  1052. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_NOCLIP_OFF", get_pcvar_num( gNoclipTime ) );
  1053. }
  1054.  
  1055. /* --| Now we need to remove the jetpack */
  1056. public remove_jetpack( id )
  1057. {
  1058. HasJet[ id ] = false;
  1059. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_JETPACK_OFF", get_pcvar_num( gJetTime ) );
  1060. }
  1061.  
  1062. /* --| Now we need to remove the longjump */
  1063. public remove_lj( index )
  1064. {
  1065. HasLongJump[ index ] = false;
  1066. engfunc( EngFunc_SetPhysicsKeyValue, index, "slj", "0" );
  1067. client_print( index, print_chat, "[DrShop] %L", index, "DRSHOP_LJ_OFF", get_pcvar_num( gLongJumpTime ) );
  1068. }
  1069.  
  1070. /* --| Usefull stocks on this plugin */
  1071. /* --| Display a message in chat if player already have the item */
  1072. stock allready_have( id )
  1073. {
  1074. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_ALLREADY_HAVE" );
  1075. }
  1076.  
  1077. /* --| Display a message in chat if player don't have enough points */
  1078. stock dont_have( id )
  1079. {
  1080. client_print( id, print_chat, "[DrShop] %L", id, "DRSHOP_DONTHAVE_POINTS" );
  1081. }
  1082.  
  1083. /* --| Saving player points */
  1084. stock save_client_points( index )
  1085. {
  1086. /* --| Open the vault file */
  1087. gVault = nvault_open( "DeathrunShop_SavedPoints" );
  1088.  
  1089. /* --| If vault return -1, lets stop this shit */
  1090. if( gVault == INVALID_HANDLE )
  1091. {
  1092. set_fail_state( "[DrShop] nValut ERROR: =-> Invalid-Handle" );
  1093. }
  1094.  
  1095. /* --| Get the player steamid */
  1096. get_user_authid( index, gSteamID, charsmax( gSteamID ) );
  1097.  
  1098. /* --| Setting stuff on vault file, and close the file */
  1099. formatex( vKey, charsmax( vKey ), "%sPOINTS", gSteamID );
  1100. formatex( vData, charsmax( vData ), "%d", gKillerPoints[ index ] );
  1101. nvault_set( gVault, vKey, vData );
  1102. nvault_close( gVault );
  1103. }
  1104.  
  1105. /* --| Loading client points */
  1106. stock load_client_points( index )
  1107. {
  1108. /* --| Open the vault file */
  1109. gVault = nvault_open( "DeathrunShop_SavedPoints" );
  1110.  
  1111. /* --| If vault return -1, lets stop this shit */
  1112. if( gVault == INVALID_HANDLE )
  1113. {
  1114. set_fail_state( "[DrShop] nValut ERROR: =-> Invalid-Handle" );
  1115. }
  1116.  
  1117. /* --| Get the player steamid */
  1118. get_user_authid( index, gSteamID, charsmax( gSteamID ) );
  1119.  
  1120. /* --| Get the player points, then, close the nvault vile */
  1121. formatex( vKey, charsmax( vKey ), "%sPOINTS", gSteamID );
  1122. gKillerPoints[ index ] = nvault_get( gVault, vKey );
  1123. nvault_close( gVault );
  1124. }
  1125.  
  1126. /* --| Flame jetpack effect stock */
  1127. stock create_flame( origin[ 3 ] )
  1128. {
  1129. message_begin( MSG_PVS, SVC_TEMPENTITY, origin );
  1130. write_byte( TE_SPRITE );
  1131. write_coord( origin[ 0 ] );
  1132. write_coord( origin[ 1 ] );
  1133. write_coord( origin[ 2 ] );
  1134. write_short( gJetSprite );
  1135. write_byte( 3 );
  1136. write_byte( 99 );
  1137. message_end();
  1138. }
  1139.  
  1140. /* --| Setting temporary longjump stock */
  1141. stock set_temporary_longjump( index )
  1142. {
  1143. /* --| Let's show to player the jetpack item on hud */
  1144. message_begin( MSG_ONE_UNRELIABLE, gMsgItemPickup, _, index );
  1145. write_string( "item_longjump" );
  1146. message_end();
  1147.  
  1148. /* --| Setting the jetpack on */
  1149. engfunc( EngFunc_SetPhysicsKeyValue, index, "slj", "1" );
  1150.  
  1151. /* --| Setting the time before jetpack will go off */
  1152. set_task( float( get_pcvar_num( gLongJumpTime ) ), "remove_lj", index );
  1153. }
  1154.  
  1155. /* --| Stock for setting user nightvision */
  1156. /* --| This stock is more good than cstrike native( give errors ) */
  1157. stock set_user_nvg( index, nvgoggles = 1 )
  1158. {
  1159. if( nvgoggles )
  1160. {
  1161. set_pdata_int( index, m_iNvg, get_pdata_int( index, m_iNvg ) | HAS_NVGS );
  1162. }
  1163.  
  1164. else
  1165. {
  1166. set_pdata_int( index, m_iNvg, get_pdata_int( index, m_iNvg ) & ~HAS_NVGS );
  1167. }
  1168. }
  1169.  
  1170. /* --| Stock for removing turned on nightvision from players. Let's call, force remove nvg :) */
  1171. stock remove_user_nvg( index )
  1172. {
  1173. new iNvgs = get_pdata_int( index, m_iNvg, m_iLinuxDiff );
  1174.  
  1175. if( !iNvgs )
  1176. {
  1177. return;
  1178. }
  1179.  
  1180. if( iNvgs & USES_NVGS )
  1181. {
  1182. emit_sound( index, CHAN_ITEM, SOUND_NVGOFF, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  1183.  
  1184. emessage_begin( MSG_ONE_UNRELIABLE, gMessageNVG, _, index );
  1185. ewrite_byte( 0 );
  1186. emessage_end();
  1187. }
  1188.  
  1189. set_pdata_int( index, m_iNvg, 0, m_iLinuxDiff );
  1190. }
  1191.  
  1192. /* --| Enf of plugin... */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement