Advertisement
Guest User

Untitled

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