Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.43 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3.  
  4. #pragma semicolon 1
  5.  
  6. /*
  7. * by xPaw & Grim
  8. *
  9. * Credits:
  10. * Grim - for original code/Godmode Key actviation - added pcvars
  11. * Ven - His tutorial for Player Spawn
  12. */
  13.  
  14. #define VERSION "2.0"
  15.  
  16. #define fm_get_user_money(%1) get_pdata_int( %1, 115 )
  17. #define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
  18.  
  19. #define MAX_CLIENTS 32
  20.  
  21. enum Color {
  22. NORMAL = 1, // clients scr_concolor cvar color
  23. GREEN, // Green
  24. TEAM_COLOR, // Red, grey, blue
  25. GREY, // grey
  26. RED, // Red
  27. BLUE, // Blue
  28. };
  29.  
  30. new TeamName[][] = {
  31. "",
  32. "TERRORIST",
  33. "CT",
  34. "SPECTATOR"
  35. };
  36.  
  37.  
  38. // Pcvars
  39. new plugin_on, silentcost, stealthcost, noflashcost, hpcost, armorcost, grenadecost, gravitycost, speedcost, godmodecost;
  40. new allowsilent, allowstealth, allownoflash, allowhp, allowarmor, allowgrenade, allowgravity, allowspeed, allowgodmode;
  41. new usersilent[33], userstealth[33], usernoflash[33], userhp[33], userarmor[33], usergrenade[33], usergravity[33], userspeed[33];
  42. new hpcvar, armorcvar, menu, hasspeed[33], hassilent[33], gotgodmode[33], hasgodmode[33];
  43. new g_msgScreenFade, g_msgMoney, grenade[32], last;
  44.  
  45. new Float:g_gametime, g_owner;
  46. new Float:g_gametime2;
  47.  
  48. new bool:g_bPlayerNonSpawnEvent[MAX_CLIENTS + 1];
  49. new bool:g_track_enemy;
  50. new bool:g_track[33];
  51.  
  52. new g_iFwFmClientCommandPost;
  53. new g_sync_check_data;
  54.  
  55. public plugin_init() {
  56. register_plugin("Deluxe Shop", VERSION, "xPaw & Grim");
  57. register_cvar("hns_shop_version", VERSION, FCVAR_SERVER);
  58. set_cvar_string("hns_shop_version", VERSION);
  59.  
  60. // Player Spawn
  61. register_event("ResetHUD", "fwEvResetHUD", "b");
  62. register_event("TextMsg", "fwEvGameWillRestartIn", "a", "2=#Game_will_restart_in");
  63. register_clcmd("fullupdate", "fwCmdClFullupdate");
  64.  
  65. // Events
  66. register_event("DeathMsg", "eDeath", "a");
  67. register_event("CurWeapon", "speed_on", "be");
  68. register_event("ScreenFade", "eventFlash", "be", "4=255", "5=255", "6=255", "7>199");
  69. register_event("TextMsg", "fire_in_the_hole", "b", "2&#Game_radio", "4&#Fire_in_the_hole");
  70. register_event("TextMsg", "fire_in_the_hole2", "b", "3&#Game_radio", "5&#Fire_in_the_hole");
  71. register_event("99", "grenade_throw", "b");
  72.  
  73. // Pcvars
  74. plugin_on = register_cvar("hns_shop", "1");
  75. silentcost = register_cvar("hns_shop_silentcost", "4500");
  76. stealthcost = register_cvar("hns_shop_stealthcost", "9500");
  77. noflashcost = register_cvar("hns_shop_noflashcost", "8000");
  78. grenadecost = register_cvar("hns_shop_grenadecost", "1500");
  79. gravitycost = register_cvar("hns_shop_gravitycost", "13000");
  80. speedcost = register_cvar("hns_shop_speedcost", "7000");
  81. hpcost = register_cvar("hns_shop_hpcost", "8000");
  82. armorcost = register_cvar("hns_shop_armorcost", "6000");
  83. godmodecost = register_cvar("hns_shop_godmodecost", "16000");
  84. hpcvar = register_cvar("hns_shop_hpcvar", "150");
  85. armorcvar = register_cvar("hns_shop_armorcvar", "150");
  86. allowsilent = register_cvar("hns_shop_allowsilent", "1");
  87. allowstealth = register_cvar("hns_shop_allowstealth", "1");
  88. allownoflash = register_cvar("hns_shop_allownoflash", "1");
  89. allowgrenade = register_cvar("hns_shop_allowgrenade", "1");
  90. allowgravity = register_cvar("hns_shop_allowgravity", "1");
  91. allowspeed = register_cvar("hns_shop_allowspeed", "1");
  92. allowhp = register_cvar("hns_shop_allowhp", "1");
  93. allowarmor = register_cvar("hns_shop_allowarmor", "1");
  94. allowgodmode = register_cvar("hns_shop_allowgodmode", "1");
  95.  
  96. // Clcmds
  97. register_clcmd("say /tienda", "show_hnsmenu");
  98. register_clcmd("say /shop", "show_hnsmenu");
  99. register_clcmd("say tienda", "show_hnsmenu");
  100. register_clcmd("say shop", "show_hnsmenu");
  101.  
  102. // Menu
  103. menu = register_menuid("[Deluxe Shop]");
  104. register_menucmd(menu, 1023, "hnsshop");
  105.  
  106. // Forwards
  107. register_forward(FM_EmitSound,"fw_emitsound");
  108. register_forward(FM_CmdStart, "fwd_FM_CmdStart_pre", 0);
  109.  
  110.  
  111. // Tasks
  112. set_task( 2.0, "bad_fix2",_,_,_, "b" );
  113. set_task( 100.0, "advert",_,_,_, "b" );
  114.  
  115. g_msgScreenFade = get_user_msgid("ScreenFade");
  116. g_msgMoney = get_user_msgid("Money");
  117. }
  118. public plugin_precache() {
  119. precache_sound("escondidas_deluxe/inmunidad_activada.wav");
  120. }
  121.  
  122.  
  123. public client_connect( id ) {
  124. usersilent[id] = 0;
  125. userstealth[id] = 0;
  126. usernoflash[id] = 0;
  127. userhp[id] = 0;
  128. userarmor[id] = 0;
  129. usergrenade[id] = 0;
  130. usergravity[id] = 0;
  131. userspeed[id] = 0;
  132. gotgodmode[id] = 0;
  133. hasgodmode[id] = 0;
  134. hasspeed[id] = 0;
  135. hassilent[id] = 0;
  136. }
  137.  
  138. public client_disconnect( id ) {
  139. usersilent[id] = 0;
  140. userstealth[id] = 0;
  141. usernoflash[id] = 0;
  142. userhp[id] = 0;
  143. userarmor[id] = 0;
  144. usergrenade[id] = 0;
  145. usergravity[id] = 0;
  146. userspeed[id] = 0;
  147. gotgodmode[id] = 0;
  148. hasgodmode[id] = 0;
  149. hasspeed[id] = 0;
  150. hassilent[id] = 0;
  151. }
  152.  
  153. public speed_on( id )
  154. if(is_user_alive(id))
  155. if(hasspeed[id])
  156. fm_set_user_maxspeed(id, 320.0);
  157.  
  158. // Advert
  159. public advert() {
  160. new g_Maxplayers;
  161. g_Maxplayers = get_maxplayers();
  162.  
  163. for(new i=1; i<=g_Maxplayers; i++)
  164. if(is_user_connected(i))
  165. ColorChat(i, RED, "^x04[Deluxe Shop]^x01 Este servidor usa^x03 Deluxe Shop,^x01 para poder comprar^x01 escribe^x03 /shop");
  166. }
  167.  
  168. public fwd_FM_CmdStart_pre( id, uc_handle, random_seed ) {
  169. if(!is_user_alive(id))
  170. return FMRES_IGNORED;
  171.  
  172. if(hassilent[id] > 0) { set_pev(id, pev_flTimeStepSound, 999); }
  173.  
  174. static iButton;
  175. iButton = get_uc(uc_handle, UC_Buttons);
  176.  
  177. if(gotgodmode[id]) {
  178. if(iButton & IN_RELOAD) {
  179. iButton &= ~IN_RELOAD;
  180. set_uc(uc_handle, UC_Buttons, iButton);
  181. add_godmode(id);
  182. }
  183. }
  184.  
  185.  
  186. return FMRES_IGNORED;
  187. }
  188. // User Spawn event
  189. public fwEvResetHUD( id ) {
  190. if (!is_user_alive(id))
  191. return;
  192.  
  193. if (g_bPlayerNonSpawnEvent[id]) {
  194. g_bPlayerNonSpawnEvent[id] = false;
  195. return;
  196. }
  197.  
  198. fwPlayerSpawn(id);
  199. }
  200.  
  201. public fwEvGameWillRestartIn() {
  202. static iPlayers[32], iPlayersNum, i;
  203. get_players(iPlayers, iPlayersNum, "a");
  204. for (i = 0; i < iPlayersNum; ++i)
  205. g_bPlayerNonSpawnEvent[iPlayers[i]] = true;
  206. }
  207.  
  208. public fwCmdClFullupdate( id ) {
  209. g_bPlayerNonSpawnEvent[id] = true;
  210. static const szFwFmClientCommandPost[] = "fwFmClientCommandPost";
  211. g_iFwFmClientCommandPost = register_forward(FM_ClientCommand, szFwFmClientCommandPost, 1);
  212. return PLUGIN_CONTINUE;
  213. }
  214.  
  215. public fwFmClientCommandPost( id ) {
  216. unregister_forward(FM_ClientCommand, g_iFwFmClientCommandPost, 1);
  217. g_bPlayerNonSpawnEvent[id] = false;
  218. return FMRES_HANDLED;
  219. }
  220.  
  221. public fwPlayerSpawn( id ) {
  222. if(!is_user_alive(id))
  223. return PLUGIN_HANDLED;
  224.  
  225. if(get_pcvar_num(plugin_on) == 1) {
  226. set_pev(id, pev_flTimeStepSound, 400);
  227. fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255);
  228. fm_set_user_health(id, 100);
  229. fm_set_user_armor(id, 0);
  230. fm_set_user_gravity(id, 1.0);
  231. usersilent[id] = 0;
  232. userstealth[id] = 0;
  233. usernoflash[id] = 0;
  234. userhp[id] = 0;
  235. userarmor[id] = 0;
  236. usergrenade[id] = 0;
  237. usergravity[id] = 0;
  238. userspeed[id] = 0;
  239. hassilent[id] = 0;
  240. hasgodmode[id] = 0;
  241. }
  242. return PLUGIN_HANDLED;
  243. }
  244.  
  245. // User Death event
  246. public eDeath( id ) {
  247. new victem = read_data(2);
  248.  
  249. usersilent[victem] = 0;
  250. userstealth[victem] = 0;
  251. usernoflash[victem] = 0;
  252. userhp[victem] = 0;
  253. userarmor[victem] = 0;
  254. usergrenade[victem] = 0;
  255. usergravity[victem] = 0;
  256. userspeed[victem] = 0;
  257. hasspeed[victem] = 0;
  258. hasgodmode[victem] = 0;
  259. hassilent[victem] = 0;
  260. }
  261.  
  262. // Showing menu
  263. public show_hnsmenu( id ) {
  264. if(get_pcvar_num(plugin_on) == 1) {
  265. new szBuffer[512], iLen;
  266.  
  267. iLen = formatex(szBuffer, sizeof szBuffer - 1, "\rDeluxe Shop Menu^n^n");
  268. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r1. \wPasos Silenciosos - \y%d$^n", get_pcvar_num(silentcost));
  269. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r2. \wInvisibilidad \r(20 segundos) - \y%d$^n", get_pcvar_num(stealthcost));
  270. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r3. \wAnti Flash - \y%d$^n", get_pcvar_num(noflashcost));
  271. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r4. \w%d HP - \y%d$^n", get_pcvar_num(hpcvar), get_pcvar_num(hpcost));
  272. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r5. \w%d Armor - \y%d$^n", get_pcvar_num(armorcvar), get_pcvar_num(armorcost));
  273. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r6. \wGranada HE - \y%d$^n", get_pcvar_num(grenadecost));
  274. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r7. \wGravedad \r(10 segundos) - \y%d$^n", get_pcvar_num(gravitycost));
  275. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r8. \wVelocidad \r(25 segundos) - \y%d$^n", get_pcvar_num(speedcost));
  276. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r9. \wInmunidad \r(5 segundos) - \y%d$^n^n", get_pcvar_num(godmodecost));
  277. iLen += formatex(szBuffer[iLen], (sizeof szBuffer - 1) - iLen, "\r0. \wSalir");
  278.  
  279. new iKeys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<< 8 | 1<<9 );
  280. show_menu(id, iKeys, szBuffer, -1, "[Deluxe Shop]");
  281. } else
  282. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 La ^x04tienda ^x01ha sido desactivada.");
  283. return PLUGIN_HANDLED;
  284. }
  285.  
  286. // Shop actions
  287. public hnsshop( id, key ) {
  288. switch( key ) {
  289. case 0: // Silent Footsteps
  290. {
  291. if(!is_user_alive(id)) {
  292. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Necesitas estar ^x04vivo!");
  293. return PLUGIN_HANDLED;
  294. }
  295. if(usersilent[id] > 0) {
  296. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ya tienes este ^x04item!");
  297. return PLUGIN_HANDLED;
  298. }
  299. if(get_pcvar_num(allowsilent) == 0) {
  300. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Este ^x04item ^x01esta deshabilitado.");
  301. return PLUGIN_HANDLED;
  302. }
  303.  
  304. new money = fm_get_user_money(id);
  305. new cost = get_pcvar_num(silentcost);
  306.  
  307. if(money > cost || money == cost) {
  308. set_pev(id, pev_flTimeStepSound, 999);
  309. fm_set_user_money(id, money - cost);
  310. usersilent[id]++;
  311. hassilent[id]++;
  312. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Has comprado^x03 Pasos Silenciosos,^x01 ahora el enemigo no podra escucharte.");
  313. } else {
  314. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 No tienes^x03 dinero^x03 suficiente^x01 para poder comprar este ^x03item!");
  315. }
  316. }
  317. case 1: // Stealth Suit
  318. {
  319. if(!is_user_alive(id)) {
  320. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Necesitas estar ^x04vivo!");
  321. return PLUGIN_HANDLED;
  322. }
  323. if(userstealth[id] > 0) {
  324. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ya tienes este ^x04item!");
  325. return PLUGIN_HANDLED;
  326. }
  327. if(get_pcvar_num(allowstealth) == 0) {
  328. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Este ^x04item ^x01esta deshabilitado.");
  329. return PLUGIN_HANDLED;
  330. }
  331.  
  332. new money = fm_get_user_money(id);
  333. new cost = get_pcvar_num(stealthcost);
  334.  
  335. if(money > cost || money == cost) {
  336. fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 15);
  337. fm_set_user_money(id, money - cost);
  338. userstealth[id]++;
  339. set_task(20.0, "remove_stealth", id);
  340. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Has comprado^x03 Invisibilidad,^x01 ahora eres^x03 invisible^x01 por^x04 20 segundos.") ;
  341. } else {
  342. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 No tienes^x03 dinero^x03 suficiente^x01 para poder comprar este ^x03item!");
  343. }
  344. }
  345. case 2: // NoFlash Blinding
  346. {
  347. if(!is_user_alive(id)) {
  348. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Necesitas estar ^x04vivo!");
  349. return PLUGIN_HANDLED;
  350. }
  351. if(usernoflash[id] > 0) {
  352. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ya tienes este ^x04item!");
  353. return PLUGIN_HANDLED;
  354. }
  355. if(get_pcvar_num(allownoflash) == 0) {
  356. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Este ^x04item ^x01esta deshabilitado.");
  357. return PLUGIN_HANDLED;
  358. }
  359.  
  360. new money = fm_get_user_money(id);
  361. new cost = get_pcvar_num(noflashcost);
  362.  
  363. if(money > cost || money == cost) {
  364. fm_set_user_money(id, money - cost);
  365. usernoflash[id]++;
  366. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Has comprado^x03 Anti Flash.");
  367. } else {
  368. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 No tienes^x03 dinero^x03 suficiente^x01 para poder comprar este ^x03item!");
  369. }
  370. }
  371. case 3: // HP
  372. {
  373. if(!is_user_alive(id)) {
  374. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Necesitas estar ^x04vivo!");
  375. return PLUGIN_HANDLED;
  376. }
  377. if(userhp[id] > 0) {
  378. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ya tienes este ^x04item!");
  379. return PLUGIN_HANDLED;
  380. }
  381. if(get_pcvar_num(allowhp) == 0) {
  382. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Este ^x04item ^x01esta deshabilitado.");
  383. return PLUGIN_HANDLED;
  384. }
  385.  
  386. new money = fm_get_user_money(id);
  387. new cost = get_pcvar_num(hpcost);
  388.  
  389. if(money > cost || money == cost) {
  390. new health = get_pcvar_num(hpcvar);
  391. fm_set_user_money(id, money - cost);
  392. fm_set_user_health(id, health);
  393. userhp[id]++;
  394. client_cmd(id, "spk items/medshot4");
  395. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Has comprado^x03 %d HP.", get_pcvar_num(hpcvar));
  396. } else {
  397. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 No tienes^x03 dinero^x03 suficiente^x01 para poder comprar este ^x03item!");
  398. }
  399. }
  400. case 4: // Armor
  401. {
  402. if(!is_user_alive(id)) {
  403. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Necesitas estar ^x04vivo!");
  404. return PLUGIN_HANDLED;
  405. }
  406. if(userarmor[id] > 0) {
  407. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ya tienes este ^x04item!");
  408. return PLUGIN_HANDLED;
  409. }
  410. if(get_pcvar_num(allowarmor) == 0) {
  411. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Este ^x04item ^x01esta deshabilitado.");
  412. return PLUGIN_HANDLED;
  413. }
  414.  
  415. new money = fm_get_user_money(id);
  416. new cost = get_pcvar_num(armorcost);
  417.  
  418. if(money > cost || money == cost) {
  419. new armor = get_pcvar_num(armorcvar);
  420. fm_set_user_money(id, money - cost);
  421. fm_set_user_armor(id, armor);
  422. userarmor[id]++;
  423. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Has comprado^x03 %d Armor.", get_pcvar_num(armorcvar));
  424. } else {
  425. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 No tienes^x03 dinero^x03 suficiente^x01 para poder comprar este ^x03item!");
  426. }
  427. }
  428. case 5: // HE Grenade
  429. {
  430. if(!is_user_alive(id)) {
  431. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Necesitas estar ^x04vivo!");
  432. return PLUGIN_HANDLED;
  433. }
  434. if(usergrenade[id] > 0) {
  435. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ya tienes este ^x04item!");
  436. return PLUGIN_HANDLED;
  437. }
  438. if(get_pcvar_num(allowgrenade) == 0) {
  439. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Este ^x04item ^x01esta deshabilitado.");
  440. return PLUGIN_HANDLED;
  441. }
  442.  
  443. new money = fm_get_user_money(id);
  444. new cost = get_pcvar_num(grenadecost);
  445.  
  446. if(money > cost || money == cost) {
  447. fm_set_user_money(id, money - cost);
  448. fm_give_item(id, "weapon_hegrenade");
  449. usergrenade[id]++;
  450. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Has comprado^x03 Granada HE.");
  451. } else {
  452. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 No tienes^x03 dinero^x03 suficiente^x01 para poder comprar este ^x03item!");
  453. }
  454. }
  455. case 6: // Gravity
  456. {
  457. if(!is_user_alive(id)) {
  458. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Necesitas estar ^x04vivo!");
  459. return PLUGIN_HANDLED;
  460. }
  461. if(usergravity[id] > 0) {
  462. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ya tienes este ^x04item!");
  463. return PLUGIN_HANDLED;
  464. }
  465. if(get_pcvar_num(allowgravity) == 0) {
  466. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Este ^x04item ^x01esta deshabilitado.");
  467. return PLUGIN_HANDLED;
  468. }
  469.  
  470. new money = fm_get_user_money(id);
  471. new cost = get_pcvar_num(gravitycost);
  472.  
  473. if(money > cost || money == cost) {
  474. fm_set_user_money(id, money - cost);
  475. fm_set_user_gravity(id, 0.63);
  476. usergravity[id]++;
  477. set_task(10.0, "remove_gravity", id);
  478. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Has comprado^x03 Gravedad^x01 por^x04 10 segundos.");
  479. } else {
  480. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 No tienes^x03 dinero^x03 suficiente^x01 para poder comprar este ^x03item!");
  481. }
  482. }
  483. case 7: // Faster Speed
  484. {
  485. if(!is_user_alive(id)) {
  486. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Necesitas estar ^x04vivo!");
  487. return PLUGIN_HANDLED;
  488. }
  489. if(userspeed[id] > 0) {
  490. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ya tienes este ^x04item!");
  491. return PLUGIN_HANDLED;
  492. }
  493. if(get_pcvar_num(allowspeed) == 0) {
  494. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Este ^x04item ^x01esta deshabilitado.");
  495. return PLUGIN_HANDLED;
  496. }
  497.  
  498. new money = fm_get_user_money(id);
  499. new cost = get_pcvar_num(speedcost);
  500.  
  501. if(money > cost || money == cost) {
  502. fm_set_user_money(id, money - cost);
  503. userspeed[id]++;
  504. hasspeed[id]++;
  505. fm_set_user_maxspeed(id, 320.0);
  506. set_task(25.0, "remove_speed", id);
  507. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Has comprado^x03 Velocidad^x01 por^x04 25 segundos.");
  508. } else {
  509. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 No tienes^x03 dinero^x03 suficiente^x01 para poder comprar este ^x03item!");
  510. }
  511. }
  512. case 8: // Godmode
  513. {
  514. if(!is_user_alive(id)) {
  515. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Necesitas estar ^x04vivo!");
  516. return PLUGIN_HANDLED;
  517. }
  518. if(gotgodmode[id] > 0) {
  519. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ya tienes este ^x04item!");
  520. return PLUGIN_HANDLED;
  521. }
  522. if(get_pcvar_num(allowgodmode) == 0) {
  523. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Este ^x04item ^x01esta deshabilitado.");
  524. return PLUGIN_HANDLED;
  525. }
  526.  
  527. new money = fm_get_user_money(id);
  528. new cost = get_pcvar_num(godmodecost);
  529.  
  530. if(money > cost || money == cost)
  531. {
  532. gotgodmode[id] = 1;
  533. fm_set_user_money(id, money - cost);
  534. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Has comprado^x03 Inmunidad,^x01 para^x03 Activarla^x01 apreta la letra^x04 R");
  535. ColorChat(id, BLUE, "");
  536. } else {
  537. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 No tienes^x03 dinero^x03 suficiente^x01 para poder comprar este ^x03item!");
  538. }
  539. }
  540. case 9: // Exit
  541. return PLUGIN_HANDLED;
  542. }
  543. return PLUGIN_HANDLED;
  544. }
  545.  
  546. // Remove Gravity
  547. public remove_gravity( id ) {
  548. fm_set_user_gravity(id, 1.0);
  549. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Tu ^x03Gravedad^x01 ahora es normal.");
  550. }
  551.  
  552. // Remove Stealth
  553. public remove_stealth( id ) {
  554. fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255);
  555. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Ahora eres^x03 visible^x01 para todos.");
  556. }
  557.  
  558. // Remove Speed
  559. public remove_speed( id ) {
  560. fm_set_user_maxspeed(id, 250.0);
  561. hasspeed[id] = 0;
  562. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Tu ^x03Velocidad^x01 ahora es normal.");
  563. }
  564.  
  565. // Add and Remove GodMode
  566.  
  567. public add_godmode(id) {
  568. if(!gotgodmode[id]) return;
  569. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Tu^x03 Inmunidad^x01 ahora esta^x04 Activada!");
  570. fm_set_user_godmode(id, 1);
  571. gotgodmode[id] = 0;
  572. set_task(5.0, "remove_godmode", id);
  573. emit_sound(id, CHAN_VOICE, "escondidas_deluxe/inmunidad_activada.wav", 0.9, ATTN_NORM, 0, PITCH_NORM);
  574. fm_set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 255);
  575. }
  576.  
  577. public remove_godmode( id ) {
  578. fm_set_user_godmode(id, 0);
  579. ColorChat(id, BLUE, "^x04[Deluxe Shop]^x01 Se te ha acabado tu^x03 Inmunidad.");
  580. fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255);
  581. }
  582. /// NoFlash Blinding - Start
  583. public bad_fix2() {
  584. new Float:gametime = get_gametime();
  585. if(gametime - g_gametime2 > 2.5)
  586. for(new i = 0; i < 32; i++)
  587. grenade[i] = 0;
  588. }
  589.  
  590. public eventFlash( id ) {
  591. new Float:gametime = get_gametime();
  592. if(gametime != g_gametime) {
  593. g_owner = get_grenade_owner();
  594. g_gametime = gametime;
  595. for(new i = 0; i < 33; i++)
  596. g_track[i] = false;
  597. g_track_enemy = false;
  598. }
  599. if(is_user_connected(g_owner) && usernoflash[id] > 0) {
  600. g_track_enemy = true;
  601.  
  602. message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, id);
  603. write_short(1);
  604. write_short(1);
  605. write_short(1);
  606. write_byte(0);
  607. write_byte(0);
  608. write_byte(0);
  609. write_byte(255);
  610. message_end();
  611. }
  612. }
  613.  
  614. public flash_delay() {
  615. if(g_track_enemy == false) {
  616. for(new i = 0; i < 33; i++) {
  617. if(g_track[i] == true && is_user_connected(i)) {
  618. message_begin(MSG_ONE, g_msgScreenFade, {0,0,0}, i) ;
  619. write_short(1);
  620. write_short(1);
  621. write_short(1);
  622. write_byte(0);
  623. write_byte(0);
  624. write_byte(0);
  625. write_byte(255);
  626. message_end();
  627. }
  628. }
  629. }
  630. }
  631.  
  632. public grenade_throw() {
  633. if(g_sync_check_data == 0)
  634. return PLUGIN_CONTINUE;
  635. g_sync_check_data--;
  636. if(read_datanum() < 2)
  637. return PLUGIN_HANDLED_MAIN;
  638.  
  639. if(read_data(1) == 11 && (read_data(2) == 0 || read_data(2) == 1))
  640. add_grenade_owner(last);
  641.  
  642. return PLUGIN_CONTINUE;
  643. }
  644.  
  645. public fire_in_the_hole() {
  646. new name[32];
  647. read_data(3, name, 31);
  648. new temp_last = get_user_index(name);
  649. new junk;
  650. if((temp_last == 0) || (!is_user_connected(temp_last)))
  651. return PLUGIN_CONTINUE;
  652. if(get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) {
  653. last = temp_last;
  654. g_sync_check_data = 2;
  655. }
  656. return PLUGIN_CONTINUE;
  657. }
  658.  
  659. public fire_in_the_hole2() {
  660. new name[32];
  661. read_data(4, name, 31);
  662. new temp_last = get_user_index(name);
  663. new junk;
  664. if((temp_last == 0) || (!is_user_connected(temp_last)))
  665. return PLUGIN_CONTINUE;
  666. if(get_user_weapon(temp_last,junk,junk) == CSW_FLASHBANG) {
  667. last = temp_last;
  668. g_sync_check_data = 2;
  669. }
  670. return PLUGIN_CONTINUE;
  671. }
  672.  
  673. add_grenade_owner(owner) {
  674. new Float:gametime = get_gametime();
  675. g_gametime2 = gametime;
  676. for(new i = 0; i < 32; i++) {
  677. if(grenade[i] == 0) {
  678. grenade[i] = owner;
  679. return;
  680. }
  681. }
  682. }
  683.  
  684. get_grenade_owner() {
  685. new which = grenade[0];
  686. for(new i = 1; i < 32; i++)
  687. grenade[i-1] = grenade[i];
  688. grenade[31] = 0;
  689. return which;
  690. }
  691.  
  692. // from XxAvalanchexX "Flashbang Dynamic Light"
  693. public fw_emitsound(entity,channel,const sample[],Float:volume,Float:attenuation,fFlags,pitch) {
  694. if(!equali(sample,"weapons/flashbang-1.wav") && !equali(sample,"weapons/flashbang-2.wav"))
  695. return FMRES_IGNORED;
  696.  
  697. new Float:gametime = get_gametime();
  698.  
  699. //in case no one got flashed, the sound happens after all the flashes, same game time
  700. if(gametime != g_gametime) {
  701. g_owner = get_grenade_owner();
  702. return FMRES_IGNORED;
  703. }
  704. return FMRES_IGNORED;
  705. }
  706. // NoFlash Blinding - End
  707.  
  708. // Stocks - Start
  709. public fm_set_user_money ( index, i_Money ) {
  710. set_pdata_int ( index, 115, i_Money );
  711.  
  712. message_begin ( MSG_ONE, g_msgMoney, _, index );
  713. write_long ( i_Money );
  714. write_byte ( 1 );
  715. message_end ();
  716. }
  717.  
  718. stock fm_get_user_godmode( index ) {
  719. new Float:val;
  720. pev(index, pev_takedamage, val);
  721.  
  722. return (val == DAMAGE_NO);
  723. }
  724.  
  725. stock fm_set_user_godmode( index, godmode = 0 ) {
  726. set_pev(index, pev_takedamage, godmode == 1 ? DAMAGE_NO : DAMAGE_AIM);
  727.  
  728. return 1;
  729. }
  730.  
  731. stock fm_set_user_health( index, health ) {
  732. health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index);
  733.  
  734. return 1;
  735. }
  736.  
  737. stock fm_set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) {
  738. return fm_set_rendering(index, fx, r, g, b, render, amount);
  739. }
  740.  
  741. stock fm_set_user_maxspeed( index, Float:speed = -1.0 ) {
  742. engfunc(EngFunc_SetClientMaxspeed, index, speed);
  743. set_pev(index, pev_maxspeed, speed);
  744.  
  745. return 1;
  746. }
  747.  
  748. stock fm_set_user_armor( index, armor ) {
  749. set_pev(index, pev_armorvalue, float(armor));
  750.  
  751. return 1;
  752. }
  753.  
  754. stock fm_set_user_gravity( index, Float:gravity = 1.0 ) {
  755. set_pev(index, pev_gravity, gravity);
  756.  
  757. return 1;
  758. }
  759.  
  760. stock fm_give_item( index, const item[] ) {
  761. if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5))
  762. return 0;
  763.  
  764. new ent = fm_create_entity(item);
  765. if (!pev_valid(ent))
  766. return 0;
  767.  
  768. new Float:origin[3];
  769. pev(index, pev_origin, origin);
  770. set_pev(ent, pev_origin, origin);
  771. set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
  772. dllfunc(DLLFunc_Spawn, ent);
  773.  
  774. new save = pev(ent, pev_solid);
  775. dllfunc(DLLFunc_Touch, ent, index);
  776. if (pev(ent, pev_solid) != save)
  777. return ent;
  778.  
  779. engfunc(EngFunc_RemoveEntity, ent);
  780.  
  781. return -1;
  782. }
  783.  
  784. stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) {
  785. new Float:RenderColor[3];
  786. RenderColor[0] = float(r);
  787. RenderColor[1] = float(g);
  788. RenderColor[2] = float(b);
  789.  
  790. set_pev(entity, pev_renderfx, fx);
  791. set_pev(entity, pev_rendercolor, RenderColor);
  792. set_pev(entity, pev_rendermode, render);
  793. set_pev(entity, pev_renderamt, float(amount));
  794.  
  795. return 1;
  796. }
  797. // Stocks - End
  798.  
  799. // ColorChat - Start
  800. ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...) {
  801. new message[256];
  802.  
  803. switch(type) {
  804. case NORMAL: message[0] = 0x01;
  805. case GREEN: message[0] = 0x04;
  806. default: message[0] = 0x03;
  807. }
  808.  
  809. vformat(message[1], 251, msg, 4);
  810.  
  811. // Make sure message is not longer than 192 character. Will crash the server.
  812. message[192] = '^0';
  813.  
  814. new team, ColorChange, index, MSG_Type;
  815.  
  816. if(id) {
  817. MSG_Type = MSG_ONE;
  818. index = id;
  819. } else {
  820. index = FindPlayer();
  821. MSG_Type = MSG_ALL;
  822. }
  823.  
  824. team = get_user_team(index);
  825. ColorChange = ColorSelection(index, MSG_Type, type);
  826.  
  827. ShowColorMessage(index, MSG_Type, message);
  828.  
  829. if(ColorChange)
  830. Team_Info(index, MSG_Type, TeamName[team]);
  831. }
  832.  
  833. ShowColorMessage(id, type, message[]) {
  834. static bool:saytext_used;
  835. static get_user_msgid_saytext;
  836. if(!saytext_used) {
  837. get_user_msgid_saytext = get_user_msgid("SayText");
  838. saytext_used = true;
  839. }
  840. message_begin(type, get_user_msgid_saytext, _, id);
  841. write_byte(id);
  842. write_string(message);
  843. message_end();
  844. }
  845.  
  846. Team_Info(id, type, team[]) {
  847. static bool:teaminfo_used;
  848. static get_user_msgid_teaminfo;
  849. if(!teaminfo_used) {
  850. get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
  851. teaminfo_used = true;
  852. }
  853. message_begin(type, get_user_msgid_teaminfo, _, id);
  854. write_byte(id);
  855. write_string(team);
  856. message_end();
  857.  
  858. return 1;
  859. }
  860.  
  861. ColorSelection(index, type, Color:Type) {
  862. switch(Type) {
  863. case RED: return Team_Info(index, type, TeamName[1]);
  864. case BLUE: return Team_Info(index, type, TeamName[2]);
  865. case GREY: return Team_Info(index, type, TeamName[0]);
  866. }
  867.  
  868. return 0;
  869. }
  870.  
  871. FindPlayer(){
  872. new i = -1;
  873.  
  874. while(i <= get_maxplayers())
  875. if(is_user_connected(++i))
  876. return i;
  877.  
  878. return -1;
  879. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement