Advertisement
Guest User

Untitled

a guest
Jan 17th, 2021
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.96 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4. #include <engine>
  5. #include <fun>
  6. #include <hamsandwich>
  7. #include <nvault>
  8.  
  9. #define PLUGIN "Knife Shop"
  10. #define VERSION "3.0"
  11. #define AUTHOR "Dr.Small a.k.a DukMeN"
  12.  
  13. #define iPrefix "[Knife Shop]"
  14.  
  15. enum Color
  16. {
  17. NORMAL = 1,
  18. GREEN,
  19. TEAM_COLOR,
  20. GREY,
  21. RED,
  22. BLUE,
  23. }
  24.  
  25. new TeamName[][] =
  26. {
  27. "",
  28. "TERRORIST",
  29. "CT",
  30. "SPECTATOR"
  31. }
  32.  
  33. // Pcvars
  34. new hecost;
  35. new flashcost;
  36. new gravitycost;
  37. new healthcost;
  38. new armorcost;
  39. new speedcost;
  40. new godmodecost;
  41. new silentcost;
  42. new awpcost;
  43. new deaglecost;
  44. new noclipcost;
  45. new camocost;
  46.  
  47. new time_gravity;
  48. new time_speed;
  49. new time_godmode;
  50. new time_silent;
  51. new time_noclip;
  52. new time_camo;
  53.  
  54. new health_ammount;
  55. new armor_ammount;
  56.  
  57. new awp_ammo;
  58. new deagle_ammo;
  59.  
  60. new hud_color;
  61.  
  62. new HasHe[33];
  63. new HasFlash[33];
  64. new HasGravity[33];
  65. new HasHealth[33];
  66. new HasArmor[33];
  67. new HasSpeed[33];
  68. new HasGodmode[33];
  69. new HasSilent[33];
  70. new HasAwp[33];
  71. new HasDeagle[33];
  72. new HasNoclip[33];
  73. new HasCamo[33];
  74.  
  75. new iSpeed[33];
  76.  
  77. new iCamoOldModel[33][32];
  78. new const PlayerModels[ ][ ] =
  79. {
  80. "arctic",
  81. "leet",
  82. "guerilla",
  83. "terror",
  84. "gign",
  85. "urban",
  86. "sas",
  87. "gsg9"
  88. }
  89.  
  90. new iPlayerPoints[ 33 ];
  91. new vault, sync;
  92.  
  93. public plugin_init()
  94. {
  95. register_plugin(PLUGIN, VERSION, AUTHOR);
  96.  
  97. register_event( "CurWeapon", "EventCurWeapon", "be", "1=1" );
  98. register_event( "DeathMsg", "EventDeath", "a" );
  99. register_logevent( "logevRoundStart", 2, "1=Round_Start" );
  100.  
  101. register_concmd( "knifeshop_give_points", "GivePoints", ADMIN_RCON, "<name, #userid, authid> <points>" );
  102. register_concmd( "knifeshop_remove_points", "RemovePoints", ADMIN_RCON, "<name, #userid, authid> <points>" );
  103.  
  104. hecost = register_cvar("knifeshop_he_cost", "2");
  105. flashcost = register_cvar("knifeshop_flash_cost", "1");
  106. gravitycost = register_cvar("knifeshop_gravity_cost", "3");
  107. healthcost = register_cvar("knifeshop_health_cost", "6");
  108. armorcost = register_cvar("knifeshop_armor_cost", "4");
  109. speedcost = register_cvar("knifeshop_speed_cost", "4");
  110. godmodecost = register_cvar("knifeshop_godmode_cost", "7");
  111. silentcost = register_cvar("knifeshop_silent_cost", "3");
  112. awpcost = register_cvar("knifeshop_awp_cost", "8");
  113. deaglecost = register_cvar("knifeshop_deagle_cost", "7");
  114. noclipcost = register_cvar("knifeshop_noclip_cost", "13");
  115. camocost = register_cvar("knifeshop_camo_cost", "5");
  116.  
  117. time_gravity = register_cvar("knifeshop_gravity_time", "10");
  118. time_speed = register_cvar("knifeshop_speed_time", "20");
  119. time_godmode = register_cvar("knifeshop_godmode_time", "12");
  120. time_silent = register_cvar("knifeshop_silent_time", "30");
  121. time_noclip = register_cvar("knifeshop_noclip_time", "7");
  122. time_camo = register_cvar("knifeshop_camo_time", "15");
  123.  
  124. health_ammount = register_cvar("knifeshop_ammount_hp", "120");
  125. armor_ammount = register_cvar("knifeshop_ammount_armor", "60");
  126.  
  127. awp_ammo = register_cvar("knifeshop_awp_ammo", "1");
  128. deagle_ammo = register_cvar("knifeshop_deagle_ammo", "2");
  129.  
  130. hud_color = register_cvar("knifeshop_hud_color", "255 255 0" );
  131.  
  132. register_clcmd("say /knifeshop", "MainMenu");
  133. register_clcmd("say /shop", "MainMenu");
  134. register_clcmd("say knifeshop", "MainMenu");
  135. register_clcmd("say shop", "MainMenu");
  136.  
  137. vault = nvault_open( "KnifeShop_v[2.9]" );
  138. sync = CreateHudSyncObj( );
  139.  
  140. new ent = create_entity( "info_target" );
  141. entity_set_string( ent, EV_SZ_classname, "task_entity" );
  142.  
  143. register_think( "task_entity", "CmdShowPoints" );
  144. entity_set_float( ent, EV_FL_nextthink, get_gametime( ) + 1.0 );
  145.  
  146. set_task(400.0, "Advert", _,_,_, "b");
  147. }
  148.  
  149. public GivePoints( id, level, cid )
  150. {
  151. if( !cmd_access( id, level, cid, 3) ) return PLUGIN_HANDLED;
  152.  
  153. new arg[35];
  154. read_argv(1, arg, sizeof(arg) - 1);
  155.  
  156. new target = cmd_target( id, arg, CMDTARGET_NO_BOTS );
  157. if( !target ) return PLUGIN_HANDLED;
  158.  
  159. read_argv(2, arg, sizeof(arg) - 1);
  160. new points = str_to_num(arg);
  161.  
  162. if( points <= 0 ) return PLUGIN_HANDLED;
  163.  
  164. iPlayerPoints[ target ] += points;
  165. SavePoints( target );
  166.  
  167. new name1[ 33 ], name2[ 33 ]
  168. get_user_name( id, name1, charsmax( name1 ) );
  169. get_user_name( target, name2, charsmax( name2 ) );
  170.  
  171. ColorChat( 0, GREEN, "%s^1 ADMIN:^3 %s^1 give^4 %d^1 point%s to^3 %s.", iPrefix, name1, points, points > 1 ? "s" : "", name2 );
  172.  
  173. return PLUGIN_HANDLED;
  174. }
  175.  
  176. public RemovePoints( id, level, cid )
  177. {
  178. if( !cmd_access( id, level, cid, 3) ) return PLUGIN_HANDLED;
  179.  
  180. new arg[35];
  181. read_argv(1, arg, sizeof(arg) - 1);
  182.  
  183. new target = cmd_target( id, arg, CMDTARGET_NO_BOTS );
  184. if( !target ) return PLUGIN_HANDLED;
  185.  
  186. read_argv(2, arg, sizeof(arg) - 1);
  187. new points = str_to_num(arg);
  188.  
  189. if( points <= 0 ) return PLUGIN_HANDLED;
  190.  
  191. iPlayerPoints[ target ] -= points;
  192. SavePoints( target );
  193.  
  194. new name1[ 33 ], name2[ 33 ]
  195. get_user_name( id, name1, charsmax( name1 ) );
  196. get_user_name( target, name2, charsmax( name2 ) );
  197.  
  198. ColorChat( 0, GREEN, "%s^1 ADMIN:^3 %s^1 removed^4 %d^1 point%s from^3 %s.", iPrefix, name1, points, points > 1 ? "s" : "", name2 );
  199.  
  200. return PLUGIN_HANDLED;
  201. }
  202.  
  203. public EventDeath( )
  204. {
  205. new killer = read_data( 1 );
  206. new victim = read_data( 2 );
  207.  
  208. if( is_user_connected( killer ) && victim != killer )
  209. {
  210. if( read_data( 3 ) )
  211. {
  212. iPlayerPoints[ killer ] += 2;
  213. }
  214. else
  215. {
  216. iPlayerPoints[ killer ]++;
  217. }
  218.  
  219. SavePoints( killer );
  220. }
  221. }
  222.  
  223. public CmdShowPoints( ent )
  224. {
  225. new iPlayers[ 32 ], iNum, id;
  226. get_players( iPlayers, iNum, "ch" );
  227.  
  228. for( new i; i < iNum; i++ )
  229. {
  230. id = iPlayers[ i ];
  231.  
  232. if( is_user_alive( id ) )
  233. {
  234. static szRed, szGreen, szBlue;
  235. HudColors( szRed, szGreen, szBlue );
  236.  
  237. set_hudmessage( szRed, szGreen, szBlue, 0.01, 0.91, 0, 0.9, 0.9 );
  238. ShowSyncHudMsg( id, sync, "Health: %d | Armor: %d | Point%s: %d", get_user_health( id ), get_user_armor( id ), iPlayerPoints[ id ] == 1 ? "" : "s", iPlayerPoints[ id ] );
  239. }
  240. }
  241.  
  242. entity_set_float( ent, EV_FL_nextthink, get_gametime( ) + 0.1 );
  243. }
  244.  
  245. public logevRoundStart( )
  246. {
  247. new iPlayers[ 32 ], iNum, id;
  248. get_players( iPlayers, iNum, "ch" );
  249.  
  250. for( new i; i < iNum; i++ )
  251. {
  252. id = iPlayers[ i ];
  253.  
  254. if( !is_user_alive( id ) ) return PLUGIN_CONTINUE;
  255.  
  256. set_user_footsteps( id, 0 );
  257. set_user_gravity( id, 1.0 );
  258. set_user_godmode( id, 0 );
  259. set_user_noclip( id, 0);
  260. remove_task( id );
  261.  
  262. HasHe[id] = false;
  263. HasFlash[id] = false;
  264. HasGravity[id] = false;
  265. HasHealth[id] = false;
  266. HasArmor[id] = false;
  267. HasSpeed[id] = false;
  268. HasGodmode[id] = false;
  269. HasSilent[id] = false;
  270. HasAwp[id] = false;
  271. HasDeagle[id] = false;
  272. HasNoclip[id] = false;
  273. HasCamo[id] = false;
  274. iSpeed[id] = false;
  275. }
  276.  
  277. return PLUGIN_CONTINUE;
  278. }
  279.  
  280. public client_authorized( id )
  281. {
  282. LoadPoints( id );
  283. }
  284.  
  285. public client_disconnect( id )
  286. {
  287. SavePoints( id );
  288. }
  289.  
  290. public MainMenu(id)
  291. {
  292. if( !is_user_alive( id ) )
  293. {
  294. ColorChat( id, GREEN, "%s^1 Need to be^3 alive to^4 use the^1 shop!", iPrefix );
  295. return PLUGIN_HANDLED;
  296. }
  297.  
  298. new szShop[64], szHe[33], szFlash[33], szGravity[33], szHealth[33], szArmor[33], szSpeed[33], szGodmode[33], szSilent[33], szAwp[33], szDeagle[33], szNoclip[33], szCamo[33];
  299.  
  300. formatex(szShop, charsmax(szShop), "\y%s \wv\r%s \wPage\r", PLUGIN, VERSION);
  301. formatex(szHe, charsmax(szHe), "\wHE Grenade - \y%d Point%s", get_pcvar_num(hecost), get_pcvar_num(hecost) == 1 ? "" : "s" );
  302. formatex(szFlash, charsmax(szFlash), "\wFlashbang - \y%d Point%s", get_pcvar_num(flashcost), get_pcvar_num(flashcost) == 1 ? "" : "s" );
  303. formatex(szGravity, charsmax(szGravity), "\wGravity - \y%d Point%s", get_pcvar_num(gravitycost), get_pcvar_num(gravitycost) == 1 ? "" : "s" );
  304. formatex(szHealth, charsmax(szHealth), "\w%d Health - \y%d Point%s", get_pcvar_num(health_ammount), get_pcvar_num(healthcost), get_pcvar_num(healthcost) == 1 ? "" : "s" );
  305. formatex(szArmor, charsmax(szArmor), "\w%d Armor - \y%d Point%s", get_pcvar_num(armor_ammount), get_pcvar_num(armorcost), get_pcvar_num(armorcost) == 1 ? "" : "s" );
  306. formatex(szSpeed, charsmax(szSpeed), "\wMore Speed - \y%d Point%s", get_pcvar_num(speedcost), get_pcvar_num(speedcost) == 1 ? "" : "s" );
  307. formatex(szGodmode, charsmax(szGodmode), "\wGodmode - \y%d Point%s", get_pcvar_num(godmodecost), get_pcvar_num(godmodecost) == 1 ? "" : "s" );
  308. formatex(szSilent, charsmax(szSilent), "\wSilent Walk - \y%d Point%s", get_pcvar_num(silentcost), get_pcvar_num(silentcost) == 1 ? "" : "s" );
  309. formatex(szAwp, charsmax(szAwp), "\wAWP - \y%d Point%s", get_pcvar_num(awpcost), get_pcvar_num(awpcost) == 1 ? "" : "s" );
  310. formatex(szDeagle, charsmax(szDeagle), "\wDeagle - \y%d Point%s", get_pcvar_num(deaglecost), get_pcvar_num(deaglecost) == 1 ? "" : "s" );
  311. formatex(szNoclip, charsmax(szNoclip), "\wNoclip - \y%d Point%s", get_pcvar_num(noclipcost), get_pcvar_num(noclipcost) == 1 ? "" : "s" );
  312. formatex(szCamo, charsmax(szCamo), "\wCamouflage - \y%d Point%s", get_pcvar_num(camocost), get_pcvar_num(camocost) == 1 ? "" : "s" );
  313.  
  314. new shop = menu_create(szShop, "knife_shop_handler");
  315. menu_additem(shop, szHe, "1", 0);
  316. menu_additem(shop, szFlash, "2", 0);
  317. menu_additem(shop, szGravity, "3", 0);
  318. menu_additem(shop, szHealth, "4", 0);
  319. menu_additem(shop, szArmor, "5", 0);
  320. menu_additem(shop, szSpeed, "6", 0);
  321. menu_additem(shop, szGodmode, "7", 0);
  322. menu_additem(shop, szSilent, "8", 0);
  323. menu_additem(shop, szAwp, "9", 0);
  324. menu_additem(shop, szDeagle, "10", 0);
  325. menu_additem(shop, szNoclip, "11", 0);
  326. menu_additem(shop, szCamo, "12", 0);
  327.  
  328. menu_setprop(shop, MPROP_EXIT, MEXIT_ALL);
  329. menu_display(id, shop, 0);
  330.  
  331. return PLUGIN_HANDLED;
  332. }
  333.  
  334. public knife_shop_handler(id, shop, item)
  335. {
  336. if(item == MENU_EXIT)
  337. {
  338. menu_destroy(shop);
  339. return PLUGIN_HANDLED;
  340. }
  341.  
  342. new data[6], iName[64], szName[33], iaccess, callback;
  343. menu_item_getinfo(shop, item, iaccess, data, 6, iName, 63, callback);
  344.  
  345. get_user_name(id, szName, charsmax( szName ));
  346.  
  347. switch(str_to_num(data))
  348. {
  349. case 1: // HE Grenade
  350. {
  351. if( iPlayerPoints[ id ] >= get_pcvar_num( hecost ) )
  352. {
  353. if( user_has_weapon( id, CSW_HEGRENADE ) ) return PLUGIN_HANDLED;
  354.  
  355. give_item( id, "weapon_hegrenade" );
  356. iPlayerPoints[ id ] -= get_pcvar_num( hecost );
  357. HasHe[ id ] = true;
  358.  
  359. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 has bought^x03 HE Grenade^x01.", iPrefix, szName);
  360. }
  361. else NoPoints( id );
  362. }
  363. case 2: // Flashbang
  364. {
  365. if( iPlayerPoints[ id ] >= get_pcvar_num( flashcost ) )
  366. {
  367. give_item( id, "weapon_flashbang" );
  368. iPlayerPoints[ id ] -= get_pcvar_num( flashcost );
  369. HasFlash[ id ] = true;
  370.  
  371. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 has bought^x03 Flashbang^x01.", iPrefix, szName);
  372. }
  373. else NoPoints( id );
  374. }
  375. case 3: // Gravity
  376. {
  377. if( iPlayerPoints[ id ] >= get_pcvar_num( gravitycost ) )
  378. {
  379. set_user_gravity(id, 0.40)
  380. set_task(get_pcvar_float(time_gravity), "remove_gravity", id)
  381.  
  382. iPlayerPoints[ id ] -= get_pcvar_num( gravitycost );
  383. HasGravity[ id ] = true;
  384.  
  385. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 bought^x03 Gravity^x01 from^x04 %d^x01 sek.", iPrefix, szName, get_pcvar_num(time_gravity));
  386. }
  387. else NoPoints( id );
  388. }
  389. case 4: // Health
  390. {
  391. if( iPlayerPoints[ id ] >= get_pcvar_num( healthcost ) )
  392. {
  393. set_user_health( id, get_user_health( id ) + get_pcvar_num(health_ammount) );
  394.  
  395. iPlayerPoints[ id ] -= get_pcvar_num( healthcost );
  396. HasHealth[ id ] = true;
  397. }
  398. else NoPoints( id );
  399. }
  400. case 5: // Armor
  401. {
  402. if( iPlayerPoints[ id ] >= get_pcvar_num( armorcost ) )
  403. {
  404. set_user_armor( id, get_user_armor( id ) + get_pcvar_num(armor_ammount) );
  405. emit_sound(id, CHAN_ITEM, "items/ammopickup2.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  406.  
  407. iPlayerPoints[ id ] -= get_pcvar_num( armorcost );
  408. HasArmor[ id ] = true;
  409. }
  410. else NoPoints( id );
  411. }
  412. case 6: // Speed
  413. {
  414. if( iPlayerPoints[ id ] >= get_pcvar_num( speedcost ) )
  415. {
  416. set_user_maxspeed(id, 400.0)
  417. set_task(get_pcvar_float(time_speed), "remove_speed", id)
  418.  
  419. iPlayerPoints[ id ] -= get_pcvar_num( speedcost );
  420. HasSpeed[ id ] = true;
  421. iSpeed[ id ] = true;
  422.  
  423. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 bought^x03 Speed^x01 from^x04 %d^x01 sek.", iPrefix, szName, get_pcvar_num(time_speed));
  424. }
  425. else NoPoints( id );
  426. }
  427. case 7: // Godmode
  428. {
  429. if( iPlayerPoints[ id ] >= get_pcvar_num( godmodecost ) )
  430. {
  431. set_user_godmode(id, 1);
  432. set_task(get_pcvar_float(time_godmode), "remove_godmode", id)
  433.  
  434. iPlayerPoints[ id ] -= get_pcvar_num( godmodecost );
  435. HasGodmode[ id ] = true;
  436.  
  437. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 bought^x03 Godmode^x01 from^x04 %d^x01 sek.", iPrefix, szName, get_pcvar_num(time_godmode));
  438. }
  439. else NoPoints( id );
  440. }
  441. case 8: // Silent Walk
  442. {
  443. if( iPlayerPoints[ id ] >= get_pcvar_num( silentcost ) )
  444. {
  445. set_user_footsteps( id, 1 );
  446. set_task(get_pcvar_float(time_silent), "remove_silent", id)
  447.  
  448. iPlayerPoints[ id ] -= get_pcvar_num( silentcost );
  449. HasSilent[ id ] = true;
  450.  
  451. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 bought^x03 Silent Walk^x01 from^x04 %d^x01 sek.", iPrefix, szName, get_pcvar_num(time_silent));
  452. }
  453. else NoPoints( id );
  454. }
  455. case 9: // AWP
  456. {
  457. if( iPlayerPoints[ id ] >= get_pcvar_num( awpcost ) )
  458. {
  459. if( user_has_weapon( id, CSW_AWP ) ) return PLUGIN_HANDLED;
  460.  
  461. give_item(id, "weapon_awp");
  462. cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_awp", id), get_pcvar_num(awp_ammo));
  463. cs_set_user_bpammo(id, CSW_AWP, 0);
  464.  
  465. iPlayerPoints[ id ] -= get_pcvar_num( awpcost );
  466. HasAwp[ id ] = true;
  467.  
  468. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 Has bought^x03 AWP^x01!", iPrefix, szName);
  469. }
  470. else NoPoints( id );
  471. }
  472. case 10: // Deagle
  473. {
  474. if( iPlayerPoints[ id ] >= get_pcvar_num( deaglecost ) )
  475. {
  476. if( user_has_weapon( id, CSW_DEAGLE ) ) return PLUGIN_HANDLED;
  477.  
  478. give_item(id, "weapon_deagle");
  479. cs_set_weapon_ammo(find_ent_by_owner(1, "weapon_deagle", id), get_pcvar_num(deagle_ammo));
  480. cs_set_user_bpammo(id, CSW_DEAGLE, 0);
  481.  
  482. iPlayerPoints[ id ] -= get_pcvar_num( deaglecost );
  483. HasDeagle[ id ] = true;
  484.  
  485. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 Has bought^x03 Deagle^x01!", iPrefix, szName);
  486. }
  487. else NoPoints( id );
  488. }
  489. case 11: // Noclip
  490. {
  491. if( iPlayerPoints[ id ] >= get_pcvar_num( noclipcost ) )
  492. {
  493. set_user_noclip(id, 1);
  494. set_task(get_pcvar_float(time_noclip), "remove_noclip", id)
  495.  
  496. iPlayerPoints[ id ] -= get_pcvar_num( noclipcost );
  497. HasNoclip[ id ] = true;
  498.  
  499. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 bought^x03 Noclip^x01 from^x04 %d^x01 sek.", iPrefix, szName, get_pcvar_num(time_noclip));
  500. }
  501. else NoPoints( id );
  502. }
  503. case 12: // Camouflage
  504. {
  505. if( iPlayerPoints[ id ] >= get_pcvar_num( camocost ) )
  506. {
  507. new oldModel[ 32 ];
  508. cs_get_user_model( id, oldModel, charsmax( oldModel ) );
  509.  
  510. iCamoOldModel[ id ] = oldModel;
  511. cs_set_user_model( id, PlayerModels[ cs_get_user_team( id ) == CS_TEAM_CT ? random_num( 0, 3 ) : random_num( 4,7 ) ] );
  512.  
  513. set_task(get_pcvar_float(time_camo), "remove_camouflage", id)
  514.  
  515. iPlayerPoints[ id ] -= get_pcvar_num( camocost );
  516. HasCamo[ id ] = true;
  517.  
  518. ColorChat(0, TEAM_COLOR, "%s^x04 %s^x01 bought^x03 Camouflage^x01 from^x04 %d^x01 sek.", iPrefix, szName, get_pcvar_num(time_camo));
  519. }
  520. else NoPoints( id );
  521. }
  522. }
  523.  
  524. menu_destroy(shop)
  525. return PLUGIN_HANDLED;
  526. }
  527.  
  528. NoPoints( id )
  529. {
  530. set_hudmessage( random( 256 ), random( 256 ), random( 256 ), 0.43, 0.55, 1, 5.0, 5.0, 0.1, 0.2, -1 );
  531. show_hudmessage( id, "You haven't got enough points!" );
  532. }
  533.  
  534. NextUse( id ) ColorChat( id, GREEN, "%s^1 Next use, next round.", iPrefix );
  535.  
  536. public remove_gravity(id)
  537. {
  538. if( is_user_connected( id ) && is_user_alive( id ) )
  539. {
  540. set_user_gravity(id, 1.0);
  541. ColorChat(id, GREEN, "%s^x03 Gravity^x01 is deactivate.", iPrefix);
  542. }
  543. }
  544.  
  545. public remove_speed(id)
  546. {
  547. if( is_user_connected( id ) && is_user_alive( id ) )
  548. {
  549. set_user_maxspeed(id, 250.0);
  550. iSpeed[id] = false;
  551.  
  552. ColorChat(id, GREEN, "%s^x01 Your speed is normal.", iPrefix);
  553. }
  554. }
  555.  
  556. public remove_godmode(id)
  557. {
  558. if( is_user_connected( id ) && is_user_alive( id ) )
  559. {
  560. set_user_godmode(id, 0);
  561. ColorChat(id, GREEN, "%s^x03 Godmode^x01 is deactivate.", iPrefix);
  562. }
  563. }
  564.  
  565. public remove_silent(id)
  566. {
  567. if( is_user_connected( id ) && is_user_alive( id ) )
  568. {
  569. set_user_footsteps( id, 0 );
  570. ColorChat(id, GREEN, "%s^x03 Silent Walk^x01 is deactivated.", iPrefix);
  571. }
  572. }
  573.  
  574. public remove_noclip(id)
  575. {
  576. if( is_user_connected( id ) && is_user_alive( id ) )
  577. {
  578. set_user_noclip(id, 0);
  579. ColorChat(id, GREEN, "%s^x03 Noclip^x01 is deactivate.", iPrefix);
  580. }
  581. }
  582.  
  583. public remove_camouflage(id)
  584. {
  585. if( is_user_connected( id ) && is_user_alive( id ) )
  586. {
  587. cs_set_user_model(id, iCamoOldModel[id]);
  588. ColorChat(id, GREEN, "%s^x03 Camouflage^x01 is deactivate.", iPrefix);
  589. }
  590. }
  591.  
  592. public Advert()
  593. {
  594. ColorChat(0, GREEN, "%s^x01 This server is using^x03 %s v%s^x01 by^x03 %s", iPrefix, PLUGIN, VERSION, AUTHOR);
  595. ColorChat(0, GREEN, "%s^x01 Type^x03 /shop^x01 or^x03 /knifeshop^x01 to buy items.", iPrefix );
  596. }
  597.  
  598. public EventCurWeapon(id)
  599. {
  600. if(is_user_connected( id ) && iSpeed[id]) set_user_maxspeed(id, 400.0);
  601. }
  602.  
  603. LoadPoints( id )
  604. {
  605. if( !is_user_bot( id ) && !is_user_hltv( id ) )
  606. {
  607. new vaultkey[ 64 ], vaultdata[ 256 ], points[ 33 ], UserName[ 33 ];
  608. get_user_name( id, UserName, charsmax( UserName ) );
  609.  
  610. format( vaultkey, charsmax( vaultkey ), "%s", UserName );
  611. format( vaultdata, charsmax( vaultdata ), "%i#", iPlayerPoints[ id ] );
  612.  
  613. nvault_get( vault, vaultkey, vaultdata, 255 );
  614. replace_all( vaultdata, 255, "#", " " );
  615.  
  616. parse( vaultdata, points, 32 );
  617. iPlayerPoints[ id ] = str_to_num( points );
  618. }
  619. }
  620.  
  621. SavePoints( id )
  622. {
  623. if( !is_user_bot( id ) && !is_user_hltv( id ) )
  624. {
  625. new vaultkey[ 64 ], vaultdata[ 256 ], UserName[ 33 ];
  626. get_user_name( id, UserName, charsmax( UserName ) );
  627.  
  628. format( vaultkey, charsmax( vaultkey ), "%s", UserName );
  629. format( vaultdata, charsmax( vaultdata ), "%i#", iPlayerPoints[ id ] );
  630.  
  631. nvault_set( vault, vaultkey, vaultdata );
  632. }
  633. }
  634.  
  635. HudColors( &r, &g, &b )
  636. {
  637. static szRed[ 5 ], szGreen[ 5 ], szBlue[ 5 ];
  638.  
  639. new color[ 20 ];
  640. get_pcvar_string( hud_color, color, charsmax( color ) );
  641.  
  642. parse( color, szRed, charsmax( szRed ), szGreen, charsmax( szGreen ), szBlue, charsmax( szBlue ) );
  643.  
  644. r = str_to_num( szRed );
  645. g = str_to_num( szGreen );
  646. b = str_to_num( szBlue );
  647. }
  648.  
  649. ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
  650. {
  651. static message[256];
  652.  
  653. switch(type)
  654. {
  655. case NORMAL:
  656. {
  657. message[0] = 0x01;
  658. }
  659. case GREEN:
  660. {
  661. message[0] = 0x04;
  662. }
  663. default:
  664. {
  665. message[0] = 0x03;
  666. }
  667. }
  668.  
  669. vformat(message[1], 251, msg, 4);
  670.  
  671. message[192] = '^0';
  672.  
  673. static team, ColorChange, index, MSG_Type;
  674.  
  675. if(id)
  676. {
  677. MSG_Type = MSG_ONE;
  678. index = id;
  679. }
  680. else
  681. {
  682. index = FindPlayer();
  683. MSG_Type = MSG_ALL;
  684. }
  685.  
  686. team = get_user_team(index);
  687. ColorChange = ColorSelection(index, MSG_Type, type);
  688.  
  689. ShowColorMessage(index, MSG_Type, message);
  690.  
  691. if(ColorChange)
  692. {
  693. Team_Info(index, MSG_Type, TeamName[team]);
  694. }
  695. }
  696.  
  697. ShowColorMessage(id, type, message[])
  698. {
  699. message_begin(type, get_user_msgid("SayText"), _, id);
  700. write_byte(id)
  701. write_string(message);
  702. message_end();
  703. }
  704.  
  705. Team_Info(id, type, team[])
  706. {
  707. message_begin(type, get_user_msgid("TeamInfo"), _, id);
  708. write_byte(id);
  709. write_string(team);
  710. message_end();
  711.  
  712. return 1;
  713. }
  714.  
  715. ColorSelection(index, type, Color:Type)
  716. {
  717. switch(Type)
  718. {
  719. case RED:
  720. {
  721. return Team_Info(index, type, TeamName[1]);
  722. }
  723. case BLUE:
  724. {
  725. return Team_Info(index, type, TeamName[2]);
  726. }
  727. case GREY:
  728. {
  729. return Team_Info(index, type, TeamName[0]);
  730. }
  731. }
  732.  
  733. return 0;
  734. }
  735.  
  736. FindPlayer()
  737. {
  738. static i;
  739. i = -1;
  740.  
  741. while(i <= get_maxplayers())
  742. {
  743. if(is_user_connected(++i))
  744. {
  745. return i;
  746. }
  747. }
  748.  
  749. return -1;
  750. }
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement