HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2.   _________________
  3.   ___ |__ /__(_)___________
  4.   __ /| |_ /__ /_ _ \_ __ \
  5.   _ ___ | / _ / / __/ / / /
  6.   /_/ |_/_/ /_/ \___//_/ /_/
  7.  
  8.   ___ _________
  9.   __ | / /_ ___/
  10.   __ | / /_____ \
  11.   __ |/ / ____/ /
  12.   _____/ /____/
  13.  
  14.   ________ _________ _____
  15.   ___ __ \_________________ /_____ __ /______________
  16.   __ /_/ /_ ___/ _ \ __ /_ __ `/ __/ __ \_ ___/
  17.   _ ____/_ / / __/ /_/ / / /_/ // /_ / /_/ / /
  18.   /_/ /_/ \___/\__,_/ \__,_/ \__/ \____//_/
  19.  
  20. _ _ __ __
  21.   | | | | / |/ |
  22.   | | | | /_/ /_/ |
  23.   \ \/ / | | | |
  24.   \ / | |_| |
  25.   \/ |_(_)_|
  26.  
  27.  ______ ______ _ _ _______ _ _____ _____ ___
  28. (____ \ (_____ \ | | (_|_______|_)/ ___ \ / ___ \ / __)
  29.  ____) )_ _ _____) )__ \ \ _ _ _| | | |____ | | | | |__
  30. | __ (| | | | | ____/ _ \ \ \| | | | | | | | _ \ | | | | __)
  31. | |__) ) |_| | | | | |_| |____) ) | |_____| | |___| | | | | | |___| | |
  32. |______/ \__ | |_| \___(______/|_|\______)_|\_____/|_| |_| \_____/|_|
  33.   (____/
  34.   ______ _ _ _ ______
  35.   (_____ \ | || || | (_____ \
  36.   _____) )__ | || || | ____ _____) )
  37.   | ____/ _ \| ||_|| |/ _ |_____ (
  38.   | | | |_| | |___| ( (/ / | |
  39.   |_| \___/ \______|\____) |_|
  40.  
  41.   __
  42.   /\ _ | \
  43.   /--\| )|__/
  44.  
  45.   _ _ _
  46.   | | | | | |
  47.   | |__ | | ____ ____| | _
  48.   | __)| |/ _ |/ ___) | / )
  49.   | | | ( ( | ( (___| |< (
  50.   |_| |_|\_||_|\____)_| \_)
  51.  
  52. */
  53.  
  54. #include <amxmodx>
  55. #include <amxmisc>
  56. #include <cstrike>
  57. #include <fakemeta>
  58. #include <engine>
  59. #include <fun>
  60.  
  61. new menushown[33],alien_health,predator_health,active,alien_armor,predator_armor
  62.  
  63. new mod_name[32] = "Alien vs Predator v1.1"
  64.  
  65. new const gAlienSounds[][] = {
  66. "AvsP/alien/alien_clawhit.wav",
  67. "AvsP/alien/alien_clawhitwall.wav",
  68. "AvsP/alien/alien_clawmiss.wav",
  69. "AvsP/alien/alien_die1.wav",
  70. "AvsP/alien/alien_die2.wav",
  71. "AvsP/alien/alien_pain1.wav",
  72. "AvsP/alien/alien_pain2.wav"
  73. };
  74.  
  75. new const gPredatoRSounds[][] = {
  76. "AvsP/predator/bc_spithit2.wav",
  77. "AvsP/predator/crpredator.wav",
  78. "AvsP/predator/scpredator.wav",
  79. "AvsP/predator/scpredator2.wav"
  80. };
  81.  
  82. public plugin_init()
  83. {
  84. register_plugin("Alien vs Predator","1.1","P.Of.Pw & Hack")
  85. register_dictionary("AvsP.txt");
  86.  
  87. register_event("ResetHUD", "resetModel", "b")
  88. register_event("CurWeapon","resetWeapon","be", "1=1");
  89.  
  90. register_logevent("roundstart", 2, "1=Round_Start");
  91.  
  92. register_forward(FM_EmitSound,"fw_emitsound");
  93. register_forward(FM_EmitSound,"fw_emitsound2");
  94. register_forward(FM_GetGameDescription,"GameDesc")
  95.  
  96. register_event("ShowMenu", "blockteams", "b", "3=#Team_Select_Spect")
  97. register_event("DeathMsg","oldskool","a","4&kni")
  98. register_event("SendAudio","ctwin","a","2=%!MRAD_ctwin")
  99. register_event("SendAudio","twin","a","2=%!MRAD_terwin")
  100.  
  101. alien_health = register_cvar("alien_hp","250")
  102. predator_health = register_cvar("predator_hp","200")
  103.  
  104. alien_armor = register_cvar("alien_armor","500")
  105. predator_armor = register_cvar("predator_armor","250")
  106.  
  107. active = register_cvar("avsp_active","1")
  108.  
  109. register_clcmd("say /alieninfo","AlienInfoMotd")
  110. register_clcmd("say /infoalien","AlienInfoMotd")
  111. register_clcmd("say /predatorinfo","PredatorInfoMotd")
  112. register_clcmd("say /infopredator","PredatorInfoMotd")
  113. }
  114.  
  115. public plugin_precache()
  116. {
  117. for(new i = 0 ; i < sizeof gAlienSounds ; i++)
  118. precache_sound(gAlienSounds[i])
  119. for(new i = 0 ; i < sizeof gPredatoRSounds ; i++)
  120. precache_sound(gPredatoRSounds[i])
  121.  
  122. precache_model("models/player/predator/predator.mdl")
  123. precache_model("models/AvsP/p_claws.mdl")
  124. precache_model("models/player/alien/alien.mdl")
  125. precache_model("models/AvsP/alienclaws.mdl")
  126.  
  127. }
  128.  
  129. public client_connect(id)
  130. {
  131. if(get_pcvar_num(active) != 1)
  132. return PLUGIN_CONTINUE;
  133. {
  134. set_user_info(id, "_vgui_menus", "0")
  135. menushown[id] = 0
  136. }
  137. return PLUGIN_CONTINUE;
  138. }
  139. public blockteams(id)
  140. {
  141. static on
  142. on = get_pcvar_num(active)
  143. if(menushown[id] == 0 && on == 1)
  144. {
  145. client_cmd(id,"unbind ^"q^"")
  146. show_menu(id, 0, "work", 1, "#Team_Select_Spect")
  147. set_task(0.5,"showmenu",id);
  148. menushown[id] = 1;
  149. }
  150.  
  151. }
  152.  
  153. public showmenu(id) {
  154. new menu = menu_create("\rChoose Creature:", "menu_handler")
  155. menu_additem(menu, "\wAlien", "1", 0)
  156. menu_additem(menu, "\wPredator", "2", 0)
  157. menu_additem(menu, "\wRandom", "5", 0)
  158. menu_additem(menu, "\wSpectator", "6", 0)
  159. menu_display(id, menu, 0)
  160. }
  161.  
  162.  
  163. public menu_handler(id, menu, item) {
  164. new team = get_user_team(id)
  165. if (item == MENU_EXIT) {
  166. menu_destroy(menu)
  167. return PLUGIN_HANDLED
  168. }
  169.  
  170. new data[6], iName[64]
  171. new access, callback
  172. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
  173. new key = str_to_num(data)
  174. switch(key)
  175. {
  176. case 1:
  177. {
  178. if (team != 1)
  179. {
  180. engclient_cmd(id, "jointeam", "1")
  181. engclient_cmd(id, "menuselect", "5")
  182. }
  183. }
  184.  
  185. case 2:
  186. {
  187. if (team != 2)
  188. {
  189. engclient_cmd(id, "jointeam", "2")
  190. engclient_cmd(id, "menuselect","5")
  191. }
  192. }
  193.  
  194. case 5: menu_handler(id, menu, random_num(0, 1))
  195.  
  196. case 6: engclient_cmd(id, "jointeam", "6")
  197. }
  198.  
  199. return PLUGIN_HANDLED
  200. }
  201. public resetModel(id)
  202. {
  203. static on
  204. on = get_pcvar_num(active)
  205. if(on == 1)
  206. {
  207. engfunc(EngFunc_LightStyle,0,"d")
  208. new players[32], inum;
  209. get_players(players,inum);
  210. for(new i = 0 ; i < inum; i++)
  211. {
  212. if (cs_get_user_team(players[i]) == CS_TEAM_CT)
  213. {
  214. cs_set_user_model(players[i], "predator")
  215. set_user_health(players[i],get_pcvar_num(predator_health))
  216. set_user_armor (players[i],get_pcvar_num(predator_armor))
  217. set_user_rendering(players[i], kRenderFxNone,0,0,0,kRenderTransAlpha,75)
  218. }
  219. else if (cs_get_user_team(players[i]) == CS_TEAM_T)
  220. {
  221. set_user_health(players[i],get_pcvar_num(alien_health))
  222. set_user_armor (players[i],get_pcvar_num(alien_armor))
  223. cs_set_user_model(players[i], "alien")
  224. }
  225. }
  226. }
  227. }
  228.  
  229. public resetWeapon(id)
  230. {
  231. static on
  232. on = get_pcvar_num(active)
  233. if(on == 1)
  234. {
  235. new weaponID = read_data(2)
  236. if (weaponID != CSW_KNIFE)
  237. return PLUGIN_HANDLED;
  238. if (get_user_team(id) == 1)
  239. {
  240. set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString,"models/AvsP/alienclaws.mdl")) // alien knife's
  241. }
  242. else if (get_user_team(id) == 2)
  243. {
  244. set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString,"models/AvsP/p_claws.mdl")) // predator knife's
  245. }
  246. }
  247.  
  248. return PLUGIN_CONTINUE
  249. }
  250. public fw_emitsound(id,channel,sample[],Float:volume,Float:attenuation,fFlags,pitch)
  251. {
  252. static on
  253. on = get_pcvar_num(active)
  254. if (get_user_team(id) == 1 && on == 1)
  255. {
  256.  
  257. if(equal(sample,"weapons/knife_slash1.wav")) {
  258. emit_sound(id,channel,gAlienSounds[5],volume,attenuation,fFlags,pitch);
  259. return FMRES_SUPERCEDE;
  260. }
  261.  
  262. if(equal(sample,"weapons/knife_slash2.wav")) {
  263. emit_sound(id,channel,gAlienSounds[5],volume,attenuation,fFlags,pitch);
  264. return FMRES_SUPERCEDE;
  265. }
  266.  
  267. if(equal(sample,"weapons/knife_hit1.wav")) {
  268. emit_sound(id,channel,gAlienSounds[3],volume,attenuation,fFlags,pitch);
  269. return FMRES_SUPERCEDE;
  270. }
  271.  
  272. if(equal(sample,"weapons/knife_hit2.wav")) {
  273. emit_sound(id,channel,gAlienSounds[3],volume,attenuation,fFlags,pitch);
  274. return FMRES_SUPERCEDE;
  275. }
  276.  
  277. if(equal(sample,"weapons/knife_hitwall1.wav")) {
  278. emit_sound(id,channel,gAlienSounds[4],volume,attenuation,fFlags,pitch);
  279. return FMRES_SUPERCEDE;
  280. }
  281.  
  282. if(equal(sample,"weapons/knife_hit3.wav")) {
  283. emit_sound(id,channel,gAlienSounds[3],volume,attenuation,fFlags,pitch);
  284. return FMRES_SUPERCEDE;
  285. }
  286.  
  287. if(equal(sample,"weapons/knife_stab.wav")) {
  288. emit_sound(id,channel,gAlienSounds[3],volume,attenuation,fFlags,pitch);
  289. return FMRES_SUPERCEDE;
  290. }
  291. }
  292.  
  293.  
  294. return FMRES_IGNORED;
  295. }
  296. public fw_emitsound2(id,channel,sample[],Float:volume,Float:attenuation,fFlags,pitch)
  297. {
  298. static on
  299. on = get_pcvar_num(active)
  300. if (get_user_team(id) == 2 && on == 1)
  301. {
  302.  
  303. if(equal(sample,"weapons/knife_slash1.wav")) {
  304. emit_sound(id,channel,gPredatoRSounds[1],volume,attenuation,fFlags,pitch);
  305. return FMRES_SUPERCEDE;
  306. }
  307.  
  308. if(equal(sample,"weapons/knife_slash2.wav")) {
  309. emit_sound(id,channel,gPredatoRSounds[1],volume,attenuation,fFlags,pitch);
  310. return FMRES_SUPERCEDE;
  311. }
  312.  
  313. if(equal(sample,"weapons/knife_hit1.wav")) {
  314. emit_sound(id,channel,gPredatoRSounds[2],volume,attenuation,fFlags,pitch);
  315. return FMRES_SUPERCEDE;
  316. }
  317.  
  318. if(equal(sample,"weapons/knife_hit2.wav")) {
  319. emit_sound(id,channel,gPredatoRSounds[2],volume,attenuation,fFlags,pitch);
  320. return FMRES_SUPERCEDE;
  321. }
  322.  
  323. if(equal(sample,"weapons/knife_hitwall1.wav")) {
  324. emit_sound(id,channel,gPredatoRSounds[3],volume,attenuation,fFlags,pitch);
  325. return FMRES_SUPERCEDE;
  326. }
  327.  
  328. if(equal(sample,"weapons/knife_stab.wav")) {
  329. emit_sound(id,channel,gPredatoRSounds[3],volume,attenuation,fFlags,pitch);
  330.  
  331. return FMRES_SUPERCEDE;
  332. }
  333. }
  334. return FMRES_IGNORED;
  335. }
  336. public oldskool()
  337. {
  338.  
  339. if(get_pcvar_num(active) != 1)
  340. return PLUGIN_CONTINUE;
  341.  
  342.  
  343. new killer = read_data (1)
  344. new victim = read_data (2)
  345. new killername[33], victimname[33]
  346. get_user_name(killer,killername,33)
  347. get_user_name(victim,victimname,33)
  348. set_hudmessage (0, 255, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
  349. show_hudmessage (0,"%s silent killed %s!",killername, victimname )
  350.  
  351. return PLUGIN_CONTINUE;
  352. }
  353.  
  354. public client_PreThink(id)
  355. {
  356. static on
  357. on = get_pcvar_num(active)
  358. if(on == 1)
  359. {
  360. if(cs_get_user_team(id) == CS_TEAM_T)
  361. {
  362. new clip,ammo
  363. entity_set_float(id,EV_FL_fuser2,0.0)
  364. set_user_maxspeed(id,475.0)
  365. client_cmd(id,"cl_forwardspeed 475;cl_backspeed 475;cl_sidespeed 475")
  366. if(get_user_weapon(id,clip,ammo)!=CSW_KNIFE)
  367. {
  368. client_cmd(id,"weapon_knife")
  369. }
  370. }
  371. else if(cs_get_user_team(id) == CS_TEAM_CT)
  372. {
  373. new clip,ammo
  374. set_user_maxspeed(id,450.0)
  375. client_cmd(id,"cl_forwardspeed 450;cl_backspeed 450;cl_sidespeed 450")
  376. if(get_user_weapon(id,clip,ammo)!=CSW_KNIFE)
  377. {
  378. client_cmd(id,"weapon_knife")
  379. }
  380. }
  381. }
  382. }
  383.  
  384. public GameDesc()
  385. {
  386. if(get_pcvar_num(active) != 1)
  387. return PLUGIN_CONTINUE;
  388.  
  389. forward_return(FMV_STRING, mod_name)
  390.  
  391. return FMRES_SUPERCEDE
  392. }
  393.  
  394. public AlienInfoMotd(id){
  395. if(get_pcvar_num(active) != 1)
  396. return PLUGIN_CONTINUE;
  397. show_motd(id,"addons/amxmodx/configs/alien.txt")
  398. return PLUGIN_CONTINUE;
  399. }
  400.  
  401. public PredatorInfoMotd(id){
  402. if(get_pcvar_num(active) != 1)
  403. return PLUGIN_CONTINUE;
  404. show_motd(id,"addons/amxmodx/configs/predator.txt")
  405. return PLUGIN_CONTINUE;
  406. }
  407.  
  408. public roundstart() {
  409. if(get_pcvar_num(active) != 1)
  410. return PLUGIN_CONTINUE;
  411. client_print(0, print_chat, "%L","LANG_PLAYER","ALIEN_INFO");
  412. client_print(0, print_chat, "%L","LANG_PLAYER","PREDATOR_INFO");
  413. client_print(0, print_chat, "[AvsP] Plugin Created By : PoSiTiOn Of PoWeR & Hack");
  414.  
  415.  
  416. return PLUGIN_HANDLED
  417. }
  418.  
  419. // Predatow Win MSG
  420. public ctwin()
  421. {
  422. if(get_pcvar_num(active) != 1)
  423. return PLUGIN_CONTINUE;
  424. client_print(0, print_chat, "%L","LANG_PLAYER","PREDATOR_WIN");
  425.  
  426. set_hudmessage(170, 170, 255, 0.13, 0.14, 0, 6.0, 12.0)
  427. show_hudmessage(0, "%L","LANG_PLAYER","PREDATOR_WIN")
  428.  
  429. return PLUGIN_CONTINUE;
  430. }
  431.  
  432. // Alien Win MSG
  433. public twin()
  434. {
  435. if(get_pcvar_num(active) != 1)
  436. return PLUGIN_CONTINUE;
  437.  
  438. client_print(0, print_chat, "%L","LANG_PLAYER","ALIEN_WIN");
  439.  
  440. set_hudmessage(255, 0, 0, 0.13, 0.14, 0, 6.0, 12.0)
  441. show_hudmessage(0, "%L","LANG_PLAYER","ALIEN_WIN")
  442.  
  443. return PLUGIN_CONTINUE;
  444. }