HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <hamsandwich>
  4. #include <fakemeta_util>
  5. #include <cstrike>
  6.  
  7. #if defined _surf_included
  8. #endif
  9. #define _surf_included
  10. #endinput
  11. native surf_get_user_points(index);
  12. native surf_set_user_points(index, amount);
  13. native surf_add_user_points(index, amount);
  14. native surf_del_user_points(index, amount);
  15.  
  16. // Pragma
  17. #pragma semicolon 1
  18.  
  19. // Plugin info
  20. new const PLUGIN[] = "Surf Buy";
  21. new const VERSION[] = "1.0";
  22. new const AUTHOR[] = "Hattrick";
  23.  
  24. // Customization
  25. new const xPrefix[] = "!g[Surf Pontrendszer]";
  26. new const ConfigFile[] = "addons/amxmodx/configs/surf_buy.cfg";
  27.  
  28. // Unlimited clip offsets
  29. #if cellbits == 32
  30. const OFFSET_CLIPAMMO = 51;
  31. #else
  32. const OFFSET_CLIPAMMO = 65;
  33. #endif
  34. const OFFSET_LINUX_WEAPONS = 4;
  35.  
  36. // Maxclip const
  37. new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20, 10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 };
  38.  
  39. // Entities list
  40. new entlist[][] = { "func_button", "trigger_multiple", "trigger_once" };
  41.  
  42. // Cvars
  43. new cvar_health1_cost, cvar_speed_cost, cvar_gravity_cost, cvar_invisibility_cost, cvar_moneys_cost, cvar_damage_cost, cvar_noclip_cost, cvar_godmode_cost,
  44. cvar_health2_cost, cvar_unlimitedclip_cost, cvar_jail_cost, cvar_shotguns_cost,
  45. cvar_health1_cost2, cvar_speed_cost2, cvar_gravity_cost2, cvar_invisibility_cost2, cvar_moneys_cost2, cvar_damage_cost2, cvar_noclip_cost2, cvar_godmode_cost2,
  46. cvar_health2_cost2, cvar_unlimitedclip_cost2, cvar_jail_cost2, cvar_shotguns_cost2;
  47.  
  48. // Bools
  49. new bool:b_Speed[33], bool:b_Invisibility[33], bool:b_Damage[33], bool:b_Noclip[33], bool:b_Godmode[33],
  50. bool:b_Unlimitedclip[33], b_Spawns[33], g_GodmodeCount[33], g_NoclipCount[33], bool:b_Gravity[33], bool:b_Shotguns[33];
  51.  
  52. // Init
  53. public plugin_init()
  54. {
  55. // Register the plugin
  56. register_plugin(PLUGIN, VERSION, AUTHOR);
  57.  
  58. // Register the plugin dictionary
  59. register_dictionary("surf_buy.txt");
  60.  
  61. // Register the plugins events
  62. register_event("CurWeapon", "event_CurWeapon", "be", "1=1");
  63.  
  64. // Client commands
  65. register_clcmd("say /menu", "command_Buy");
  66. register_clcmd("say menu", "command_Buy");
  67. register_clcmd("say /shop", "command_Buy");
  68. register_clcmd("say shop", "command_Buy");
  69.  
  70. // Menu commands
  71. register_menucmd(register_menuid("aaaxMenu1"), 1023, "BuyMenu");
  72. register_menucmd(register_menuid("bbbxMenu2"), 1023, "BuyMenu2");
  73.  
  74. // Messages
  75. register_message(get_user_msgid("CurWeapon"), "message_cur_weapon");
  76.  
  77. // Plugin cvars
  78. cvar_health1_cost = register_cvar("surf_health1_cost", "3");
  79. cvar_speed_cost = register_cvar("surf_speed_cost", "3");
  80. cvar_gravity_cost = register_cvar("surf_gravity_cost", "3");
  81. cvar_invisibility_cost = register_cvar("surf_invisibility_cost", "4");
  82. cvar_moneys_cost = register_cvar("surf_moneys_cost", "4");
  83. cvar_damage_cost = register_cvar("surf_damage_cost", "5");
  84. cvar_noclip_cost = register_cvar("surf_noclip_cost", "7");
  85. cvar_godmode_cost = register_cvar("surf_godmode_cost", "7");
  86. cvar_health2_cost = register_cvar("surf_health2_cost", "8");
  87. cvar_unlimitedclip_cost = register_cvar("surf_unlimitedclip_cost", "8");
  88. cvar_jail_cost = register_cvar("surf_jail_cost", "3");
  89. cvar_shotguns_cost = register_cvar("surf_shotguns_cost", "8");
  90. cvar_health1_cost2 = register_cvar("surf_health1_cost2", "1500");
  91. cvar_speed_cost2 = register_cvar("surf_speed_cost2", "1750");
  92. cvar_gravity_cost2 = register_cvar("surf_gravity_cost2", "1500");
  93. cvar_invisibility_cost2 = register_cvar("surf_invisibility_cost2", "2000");
  94. cvar_moneys_cost2 = register_cvar("surf_moneys_cost2", "10000");
  95. cvar_damage_cost2 = register_cvar("surf_damage_cost2", "8000");
  96. cvar_noclip_cost2 = register_cvar("surf_noclip_cost2", "12000");
  97. cvar_godmode_cost2 = register_cvar("surf_godmode_cost2", "12000");
  98. cvar_health2_cost2 = register_cvar("surf_health2_cost2", "14500");
  99. cvar_unlimitedclip_cost2 = register_cvar("surf_unlimitedclip_cost2", "14500");
  100. cvar_jail_cost2 = register_cvar("surf_jail_cost2", "3750");
  101. cvar_shotguns_cost2 = register_cvar("surf_shotguns_cost2", "15000");
  102.  
  103. // Forwards
  104. RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawned_Post", 1);
  105. RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage");
  106. }
  107.  
  108. // Public plugin config
  109. public plugin_cfg()
  110. {
  111. new x[128];
  112. format(x, 127, "exec %s", ConfigFile);
  113. server_cmd(x);
  114. server_exec();
  115. }
  116.  
  117. // Menu format
  118. public command_Buy(id)
  119. {
  120. // Make menu (2024 max characters)
  121. new menuBody[2025];
  122. add(menuBody, 2024, "\ySurf Pontrendszer^n^n");
  123. add(menuBody, 2024, "\r1.\w Élet \y[+255 HP]^n");
  124. add(menuBody, 2024, "\r2.\w Gyorsaság \y[350 Sebesség]^n");
  125. add(menuBody, 2024, "\r3.\w Gravitáció \y[500 Gravitáció]^n");
  126. add(menuBody, 2024, "\r4.\w Láthatatlanság \y[100% Láthatatlanság]^n");
  127. add(menuBody, 2024, "\r5.\w Pénz \y[+12500$]^n");
  128. add(menuBody, 2024, "\r6.\w Sebzés \y[2x DMG]^n");
  129. add(menuBody, 2024, "\r7.\w Noclip \y[20 másodperc]^n");
  130. add(menuBody, 2024, "\r8.\w Istenmód \y[20 másodperc]^n^n");
  131. add(menuBody, 2024, "\r9.\w Következõ^n^n");
  132. add(menuBody, 2024, "\r0.\w Kilépés^n");
  133.  
  134. // Show menu to player
  135. show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), menuBody, -1, "aaaxMenu1");
  136. }
  137.  
  138. // Menu2 format
  139. public command_Buy2(id)
  140. {
  141. // Make menu (2024 max characters)
  142. new menuBody[2025];
  143. add(menuBody, 2024, "\ySurf Pontrendszer 2^n^n");
  144. add(menuBody, 2024, "\r1.\w Élet \y[+1000 HP]^n");
  145. add(menuBody, 2024, "\r2.\w Korlátlan Clip \y[végtelen lõszer]^n");
  146. add(menuBody, 2024, "\r3.\w Jail nyitás^n");
  147. add(menuBody, 2024, "\r4.\w ShotGun \y[M3 & XM1014]^n^n");
  148. add(menuBody, 2024, "\r9.\w Vissza^n^n");
  149. add(menuBody, 2024, "\r0.\w Kilépés^n");
  150.  
  151. // Show menu to player
  152. show_menu(id, (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9), menuBody, -1, "bbbxMenu2");
  153. }
  154.  
  155. // Buy menu
  156. public BuyMenu(id, key)
  157. {
  158. // Get the user name
  159. new name[32];
  160. get_user_name(id, name, 31);
  161.  
  162. // Switch the player key
  163. switch(key)
  164. {
  165. // Health +255
  166. case 0:
  167. {
  168. // Has enough points?
  169. if (surf_get_user_points(id) >= get_pcvar_num(cvar_health1_cost))
  170. {
  171. fm_set_user_health(id, get_user_health(id) + 255);
  172. surf_del_user_points(id, get_pcvar_num(cvar_health1_cost));
  173. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "+255 HP!");
  174. }
  175. // Not has enough points, has enough moneys?
  176. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_health1_cost2))
  177. {
  178. fm_set_user_health(id, get_user_health(id) + 255);
  179. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_health1_cost2));
  180. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "+255 HP!");
  181. }
  182. // Not has points, not has moneys... I'm sorry...
  183. else
  184. {
  185. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_health1_cost), get_pcvar_num(cvar_health1_cost2));
  186. }
  187. }
  188. // 300 Speed
  189. case 1:
  190. {
  191. // Has enough points?
  192. if (surf_get_user_points(id) >= get_pcvar_num(cvar_speed_cost))
  193. {
  194. b_Speed[id] = true;
  195. surf_del_user_points(id, get_pcvar_num(cvar_speed_cost));
  196. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "300 Sebesség!");
  197. }
  198. // Not has enough points, has enough moneys?
  199. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_speed_cost2))
  200. {
  201. b_Speed[id] = true;
  202. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_speed_cost2));
  203. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "300 Sebesség!");
  204. }
  205. // Not has points, not has moneys... I'm sorry...
  206. else
  207. {
  208. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_speed_cost), get_pcvar_num(cvar_speed_cost2));
  209. }
  210. }
  211. // 500 Gravity
  212. case 2:
  213. {
  214. // Has enough points?
  215. if (surf_get_user_points(id) >= get_pcvar_num(cvar_gravity_cost))
  216. {
  217. b_Gravity[id] = true;
  218. fm_set_user_gravity(id, 0.7);
  219. surf_del_user_points(id, get_pcvar_num(cvar_gravity_cost));
  220. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "500 Gravitáció!");
  221. }
  222. // Not has enough points, has enough moneys?
  223. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_gravity_cost2))
  224. {
  225. b_Gravity[id] = true;
  226. fm_set_user_gravity(id, 0.7);
  227. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_gravity_cost2));
  228. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "500 Gravitáció!");
  229. }
  230. // Not has points, not has moneys... I'm sorry...
  231. else
  232. {
  233. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_gravity_cost), get_pcvar_num(cvar_gravity_cost2));
  234. }
  235. }
  236. // 100% Invisibility
  237. case 3:
  238. {
  239. // Has enough points?
  240. if (surf_get_user_points(id) >= get_pcvar_num(cvar_invisibility_cost))
  241. {
  242. b_Invisibility[id] = true;
  243. fm_set_user_rendering(id, kRenderFxHologram, 0, 0, 0, kRenderTransAlpha, 250);
  244. surf_del_user_points(id, get_pcvar_num(cvar_invisibility_cost));
  245. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "100% Láthatatlanság!");
  246. }
  247. // Not has enough points, has enough moneys?
  248. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_invisibility_cost2))
  249. {
  250. b_Invisibility[id] = true;
  251. fm_set_user_rendering(id, kRenderFxHologram, 0, 0, 0, kRenderTransAlpha, 250);
  252. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_invisibility_cost2));
  253. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "100% Láthatatlanság!");
  254. }
  255. // Not has points, not has moneys... I'm sorry...
  256. else
  257. {
  258. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_invisibility_cost), get_pcvar_num(cvar_invisibility_cost2));
  259. }
  260. }
  261. // 12500$ Moneys
  262. case 4:
  263. {
  264. // Has enough points?
  265. if (surf_get_user_points(id) >= get_pcvar_num(cvar_moneys_cost))
  266. {
  267. cs_set_user_money(id, cs_get_user_money(id) + 12500);
  268. surf_del_user_points(id, get_pcvar_num(cvar_moneys_cost));
  269. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "12500$ Pénz!");
  270. }
  271. // Not has enough points, has enough moneys?
  272. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_moneys_cost2))
  273. {
  274. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_moneys_cost2));
  275. cs_set_user_money(id, cs_get_user_money(id) + 12500);
  276. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "12500$ Pénz!");
  277. }
  278. // Not has points, not has moneys... I'm sorry...
  279. else
  280. {
  281. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_moneys_cost), get_pcvar_num(cvar_moneys_cost2));
  282. }
  283. }
  284. // 2x Damage
  285. case 5:
  286. {
  287. // Has enough points?
  288. if (surf_get_user_points(id) >= get_pcvar_num(cvar_damage_cost))
  289. {
  290. b_Damage[id] = true;
  291. surf_del_user_points(id, get_pcvar_num(cvar_damage_cost));
  292. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "2x Sebzés!");
  293. }
  294. // Not has enough points, has enough moneys?
  295. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_damage_cost2))
  296. {
  297. b_Damage[id] = true;
  298. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_damage_cost2));
  299. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "2x Sebzés!");
  300. }
  301. // Not has points, not has moneys... I'm sorry...
  302. else
  303. {
  304. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_damage_cost), get_pcvar_num(cvar_damage_cost2));
  305. }
  306. }
  307. // Noclip 20 seconds
  308. case 6:
  309. {
  310. // Has enough points?
  311. if (surf_get_user_points(id) >= get_pcvar_num(cvar_noclip_cost))
  312. {
  313. b_Noclip[id] = true;
  314. g_NoclipCount[id] = 19;
  315. fm_set_user_noclip(id, 1);
  316. surf_del_user_points(id, get_pcvar_num(cvar_noclip_cost));
  317. set_task(20.0, "task_RemoveNoclip", id);
  318. set_task(1.0, "task_NoclipCountDown", id, _, _, "a", 19);
  319. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "No clip!");
  320. }
  321. // Not has enough points, has enough moneys?
  322. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_noclip_cost2))
  323. {
  324. b_Noclip[id] = true;
  325. g_NoclipCount[id] = 19;
  326. fm_set_user_noclip(id, 1);
  327. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_noclip_cost2));
  328. set_task(20.0, "task_RemoveNoclip", id);
  329. set_task(1.0, "task_NoclipCountDown", id, _, _, "a", 19);
  330. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "No clip!");
  331. }
  332. // Not has points, not has moneys... I'm sorry...
  333. else
  334. {
  335. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_noclip_cost), get_pcvar_num(cvar_noclip_cost2));
  336. }
  337. }
  338. // Godmode 20 seconds
  339. case 7:
  340. {
  341. // Has enough points?
  342. if (surf_get_user_points(id) >= get_pcvar_num(cvar_godmode_cost))
  343. {
  344. b_Godmode[id] = true;
  345. g_GodmodeCount[id] = 19;
  346. fm_set_user_godmode(id, 1);
  347. surf_del_user_points(id, get_pcvar_num(cvar_godmode_cost));
  348. set_task(20.0, "task_RemoveGodmode", id);
  349. set_task(1.0, "task_GodmodeCountDown", id, _, _, "a", 19);
  350. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "Istemód!");
  351. }
  352. // Not has enough points, has enough moneys?
  353. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_godmode_cost2))
  354. {
  355. b_Godmode[id] = true;
  356. g_GodmodeCount[id] = 19;
  357. fm_set_user_godmode(id, 1);
  358. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_godmode_cost2));
  359. set_task(20.0, "task_RemoveGodmode", id);
  360. set_task(1.0, "task_GodmodeCountDown", id, _, _, "a", 19);
  361. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "Istenmód!");
  362. }
  363. // Not has points, not has moneys... I'm sorry...
  364. else
  365. {
  366. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_godmode_cost), get_pcvar_num(cvar_godmode_cost2));
  367. }
  368. }
  369. case 8:
  370. {
  371. command_Buy2(id);
  372. }
  373. default:
  374. {
  375. return PLUGIN_CONTINUE;
  376. }
  377. }
  378. return PLUGIN_CONTINUE;
  379. }
  380.  
  381. // Buy menu2
  382. public BuyMenu2(id, key)
  383. {
  384. // Get the user name
  385. new name[32];
  386. get_user_name(id, name, 31);
  387.  
  388. // Switch the player key
  389. switch(key)
  390. {
  391. // Health +1000
  392. case 0:
  393. {
  394. // Has enough points?
  395. if (surf_get_user_points(id) >= get_pcvar_num(cvar_health2_cost))
  396. {
  397. fm_set_user_health(id, get_user_health(id) + 1000);
  398. surf_del_user_points(id, get_pcvar_num(cvar_health2_cost));
  399. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "+1000 HP!");
  400. }
  401. // Not has enough points, has enough moneys?
  402. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_health2_cost2))
  403. {
  404. fm_set_user_health(id, get_user_health(id) + 1000);
  405. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_health2_cost2));
  406. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "+1000 HP!");
  407. }
  408. // Not has points, not has moneys... I'm sorry...
  409. else
  410. {
  411. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_health2_cost), get_pcvar_num(cvar_health2_cost2));
  412. }
  413. }
  414. // Unlimited Clip
  415. case 1:
  416. {
  417. // Has enough points?
  418. if (surf_get_user_points(id) >= get_pcvar_num(cvar_unlimitedclip_cost))
  419. {
  420. b_Unlimitedclip[id] = true;
  421. surf_del_user_points(id, get_pcvar_num(cvar_unlimitedclip_cost));
  422. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "Végtelen Clip!");
  423. }
  424. // Not has enough points, has enough moneys?
  425. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_unlimitedclip_cost2))
  426. {
  427. b_Unlimitedclip[id] = true;
  428. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_unlimitedclip_cost2));
  429. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "Végtelen Clip!");
  430. }
  431. // Not has points, not has moneys... I'm sorry...
  432. else
  433. {
  434. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_unlimitedclip_cost), get_pcvar_num(cvar_unlimitedclip_cost2));
  435. }
  436. }
  437. // Jail open
  438. case 2:
  439. {
  440. // Has enough points?
  441. if (surf_get_user_points(id) >= get_pcvar_num(cvar_jail_cost))
  442. {
  443. open_jail(id);
  444. surf_del_user_points(id, get_pcvar_num(cvar_jail_cost));
  445. }
  446. // Not has enough points, has enough moneys?
  447. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_jail_cost2))
  448. {
  449. open_jail(id);
  450. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_jail_cost2));
  451. }
  452. // Not has points, not has moneys... I'm sorry...
  453. else
  454. {
  455. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_jail_cost), get_pcvar_num(cvar_jail_cost2));
  456. }
  457. }
  458. // ShotGuns
  459. case 3:
  460. {
  461. // Has enough points?
  462. if (surf_get_user_points(id) >= get_pcvar_num(cvar_shotguns_cost))
  463. {
  464. b_Shotguns[id] = true;
  465. fm_give_item(id, "weapon_m3");
  466. fm_give_item(id, "weapon_xm1014");
  467. cs_set_user_bpammo(id, CSW_M3, 999);
  468. cs_set_user_bpammo(id, CSW_XM1014, 999);
  469. surf_del_user_points(id, get_pcvar_num(cvar_shotguns_cost));
  470. }
  471. // Not has enough points, has enough moneys?
  472. else if (cs_get_user_money(id) >= get_pcvar_num(cvar_shotguns_cost2))
  473. {
  474. b_Shotguns[id] = true;
  475. fm_give_item(id, "weapon_m3");
  476. fm_give_item(id, "weapon_xm1014");
  477. cs_set_user_bpammo(id, CSW_M3, 999);
  478. cs_set_user_bpammo(id, CSW_XM1014, 999);
  479. cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(cvar_shotguns_cost2));
  480. }
  481. // Not has points, not has moneys... I'm sorry...
  482. else
  483. {
  484. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NO_ENOUGH_MONEY", get_pcvar_num(cvar_shotguns_cost), get_pcvar_num(cvar_shotguns_cost2));
  485. }
  486. }
  487. case 8:
  488. {
  489. command_Buy(id);
  490. }
  491. default:
  492. {
  493. return PLUGIN_CONTINUE;
  494. }
  495. }
  496. return PLUGIN_CONTINUE;
  497. }
  498.  
  499. // Current Weapon event
  500. public event_CurWeapon(id)
  501. {
  502. if (b_Speed[id])
  503. {
  504. fm_set_user_maxspeed(id, 350.0);
  505. }
  506. }
  507.  
  508. // When client is spawned
  509. public ham_PlayerSpawned_Post(id)
  510. {
  511. b_Spawns[id]++;
  512. if (b_Speed[id])
  513. {
  514. b_Speed[id] = false;
  515. }
  516. if (b_Invisibility[id])
  517. {
  518. b_Invisibility[id] = false;
  519. fm_set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 255);
  520. }
  521. if (b_Gravity[id])
  522. {
  523. b_Gravity[id] = false;
  524. fm_set_user_gravity(id, 1.0);
  525. }
  526. if (b_Damage[id])
  527. {
  528. b_Damage[id] = false;
  529. }
  530. if (b_Noclip[id])
  531. {
  532. b_Noclip[id] = false;
  533. fm_set_user_noclip(id, 0);
  534. }
  535. if (b_Godmode[id])
  536. {
  537. b_Godmode[id] = false;
  538. fm_set_user_godmode(id, 0);
  539. }
  540. if (b_Spawns[id] == 3)
  541. {
  542. command_Buy(id);
  543. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_BEGGIN_INFO");
  544. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_BEGGIN_INFO");
  545. }
  546. if (b_Unlimitedclip[id])
  547. {
  548. b_Unlimitedclip[id] = false;
  549. }
  550. if (g_GodmodeCount[id])
  551. {
  552. g_GodmodeCount[id] = 0;
  553. }
  554. if (g_NoclipCount[id])
  555. {
  556. g_NoclipCount[id] = 0;
  557. }
  558. if (b_Shotguns[id])
  559. {
  560. b_Shotguns[id] = false;
  561. fm_give_item(id, "weapon_m3");
  562. fm_give_item(id, "weapon_xm1014");
  563. cs_set_user_bpammo(id, CSW_M3, 999);
  564. cs_set_user_bpammo(id, CSW_XM1014, 999);
  565. }
  566. }
  567.  
  568. // Damage multiplier
  569. public ham_TakeDamage(victim, inflictor, attacker, Float:damage)
  570. {
  571. if (victim == attacker || !is_user_connected(attacker))
  572. {
  573. return HAM_IGNORED;
  574. }
  575. if (b_Damage[attacker])
  576. {
  577. damage *= 2.0;
  578. SetHamParamFloat(4, damage);
  579. }
  580. return HAM_IGNORED;
  581. }
  582.  
  583. // When client joining
  584. public client_putinserver(id)
  585. {
  586. set_task(25.0, "task_Announce", id);
  587. }
  588.  
  589. // When client disconnect
  590. public client_disconnect(id)
  591. {
  592. if (b_Speed[id])
  593. {
  594. b_Speed[id] = false;
  595. }
  596. if (b_Invisibility[id])
  597. {
  598. b_Invisibility[id] = false;
  599. }
  600. if (b_Gravity[id])
  601. {
  602. b_Gravity[id] = false;
  603. }
  604. if (b_Damage[id])
  605. {
  606. b_Damage[id] = false;
  607. }
  608. if (b_Noclip[id])
  609. {
  610. b_Noclip[id] = false;
  611. }
  612. if (b_Godmode[id])
  613. {
  614. b_Godmode[id] = false;
  615. }
  616. if (b_Spawns[id])
  617. {
  618. b_Spawns[id] = 0;
  619. }
  620. if (b_Unlimitedclip[id])
  621. {
  622. b_Unlimitedclip[id] = false;
  623. }
  624. if (g_GodmodeCount[id])
  625. {
  626. g_GodmodeCount[id] = 0;
  627. }
  628. if (g_NoclipCount[id])
  629. {
  630. g_NoclipCount[id] = 0;
  631. }
  632. if (b_Shotguns[id])
  633. {
  634. b_Shotguns[id] = false;
  635. }
  636. }
  637.  
  638. // Remove Noclip task
  639. public task_RemoveNoclip(id)
  640. {
  641. if (!is_user_connected(id))
  642. {
  643. return;
  644. }
  645. if (fm_get_user_noclip(id))
  646. {
  647. b_Noclip[id] = false;
  648. fm_set_user_noclip(id, 0);
  649. new Float:origin[3], hulltype;
  650. pev(id, pev_origin, origin);
  651. hulltype = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN;
  652. if (!hattrick_hull_vacant(id, origin, hulltype))
  653. {
  654. user_kill(id);
  655. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NOCLIP_DIED");
  656. }
  657. if (is_user_alive(id))
  658. {
  659. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_NOCLIP_REMOVED");
  660. }
  661. }
  662. }
  663.  
  664. // Remove Godmode task
  665. public task_RemoveGodmode(id)
  666. {
  667. if (!is_user_connected(id))
  668. {
  669. return;
  670. }
  671. if (fm_get_user_godmode(id))
  672. {
  673. b_Godmode[id] = false;
  674. fm_set_user_godmode(id, 0);
  675. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_GODMODE_REMOVED");
  676. }
  677. }
  678.  
  679. // Announce the player
  680. public task_Announce(id)
  681. {
  682. if (is_user_connected(id))
  683. {
  684. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_WELCOME");
  685. }
  686. }
  687.  
  688. // Countdown player noclip
  689. public task_NoclipCountDown(id)
  690. {
  691. if (!is_user_connected(id) || !is_user_alive(id))
  692. {
  693. return;
  694. }
  695. g_NoclipCount[id]--;
  696. set_hudmessage(0, 255, 0, 0.35, 0.8, _, _, 7.0);
  697. show_hudmessage(id, "%L", LANG_PLAYER, "SURF_YOU_HAVE", "noclip", g_NoclipCount[id]);
  698. }
  699.  
  700. // Countdown player godmode
  701. public task_GodmodeCountDown(id)
  702. {
  703. if (!is_user_connected(id) || !is_user_alive(id))
  704. {
  705. return;
  706. }
  707. g_GodmodeCount[id]--;
  708. set_hudmessage(0, 255, 0, 0.35, 0.8, _, _, 7.0);
  709. show_hudmessage(id, "%L", LANG_PLAYER, "SURF_YOU_HAVE", "godmode", g_GodmodeCount[id]);
  710. }
  711.  
  712. // Write colored function
  713. public write_colored(const id, const string[], {Float, Sql, Resul,_}:...)
  714. {
  715. new msg[191], players[32], count = 1;
  716. vformat(msg, 190, string, 3);
  717. replace_all(msg, 190, "!n", "^1");
  718. replace_all(msg, 190, "!t", "^3");
  719. replace_all(msg, 190, "!g", "^4");
  720. if (id) players[0] = id;
  721. else get_players(players, count, "ch");
  722. for (new i = 0; i < count; i++)
  723. {
  724. if (is_user_connected(players[i]))
  725. {
  726. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
  727. write_byte(players[i]);
  728. write_string(msg);
  729. message_end();
  730. }
  731. }
  732. }
  733.  
  734. // Is hull vacant stock (credits ==> VEN)
  735. stock bool:hattrick_hull_vacant(id, const Float:origin[3], hullType = HULL_HEAD, &hitent = 0)
  736. {
  737. engfunc(EngFunc_TraceHull, origin, origin, 0, hullType, id, 0);
  738. hitent = get_tr2(0, TraceResult:TR_pHit);
  739. if (!get_tr2(0, TraceResult:TR_StartSolid) && !get_tr2(0, TraceResult:TR_AllSolid) && get_tr2(0, TraceResult:TR_InOpen))
  740. {
  741. return true;
  742. }
  743. return false;
  744. }
  745.  
  746. // Unlimited clip stuff
  747. public message_cur_weapon(msg_id, msg_dest, msg_entity)
  748. {
  749. if (!b_Unlimitedclip[msg_entity])
  750. {
  751. return;
  752. }
  753. if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
  754. {
  755. return;
  756. }
  757. static weapon, clip;
  758. weapon = get_msg_arg_int(2);
  759. clip = get_msg_arg_int(3);
  760. if (MAXCLIP[weapon] > 2)
  761. {
  762. set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon]);
  763. if (clip < 2)
  764. {
  765. static wname[32], weapon_ent;
  766. get_weaponname(weapon, wname, 31);
  767. weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity);
  768. fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon]);
  769. }
  770. }
  771. }
  772.  
  773. stock fm_set_weapon_ammo(entity, amount)
  774. {
  775. set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
  776. }
  777.  
  778. // Open jail function
  779. public open_jail(id)
  780. {
  781. // Get the user name
  782. new name[32];
  783. get_user_name(id, name, 31);
  784.  
  785. new ent, target[32], ent2;
  786. for (new i = 0; i < sizeof entlist; i++)
  787. {
  788. ent = 0;
  789. ent2 = 0;
  790. while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", entlist[i])))
  791. {
  792. if (pev_valid(ent))
  793. {
  794. pev(ent, pev_target, target, 31);
  795. while((ent2 = engfunc(EngFunc_FindEntityByString, ent2, "targetname", target)))
  796. {
  797. dllfunc(DLLFunc_Use, ent2, id);
  798. write_colored(0, "%s %L", xPrefix, LANG_PLAYER, "SURF_CHAT_INFO_X", name, "Jail Nyitás!");
  799. return PLUGIN_HANDLED;
  800. }
  801. }
  802. }
  803. }
  804. write_colored(id, "%s %L", xPrefix, LANG_PLAYER, "SURF_CANT_FIND");
  805. return PLUGIN_HANDLED;
  806. }