hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.28. 23:27



Jelenlévő felhasználók

Jelenleg 223 felhasználó van jelen :: 0 regisztrált, 1 rejtett és 222 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 9 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Csak pontokért.
HozzászólásElküldve: 2013.04.16. 15:03 
Offline
Őskövület
Avatar

Csatlakozott: 2011.12.28. 00:35
Hozzászólások: 2736
Megköszönt másnak: 56 alkalommal
Megköszönték neki: 275 alkalommal
Hali.

Valaki eltudja mondani, hogy ebbe a pluginban hol tudom beállítani, hogy csak pontokért tudjanak venni cuccokat?

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

_________________
****


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Csak pontokért.
HozzászólásElküldve: 2013.04.28. 13:20 
Offline
Veterán
Avatar

Csatlakozott: 2012.09.01. 22:19
Hozzászólások: 1697
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 302 alkalommal
surf_buy.cfg-ben?

_________________
Valami új kezdete...
Kép
Egyedi pluginok készítése pénzért (Banki átutalás, PayPal) -> Privát üzenet

Ők köszönték meg crazy` nek ezt a hozzászólást: pixxa112 (2013.04.28. 16:16)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Csak pontokért.
HozzászólásElküldve: 2013.04.28. 16:16 
Offline
Őskövület
Avatar

Csatlakozott: 2011.12.28. 00:35
Hozzászólások: 2736
Megköszönt másnak: 56 alkalommal
Megköszönték neki: 275 alkalommal
crazy` írta:
surf_buy.cfg-ben?


Végre valaki írt.

Köszi.

_________________
****


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Csak pontokért.
HozzászólásElküldve: 2013.04.28. 16:27 
Offline
Veterán
Avatar

Csatlakozott: 2012.09.01. 22:19
Hozzászólások: 1697
Megköszönt másnak: 26 alkalommal
Megköszönték neki: 302 alkalommal
pixxa112 írta:
crazy` írta:
surf_buy.cfg-ben?


Végre valaki írt.

Köszi.


ha van valami, írj, segítek szívesen:)

_________________
Valami új kezdete...
Kép
Egyedi pluginok készítése pénzért (Banki átutalás, PayPal) -> Privát üzenet


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Csak pontokért.
HozzászólásElküldve: 2013.04.28. 16:30 
Offline
Őskövület
Avatar

Csatlakozott: 2011.12.28. 00:35
Hozzászólások: 2736
Megköszönt másnak: 56 alkalommal
Megköszönték neki: 275 alkalommal
crazy` írta:
pixxa112 írta:
crazy` írta:
surf_buy.cfg-ben?


Végre valaki írt.

Köszi.


ha van valami, írj, segítek szívesen:)


Rendben. Amit otthon leszek javítom, és szólok ha valami nem megy.

_________________
****


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Csak pontokért.
HozzászólásElküldve: 2013.04.30. 13:08 
Offline
Őskövület
Avatar

Csatlakozott: 2011.12.28. 00:35
Hozzászólások: 2736
Megköszönt másnak: 56 alkalommal
Megköszönték neki: 275 alkalommal
Cazy:

Itt be írtam a pontokat és ugyan úgy tudok pénzért venni a cuccokat:
SMA Forráskód: [ Mindet kijelol ]
  1. // Items cost in points
  2. surf_health1_cost "4"
  3. surf_speed_cost "4"
  4. surf_gravity_cost "4"
  5. surf_invisibility_cost "4"
  6. surf_moneys_cost "5"
  7. surf_damage_cost "6"
  8. surf_noclip_cost "12"
  9. surf_godmode_cost "10"
  10. surf_health2_cost "10"
  11. surf_unlimitedclip_cost "10"
  12. surf_jail_cost "2"
  13. surf_shotguns_cost "14"
  14.  
  15. // Items cost in moneys
  16. surf_health1_cost2 "4"
  17. surf_speed_cost2 "4"
  18. surf_gravity_cost2 "4"
  19. surf_invisibility_cost2 "4"
  20. surf_moneys_cost2 "5"
  21. surf_damage_cost2 "6"
  22. surf_noclip_cost2 "12"
  23. surf_godmode_cost2 "10"
  24. surf_health2_cost2 "10"
  25. surf_unlimitedclip_cost2 "10"
  26. surf_jail_cost2 "2"
  27. surf_shotguns_cost2 "14"

_________________
****


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Csak pontokért.
HozzászólásElküldve: 2013.04.30. 15:17 
Offline
Őskövület
Avatar

Csatlakozott: 2012.03.22. 18:22
Hozzászólások: 2978
Megköszönt másnak: 115 alkalommal
Megköszönték neki: 368 alkalommal
nem tudtam lefutatni,mivel nincs meg az inc,de megpróbáltam :D


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

_________________
Blasenkampfwagen

https://discord.gg/uBYnNnZP
GTA:PURSUIT MTA


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Csak pontokért.
HozzászólásElküldve: 2013.05.01. 00:40 
Offline
Őskövület
Avatar

Csatlakozott: 2011.12.28. 00:35
Hozzászólások: 2736
Megköszönt másnak: 56 alkalommal
Megköszönték neki: 275 alkalommal
ultraibolya írta:
nem tudtam lefutatni,mivel nincs meg az inc,de megpróbáltam :D


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


Mivel lett másabb? És csak pontokért lehet venni a cuccokat?

_________________
****


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Csak pontokért.
HozzászólásElküldve: 2013.05.01. 06:43 
Offline
Őskövület
Avatar

Csatlakozott: 2012.03.22. 18:22
Hozzászólások: 2978
Megköszönt másnak: 115 alkalommal
Megköszönték neki: 368 alkalommal
aha.(elvileg)


edit:

még1x átnéztem,és kicsit hanyag voltam.Ennek jónak kell lennie.

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

_________________
Blasenkampfwagen

https://discord.gg/uBYnNnZP
GTA:PURSUIT MTA


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 9 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 24 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole