Advertisement
Guest User

Untitled

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