hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.04.30. 17:57



Jelenlévő felhasználók

Jelenleg 299 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 299 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  [ 3 hozzászólás ] 
Szerző Üzenet
HozzászólásElküldve: 2013.05.01. 17:26 
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 ebből a pluginból ki tudná szedni azt,
hogy ne csak 1 körönként lehessen választani, hanem egy körben több szőr is.
Mert most csak körönként egyszer lehet:
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <fun>
  4. #include <engine>
  5. #include <hamsandwich>
  6. #include <zombieplague>
  7.  
  8. #define PLUGIN "Choose knifes"
  9. #define VERSION "1.0"
  10. #define AUTHOR "CHyC/4e/l"
  11.  
  12. #define VIP ADMIN_LEVEL_H
  13. #define MAXPLAYERS 32
  14.  
  15. new combat_v_model[] = "models/zb/v_combat_knife.mdl"
  16. new combat_p_model[] = "models/zb/p_combat_knife.mdl"
  17.  
  18. new strong_v_model[] = "models/zb/v_strong_knife.mdl"
  19. new strong_p_model[] = "models/zb/p_strong_knife.mdl"
  20.  
  21. new axe_v_model[] = "models/zb/v_pfire_knife.mdl"
  22. new axe_p_model[] = "models/zb/p_pfire_knife.mdl"
  23.  
  24. new katana_v_model[] = "models/zb/v_katana_knife.mdl"
  25. new katana_p_model[] = "models/zb/p_katana_knife.mdl"
  26.  
  27. new hammer_v_model[] = "models/zb/v_hammer_knife.mdl"
  28. new hammer_p_model[] = "models/zb/p_hammer_knife.mdl"
  29.  
  30. const m_pPlayer = 41
  31. const m_flNextPrimaryAttack = 46
  32. const m_flNextSecondaryAttack = 47
  33. const m_flTimeWeaponIdle = 48
  34.  
  35. new g_hasSpeed[33], SayText
  36. new bool:g_WasShowed[MAXPLAYERS + 1]
  37. new g_knife_combat[33], cvar_knife_combat_jump, cvar_knife_combat_spd, cvar_knife_combat_dmg, cvar_knife_combat_knock, cvar_knife_combat_spd_attack2
  38. new g_knife_strong[33], cvar_knife_strong_jump, cvar_knife_strong_spd, cvar_knife_strong_dmg, cvar_knife_strong_knock, cvar_knife_strong_spd_attack2
  39. new g_knife_axe[33], cvar_knife_axe_jump, cvar_knife_axe_spd, cvar_knife_axe_dmg, cvar_knife_axe_knock, cvar_knife_axe_spd_attack2
  40. new g_knife_katana[33], cvar_knife_katana_jump, cvar_knife_katana_spd, cvar_knife_katana_dmg, cvar_knife_katana_knock, cvar_knife_katana_spd_attack2
  41. new g_knife_hammer[33], cvar_knife_hammer_jump, cvar_knife_hammer_spd, cvar_knife_hammer_dmg, cvar_knife_hammer_knock, cvar_hammer_spd_attack2
  42.  
  43. new const g_sound_knife[] = { "items/gunpickup2.wav" }
  44.  
  45. new const combat_sounds[][] =
  46. {
  47. "zmwpn/zb_knife/combat_deploy.wav",
  48. "zmwpn/zb_knife/combat_hit.wav" ,
  49. "zmwpn/zb_knife/combat_hit.wav" ,
  50. "zmwpn/zb_knife/combat_hit.wav" ,
  51. "zmwpn/zb_knife/combat_hit.wav" ,
  52. "zmwpn/zb_knife/combat_hitwall.wav",
  53. "zmwpn/zb_knife/combat_slash.wav",
  54. "zmwpn/zb_knife/combat_slash.wav",
  55. "zmwpn/zb_knife/combat_stab.wav"
  56. }
  57.  
  58. new const strong_sounds[][] =
  59. {
  60. "zmwpn/zb_knife/strong_deploy.wav",
  61. "zmwpn/zb_knife/strong_hit.wav",
  62. "zmwpn/zb_knife/strong_hit.wav",
  63. "zmwpn/zb_knife/strong_hit.wav",
  64. "zmwpn/zb_knife/strong_hit.wav",
  65. "zmwpn/zb_knife/strong_hitwall.wav",
  66. "zmwpn/zb_knife/strong_slash.wav",
  67. "zmwpn/zb_knife/strong_slash.wav",
  68. "zmwpn/zb_knife/strong_stab.wav"
  69. }
  70.  
  71. new const axe_sounds[][] =
  72. {
  73. "zmwpn/zb_knife/pfireknife_deploy.wav",
  74. "zmwpn/zb_knife/pfireknife_hit.wav",
  75. "zmwpn/zb_knife/pfireknife_hit.wav",
  76. "zmwpn/zb_knife/pfireknife_hit.wav",
  77. "zmwpn/zb_knife/pfireknife_hit.wav",
  78. "zmwpn/zb_knife/pfireknife_hitwall.wav",
  79. "zmwpn/zb_knife/pfireknife_slash.wav",
  80. "zmwpn/zb_knife/pfireknife_slash.wav",
  81. "zmwpn/zb_knife/pfireknife_stab.wav"
  82. }
  83.  
  84. new const katana_sounds[][] =
  85. {
  86. "zmwpn/zb_knife/katana_deploy.wav",
  87. "zmwpn/zb_knife/katana_hit.wav",
  88. "zmwpn/zb_knife/katana_hit.wav",
  89. "zmwpn/zb_knife/katana_hit.wav",
  90. "zmwpn/zb_knife/katana_hit.wav",
  91. "zmwpn/zb_knife/katana_hitwall.wav",
  92. "zmwpn/zb_knife/katana_slash.wav",
  93. "zmwpn/zb_knife/katana_slash.wav",
  94. "zmwpn/zb_knife/katana_stab.wav"
  95. }
  96.  
  97. new const hammer_sounds[][] =
  98. {
  99. "zmwpn/zb_knife/hammer_deploy.wav",
  100. "zmwpn/zb_knife/hammer_hit.wav",
  101. "zmwpn/zb_knife/hammer_hit.wav",
  102. "zmwpn/zb_knife/hammer_hit.wav",
  103. "zmwpn/zb_knife/hammer_hit.wav",
  104. "zmwpn/zb_knife/hammer_hitwall.wav",
  105. "zmwpn/zb_knife/hammer_slash.wav",
  106. "zmwpn/zb_knife/hammer_slash.wav",
  107. "zmwpn/zb_knife/hammer_stab.wav"
  108. }
  109.  
  110. new const oldknife_sounds[][] =
  111. {
  112. "weapons/knife_deploy1.wav",
  113. "weapons/knife_hit1.wav",
  114. "weapons/knife_hit2.wav",
  115. "weapons/knife_hit3.wav",
  116. "weapons/knife_hit4.wav",
  117. "weapons/knife_hitwall1.wav",
  118. "weapons/knife_slash1.wav",
  119. "weapons/knife_slash2.wav",
  120. "weapons/knife_stab.wav"
  121. }
  122.  
  123. public plugin_init()
  124. {
  125. register_plugin(PLUGIN , VERSION , AUTHOR);
  126. register_cvar("zp_addon_knife", VERSION, FCVAR_SERVER);
  127. SayText = get_user_msgid("SayText")
  128.  
  129. register_clcmd("say /knife","knife_menu",ADMIN_ALL,"knife_menu")
  130. register_clcmd("/knife","knife_menu",ADMIN_ALL,"knife_menu")
  131. register_clcmd("combat", "give_combat")
  132. register_clcmd("strong", "give_strong")
  133. register_clcmd("axe", "give_axe")
  134. register_clcmd("katana", "give_katana")
  135. register_clcmd("hammer", "give_hammer")
  136.  
  137. register_event("CurWeapon","checkWeapon","be","1=1");
  138. register_event("Damage" , "event_Damage" , "b" , "2>0");
  139.  
  140. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink");
  141. register_forward(FM_EmitSound, "fw_EmitSound");
  142.  
  143. register_message(get_user_msgid("DeathMsg"), "message_DeathMsg");
  144.  
  145. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
  146. RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fw_Knife_SecondaryAttack_Post", 1)
  147.  
  148. cvar_knife_combat_jump= register_cvar("zp_knife_combat_jump", "290.0");
  149. cvar_knife_combat_spd = register_cvar("zp_knife_combat_spd", "310.0");
  150. cvar_knife_combat_dmg = register_cvar("zp_knife_combat_dmg" , "5.0");
  151. cvar_knife_combat_knock = register_cvar("zp_knife_combat_knock" , "6.0");
  152. cvar_knife_combat_spd_attack2 = register_cvar("zp_knife_combat_spd_attack2" , "1.3");
  153.  
  154. cvar_knife_strong_jump= register_cvar("zp_knife_strong_jump", "290.0");
  155. cvar_knife_strong_spd = register_cvar("zp_knife_strong_spd", "270.0");
  156. cvar_knife_strong_dmg = register_cvar("zp_knife_strong_dmg" , "11.0");
  157. cvar_knife_strong_knock = register_cvar("zp_knife_strong_knock" , "8.0");
  158. cvar_knife_strong_spd_attack2 = register_cvar("zp_knife_strong_spd_attack2" , "1.8");
  159.  
  160. cvar_knife_axe_jump= register_cvar("zp_knife_axe_jump", "350.0");
  161. cvar_knife_axe_spd = register_cvar("zp_knife_axe_spd", "270.0");
  162. cvar_knife_axe_dmg = register_cvar("zp_knife_axe_dmg" , "6.0");
  163. cvar_knife_axe_knock = register_cvar("zp_knife_axe_knock" , "6.0");
  164. cvar_knife_axe_spd_attack2 = register_cvar("zp_knife_axe_spd_attack2" , "1.5");
  165.  
  166. cvar_knife_katana_jump= register_cvar("zp_knife_katana_jump", "290.0");
  167. cvar_knife_katana_spd = register_cvar("zp_knife_katana_spd", "270.0");
  168. cvar_knife_katana_dmg = register_cvar("zp_knife_katana_dmg" , "5.5");
  169. cvar_knife_katana_knock = register_cvar("zp_knife_katana_knock" , "12.5");
  170. cvar_knife_katana_spd_attack2 = register_cvar("zp_knife_katana_spd_attack2" , "1.3");
  171.  
  172. cvar_knife_hammer_jump= register_cvar("zp_knife_hammer_jump", "320.0");
  173. cvar_knife_hammer_spd= register_cvar("zp_knife_hammer_spd", "300.0");
  174. cvar_knife_hammer_dmg = register_cvar("zp_knife_hammer_dmg" , "12.0");
  175. cvar_knife_hammer_knock = register_cvar("zp_knife_hammer_knock" , "13.0");
  176. cvar_hammer_spd_attack2 = register_cvar("zp_knife_hammer_spd_attack2" , "1.5");
  177.  
  178. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  179. }
  180.  
  181. public client_connect(id)
  182. {
  183. g_knife_combat[id] = false
  184. g_knife_strong[id] = false
  185. g_knife_axe[id] = false
  186. g_knife_katana[id] = false
  187. g_knife_hammer[id] = false
  188. g_hasSpeed[id] = false
  189. }
  190.  
  191. public client_disconnect(id)
  192. {
  193. g_knife_combat[id] = false
  194. g_knife_strong[id] = false
  195. g_knife_axe[id] = false
  196. g_knife_katana[id] = false
  197. g_knife_hammer[id] = false
  198. g_hasSpeed[id] = false
  199. }
  200.  
  201. public plugin_precache()
  202. {
  203. precache_model(combat_v_model)
  204. precache_model(combat_p_model)
  205. precache_model(strong_v_model)
  206. precache_model(strong_p_model)
  207. precache_model(axe_v_model)
  208. precache_model(axe_p_model)
  209. precache_model(katana_v_model)
  210. precache_model(katana_p_model)
  211. precache_model(hammer_v_model)
  212. precache_model(hammer_p_model)
  213.  
  214. precache_sound(g_sound_knife)
  215.  
  216. for(new i = 0; i < sizeof combat_sounds; i++)
  217. precache_sound(combat_sounds[i])
  218.  
  219. for(new i = 0; i < sizeof strong_sounds; i++)
  220. precache_sound(strong_sounds[i])
  221.  
  222. for(new i = 0; i < sizeof axe_sounds; i++)
  223. precache_sound(axe_sounds[i])
  224.  
  225. for(new i = 0; i < sizeof katana_sounds; i++)
  226. precache_sound(katana_sounds[i])
  227.  
  228. for(new i = 0; i < sizeof hammer_sounds; i++)
  229. precache_sound(hammer_sounds[i])
  230. }
  231.  
  232. public event_round_start(id)
  233. {
  234. for (new i; i < MAXPLAYERS + 1; i++)
  235. g_WasShowed[i] = false
  236. }
  237.  
  238. public knife_menu(id)
  239. {
  240. if (g_WasShowed[id])
  241. {
  242. print_col_chat(id, "^1[^4ZP^1]^x01 Kés menüt választáshoz, csak nyomd meg az ^4M ^1betűt!")
  243. return PLUGIN_HANDLED
  244. }
  245.  
  246. if(is_user_alive(id) && !zp_get_user_zombie(id))
  247. {
  248. my_menu(id)
  249. }
  250.  
  251. return PLUGIN_HANDLED
  252. }
  253.  
  254. public my_menu(id)
  255. {
  256. new menu = menu_create("\yJust Zombie Plauge. Válasz kést!", "menu_handler");
  257. menu_additem(menu, "\wCombat \d[ \yGyors futás +40 \d]", "1", 0);
  258. menu_additem(menu, "\wStrong \d[ \yErös ütés +50 \d]", "2", 0);
  259. menu_additem(menu, "\wBlade \d[ \yMagas Ugrás +45 \d]", "3", 0);
  260. menu_additem(menu, "\wKatana \d[ \yMagas Visszalökés +55 \d]", "4", 0);
  261. menu_additem(menu, "\rHammer \d[ \r. * VIP * . \d]", "5", ADMIN_LEVEL_H);
  262.  
  263. menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  264.  
  265. menu_display(id, menu, 0);
  266. }
  267.  
  268. public menu_handler(id, menu, item)
  269. {
  270. if( item == MENU_EXIT )
  271. {
  272. menu_destroy(menu);
  273. return PLUGIN_HANDLED;
  274. }
  275.  
  276. new data[6], iName[64];
  277. new access, callback;
  278.  
  279. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  280.  
  281. new key = str_to_num(data);
  282.  
  283. switch(key)
  284. {
  285. case 1:
  286. {
  287. give_combat(id)
  288. menu_destroy(menu);
  289. return PLUGIN_HANDLED
  290. }
  291. case 2:
  292. {
  293. give_strong(id)
  294. menu_destroy(menu);
  295. return PLUGIN_HANDLED
  296. }
  297. case 3:
  298. {
  299. give_axe(id)
  300. menu_destroy(menu);
  301. return PLUGIN_HANDLED
  302. }
  303. case 4:
  304. {
  305. give_katana(id)
  306. menu_destroy(menu);
  307. return PLUGIN_HANDLED
  308. }
  309. case 5:
  310. {
  311. set_user_armor(id, get_user_armor(id) + 50)
  312. give_hammer(id)
  313. menu_destroy(menu);
  314. return PLUGIN_HANDLED
  315. }
  316. }
  317. menu_destroy(menu);
  318. return PLUGIN_HANDLED
  319. }
  320.  
  321. public give_combat(id)
  322. {
  323. g_knife_combat[id] = true
  324. g_knife_strong[id] = false
  325. g_knife_axe[id] = false
  326. g_knife_katana[id] = false
  327. g_knife_hammer[id] = false
  328. g_hasSpeed[id] = true
  329. g_WasShowed[id] = true
  330.  
  331. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  332. }
  333.  
  334. public give_strong(id)
  335. {
  336. g_knife_combat[id] = false
  337. g_knife_strong[id] = true
  338. g_knife_axe[id] = false
  339. g_knife_katana[id] = false
  340. g_knife_hammer[id] = false
  341. g_hasSpeed[id] = true
  342. g_WasShowed[id] = true
  343.  
  344. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  345. }
  346.  
  347. public give_axe(id)
  348. {
  349. g_knife_combat[id] = false
  350. g_knife_strong[id] = false
  351. g_knife_axe[id] = true
  352. g_knife_katana[id] = false
  353. g_knife_hammer[id] = false
  354. g_hasSpeed[id] = true
  355. g_WasShowed[id] = true
  356.  
  357. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  358. }
  359.  
  360. public give_katana(id)
  361. {
  362. g_knife_combat[id] = false
  363. g_knife_strong[id] = false
  364. g_knife_axe[id] = false
  365. g_knife_katana[id] = true
  366. g_knife_hammer[id] = false
  367. g_hasSpeed[id] = true
  368. g_WasShowed[id] = true
  369.  
  370. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  371. }
  372.  
  373.  
  374. public give_hammer(id)
  375. {
  376. if (get_user_flags(id) & VIP)
  377. {
  378. g_knife_combat[id] = false
  379. g_knife_strong[id] = false
  380. g_knife_axe[id] = false
  381. g_knife_katana[id] = false
  382. g_knife_hammer[id] = true
  383. g_hasSpeed[id] = true
  384. g_WasShowed[id] = true
  385.  
  386. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  387. }
  388. else
  389. {
  390. client_cmd(id, "/knife")
  391. g_WasShowed[id] = true
  392. }
  393. }
  394.  
  395. public checkWeapon(id)
  396. {
  397. new plrWeapId
  398.  
  399. plrWeapId = get_user_weapon(id)
  400.  
  401. if (plrWeapId == CSW_KNIFE && (g_knife_combat[id] || g_knife_strong[id] || g_knife_axe[id] || g_knife_katana[id] || g_knife_hammer[id]))
  402. {
  403. checkModel(id)
  404. }
  405. }
  406.  
  407. public checkModel(id)
  408. {
  409. if (zp_get_user_zombie(id))
  410. return PLUGIN_HANDLED
  411.  
  412. if (g_knife_combat[id])
  413. {
  414. set_pev(id, pev_viewmodel2, combat_v_model)
  415. set_pev(id, pev_weaponmodel2, combat_p_model)
  416. }
  417.  
  418. if (g_knife_strong[id])
  419. {
  420. set_pev(id, pev_viewmodel2, strong_v_model)
  421. set_pev(id, pev_weaponmodel2, strong_p_model)
  422. }
  423.  
  424. if (g_knife_axe[id])
  425. {
  426. set_pev(id, pev_viewmodel2, axe_v_model)
  427. set_pev(id, pev_weaponmodel2, axe_p_model)
  428. }
  429.  
  430. if (g_knife_katana[id])
  431. {
  432. set_pev(id, pev_viewmodel2, katana_v_model)
  433. set_pev(id, pev_weaponmodel2, katana_p_model)
  434. }
  435.  
  436. if (g_knife_hammer[id])
  437. {
  438. set_pev(id, pev_viewmodel2, hammer_v_model)
  439. set_pev(id, pev_weaponmodel2, hammer_p_model)
  440. }
  441. return PLUGIN_HANDLED
  442. }
  443.  
  444. public fw_EmitSound(id, channel, const sound[])
  445. {
  446. if(!is_user_alive(id) || zp_get_user_zombie(id))
  447. return FMRES_IGNORED
  448.  
  449. for(new i = 0; i < sizeof combat_sounds; i++)
  450. for(new i = 0; i < sizeof strong_sounds; i++)
  451. for(new i = 0; i < sizeof axe_sounds; i++)
  452. for(new i = 0; i < sizeof katana_sounds; i++)
  453. for(new i = 0; i < sizeof hammer_sounds; i++)
  454. {
  455. if(equal(sound, oldknife_sounds[i]))
  456. {
  457. if (g_knife_combat[id])
  458. {
  459. emit_sound(id, channel, combat_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  460. return FMRES_SUPERCEDE
  461. }
  462. if (g_knife_strong[id])
  463. {
  464. emit_sound(id, channel, strong_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  465. return FMRES_SUPERCEDE
  466. }
  467. if (g_knife_axe[id])
  468. {
  469. emit_sound(id, channel, axe_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  470. return FMRES_SUPERCEDE
  471. }
  472. if (g_knife_katana[id])
  473. {
  474. emit_sound(id, channel, katana_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  475. return FMRES_SUPERCEDE
  476. }
  477. if (g_knife_hammer[id])
  478. {
  479. emit_sound(id, channel, hammer_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  480. return FMRES_SUPERCEDE
  481. }
  482. if (!g_knife_combat[id] || !g_knife_strong[id] || !g_knife_axe[id] || !g_knife_katana[id] || !g_knife_hammer[id])
  483. {
  484. emit_sound(id, channel, oldknife_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  485. return FMRES_SUPERCEDE
  486. }
  487. }
  488. }
  489. return FMRES_IGNORED
  490. }
  491.  
  492. public message_DeathMsg(msg_id, msg_dest, id)
  493. {
  494. static szTruncatedWeapon[33], iattacker, ivictim
  495.  
  496. get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  497.  
  498. iattacker = get_msg_arg_int(1)
  499. ivictim = get_msg_arg_int(2)
  500.  
  501. if(!is_user_connected(iattacker) || iattacker == ivictim)
  502. return PLUGIN_CONTINUE
  503.  
  504. if (!zp_get_user_zombie(iattacker))
  505. {
  506. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  507. {
  508. if(g_knife_combat[iattacker])
  509. set_msg_arg_string(4, "Combat knife")
  510. }
  511.  
  512. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  513. {
  514. if(g_knife_strong[iattacker])
  515. set_msg_arg_string(4, "Strong knife")
  516. }
  517.  
  518. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  519. {
  520. if(g_knife_axe[iattacker])
  521. set_msg_arg_string(4, "Blade knife")
  522. }
  523.  
  524. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  525. {
  526. if(g_knife_katana[iattacker])
  527. set_msg_arg_string(4, "Katana knife")
  528. }
  529.  
  530. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  531. {
  532. if(g_knife_hammer[iattacker])
  533. set_msg_arg_string(4, "Ice knife")
  534. }
  535. }
  536. return PLUGIN_CONTINUE
  537. }
  538.  
  539. stock print_col_chat(const id, const input[], any:...)
  540. {
  541. new count = 1, players[32];
  542. static msg[191];
  543. vformat(msg, 190, input, 3);
  544. replace_all(msg, 190, "!g", "^4"); // Green Color
  545. replace_all(msg, 190, "!y", "^1"); // Default Color
  546. replace_all(msg, 190, "!t", "^3"); // Team Color
  547. if (id) players[0] = id; else get_players(players, count, "ch");
  548. {
  549. for ( new i = 0; i < count; i++ )
  550. {
  551. if ( is_user_connected(players[i]) )
  552. {
  553. message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i]);
  554. write_byte(players[i]);
  555. write_string(msg);
  556. message_end();
  557. }
  558. }
  559. }
  560. }
  561.  
  562. public fw_PlayerPreThink(id)
  563. {
  564. if(!is_user_alive(id) || zp_get_user_zombie(id))
  565. return FMRES_IGNORED
  566.  
  567. new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
  568.  
  569. if (weapon == CSW_KNIFE && g_knife_combat[id])
  570. {
  571. g_hasSpeed[id] = true
  572. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_combat_spd))
  573. }
  574.  
  575. if(weapon == CSW_KNIFE && g_knife_combat[id])
  576. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  577. {
  578. new flags = pev(id, pev_flags)
  579. new waterlvl = pev(id, pev_waterlevel)
  580.  
  581. if (!(flags & FL_ONGROUND))
  582. return FMRES_IGNORED
  583.  
  584. if (flags & FL_WATERJUMP)
  585. return FMRES_IGNORED
  586.  
  587. if (waterlvl > 1)
  588. return FMRES_IGNORED
  589.  
  590. new Float:fVelocity[3]
  591. pev(id, pev_velocity, fVelocity)
  592.  
  593. fVelocity[2] += get_pcvar_num(cvar_knife_combat_jump)
  594.  
  595. set_pev(id, pev_velocity, fVelocity)
  596. set_pev(id, pev_gaitsequence, 6)
  597. }
  598. if (weapon == CSW_KNIFE && g_knife_strong[id])
  599. {
  600. g_hasSpeed[id] = true
  601. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_strong_spd))
  602.  
  603. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  604. {
  605. new flags = pev(id, pev_flags)
  606. new waterlvl = pev(id, pev_waterlevel)
  607.  
  608. if (!(flags & FL_ONGROUND))
  609. return FMRES_IGNORED
  610.  
  611. if (flags & FL_WATERJUMP)
  612. return FMRES_IGNORED
  613.  
  614. if (waterlvl > 1)
  615. return FMRES_IGNORED
  616.  
  617. new Float:fVelocity[3]
  618. pev(id, pev_velocity, fVelocity)
  619.  
  620. fVelocity[2] += get_pcvar_num(cvar_knife_strong_jump)
  621.  
  622. set_pev(id, pev_velocity, fVelocity)
  623. set_pev(id, pev_gaitsequence, 6)
  624. }
  625. }
  626. if (weapon == CSW_KNIFE && g_knife_axe[id])
  627. {
  628. g_hasSpeed[id] = true
  629. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_axe_spd))
  630.  
  631. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  632. {
  633. new flags = pev(id, pev_flags)
  634. new waterlvl = pev(id, pev_waterlevel)
  635.  
  636. if (!(flags & FL_ONGROUND))
  637. return FMRES_IGNORED
  638.  
  639. if (flags & FL_WATERJUMP)
  640. return FMRES_IGNORED
  641.  
  642. if (waterlvl > 1)
  643. return FMRES_IGNORED
  644.  
  645. new Float:fVelocity[3]
  646. pev(id, pev_velocity, fVelocity)
  647.  
  648. fVelocity[2] += get_pcvar_num(cvar_knife_axe_jump)
  649.  
  650. set_pev(id, pev_velocity, fVelocity)
  651. set_pev(id, pev_gaitsequence, 6)
  652. }
  653. }
  654. if (weapon == CSW_KNIFE && g_knife_katana[id])
  655. {
  656. g_hasSpeed[id] = true
  657. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_katana_spd))
  658.  
  659. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  660. {
  661. new flags = pev(id, pev_flags)
  662. new waterlvl = pev(id, pev_waterlevel)
  663.  
  664. if (!(flags & FL_ONGROUND))
  665. return FMRES_IGNORED
  666.  
  667. if (flags & FL_WATERJUMP)
  668. return FMRES_IGNORED
  669.  
  670. if (waterlvl > 1)
  671. return FMRES_IGNORED
  672.  
  673. new Float:fVelocity[3]
  674. pev(id, pev_velocity, fVelocity)
  675.  
  676. fVelocity[2] += get_pcvar_num(cvar_knife_katana_jump)
  677.  
  678. set_pev(id, pev_velocity, fVelocity)
  679. set_pev(id, pev_gaitsequence, 6)
  680. }
  681. }
  682. if (weapon == CSW_KNIFE && g_knife_hammer[id])
  683. {
  684. g_hasSpeed[id] = true
  685. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_hammer_spd))
  686.  
  687. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  688. {
  689. new flags = pev(id, pev_flags)
  690. new waterlvl = pev(id, pev_waterlevel)
  691.  
  692. if (!(flags & FL_ONGROUND))
  693. return FMRES_IGNORED
  694.  
  695. if (flags & FL_WATERJUMP)
  696. return FMRES_IGNORED
  697.  
  698. if (waterlvl > 1)
  699. return FMRES_IGNORED
  700.  
  701. new Float:fVelocity[3]
  702. pev(id, pev_velocity, fVelocity)
  703.  
  704. fVelocity[2] += get_pcvar_num(cvar_knife_hammer_jump)
  705.  
  706. set_pev(id, pev_velocity, fVelocity)
  707. set_pev(id, pev_gaitsequence, 6)
  708. }
  709. }
  710. return FMRES_IGNORED
  711. }
  712.  
  713. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
  714. {
  715. if(!is_user_connected(attacker))
  716. return HAM_IGNORED
  717.  
  718. if(zp_get_user_zombie(attacker))
  719. return HAM_IGNORED
  720.  
  721. new weapon = get_user_weapon(attacker)
  722.  
  723. if (weapon == CSW_KNIFE && g_knife_combat[attacker])
  724. {
  725. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_combat_dmg))
  726. }
  727. if (weapon == CSW_KNIFE && g_knife_strong[attacker])
  728. {
  729. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_strong_dmg))
  730. }
  731. if (weapon == CSW_KNIFE && g_knife_axe[attacker])
  732. {
  733. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_axe_dmg))
  734. }
  735. if (weapon == CSW_KNIFE && g_knife_katana[attacker])
  736. {
  737. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_katana_dmg))
  738. }
  739.  
  740. if (weapon == CSW_KNIFE && g_knife_hammer[attacker])
  741. {
  742. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_hammer_dmg))
  743. }
  744.  
  745. return HAM_IGNORED
  746. }
  747.  
  748. public fw_Knife_SecondaryAttack_Post(knife)
  749. {
  750. static id
  751. id = get_pdata_cbase(knife, m_pPlayer, 4)
  752.  
  753. if(zp_get_user_zombie(id))
  754. return HAM_IGNORED
  755.  
  756. if(is_user_connected(id) && g_knife_combat[id])
  757. {
  758. static Float:flRate
  759. flRate = get_pcvar_float(cvar_knife_combat_spd_attack2)
  760.  
  761. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  762. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  763. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  764. }
  765.  
  766. if(is_user_connected(id) && g_knife_strong[id])
  767. {
  768. static Float:flRate
  769. flRate = get_pcvar_float(cvar_knife_strong_spd_attack2)
  770.  
  771. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  772. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  773. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  774. }
  775.  
  776. if(is_user_connected(id) && g_knife_axe[id])
  777. {
  778. static Float:flRate
  779. flRate = get_pcvar_float(cvar_knife_axe_spd_attack2)
  780.  
  781. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  782. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  783. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  784. }
  785.  
  786. if(is_user_connected(id) && g_knife_katana[id])
  787. {
  788. static Float:flRate
  789. flRate = get_pcvar_float(cvar_knife_katana_spd_attack2)
  790.  
  791. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  792. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  793. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  794. }
  795.  
  796. if(is_user_connected(id) && g_knife_hammer[id])
  797. {
  798. static Float:flRate
  799. flRate = get_pcvar_float(cvar_hammer_spd_attack2)
  800.  
  801. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  802. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  803. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  804. }
  805.  
  806. return HAM_IGNORED
  807. }
  808.  
  809. public event_Damage(id)
  810. {
  811. new weapon , attacker = get_user_attacker(id , weapon);
  812.  
  813. if(!is_user_alive(attacker))
  814. return PLUGIN_CONTINUE;
  815.  
  816. if(weapon == CSW_KNIFE && g_knife_combat[attacker])
  817. {
  818. new Float:vec[3];
  819. new Float:oldvelo[3];
  820. get_user_velocity(id, oldvelo);
  821. create_velocity_vector(id , attacker , vec);
  822. vec[0] += oldvelo[0];
  823. vec[1] += oldvelo[1];
  824. set_user_velocity(id , vec);
  825. }
  826.  
  827. if(weapon == CSW_KNIFE && g_knife_strong[attacker])
  828. {
  829. new Float:vec[3];
  830. new Float:oldvelo[3];
  831. get_user_velocity(id, oldvelo);
  832. create_velocity_vector(id , attacker , vec);
  833. vec[0] += oldvelo[0];
  834. vec[1] += oldvelo[1];
  835. set_user_velocity(id , vec);
  836. }
  837.  
  838. if(weapon == CSW_KNIFE && g_knife_axe[attacker])
  839. {
  840. new Float:vec[3];
  841. new Float:oldvelo[3];
  842. get_user_velocity(id, oldvelo);
  843. create_velocity_vector(id , attacker , vec);
  844. vec[0] += oldvelo[0];
  845. vec[1] += oldvelo[1];
  846. set_user_velocity(id , vec);
  847. }
  848.  
  849. if(weapon == CSW_KNIFE && g_knife_katana[attacker])
  850. {
  851. new Float:vec[3];
  852. new Float:oldvelo[3];
  853. get_user_velocity(id, oldvelo);
  854. create_velocity_vector(id , attacker , vec);
  855. vec[0] += oldvelo[0];
  856. vec[1] += oldvelo[1];
  857. set_user_velocity(id , vec);
  858. }
  859.  
  860. if(weapon == CSW_KNIFE && g_knife_hammer[attacker])
  861. {
  862. new Float:vec[3];
  863. new Float:oldvelo[3];
  864. get_user_velocity(id, oldvelo);
  865. create_velocity_vector(id , attacker , vec);
  866. vec[0] += oldvelo[0];
  867. vec[1] += oldvelo[1];
  868. set_user_velocity(id , vec);
  869. }
  870.  
  871. return PLUGIN_CONTINUE;
  872. }
  873.  
  874. stock create_velocity_vector(victim,attacker,Float:velocity[3])
  875. {
  876. if(!zp_get_user_zombie(victim) || !is_user_alive(attacker))
  877. return 0;
  878.  
  879. new Float:vicorigin[3];
  880. new Float:attorigin[3];
  881. entity_get_vector(victim , EV_VEC_origin , vicorigin);
  882. entity_get_vector(attacker , EV_VEC_origin , attorigin);
  883.  
  884. new Float:origin2[3]
  885. origin2[0] = vicorigin[0] - attorigin[0];
  886. origin2[1] = vicorigin[1] - attorigin[1];
  887.  
  888. new Float:largestnum = 0.0;
  889.  
  890. if(floatabs(origin2[0])>largestnum) largestnum = floatabs(origin2[0]);
  891. if(floatabs(origin2[1])>largestnum) largestnum = floatabs(origin2[1]);
  892.  
  893. origin2[0] /= largestnum;
  894. origin2[1] /= largestnum;
  895.  
  896. if (g_knife_combat[attacker])
  897. {
  898. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_combat_knock) * 3000) ) / get_entity_distance(victim , attacker);
  899. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_combat_knock) * 3000) ) / get_entity_distance(victim , attacker);
  900. }
  901.  
  902. if (g_knife_strong[attacker])
  903. {
  904. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_strong_knock) * 3000) ) / get_entity_distance(victim , attacker);
  905. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_strong_knock) * 3000) ) / get_entity_distance(victim , attacker);
  906. }
  907.  
  908. if (g_knife_axe[attacker])
  909. {
  910. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_axe_knock) * 3000) ) / get_entity_distance(victim , attacker);
  911. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_axe_knock) * 3000) ) / get_entity_distance(victim , attacker);
  912. }
  913.  
  914. if (g_knife_katana[attacker])
  915. {
  916. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_katana_knock) * 3000) ) / get_entity_distance(victim , attacker);
  917. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_katana_knock) * 3000) ) / get_entity_distance(victim , attacker);
  918. }
  919.  
  920. if (g_knife_hammer[attacker])
  921. {
  922. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_hammer_knock) * 3000) ) / get_entity_distance(victim , attacker);
  923. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_hammer_knock) * 3000) ) / get_entity_distance(victim , attacker);
  924. }
  925.  
  926. if(velocity[0] <= 20.0 || velocity[1] <= 20.0)
  927. velocity[2] = random_float(200.0 , 275.0);
  928.  
  929. return 1;
  930. }
  931.  
  932. public client_putinserver(id)
  933. {
  934. switch(random_num(0, 0))
  935. {
  936. case 0:
  937. {
  938. g_knife_combat[id] = true
  939. g_hasSpeed[id] = true
  940. }
  941.  
  942. }
  943. }


A másik kérdésem meg, hogy azt, hogy tudom meg csinálni:

-Kicseréltem a zm módnál a lézer kiszabadítást a kés választásra,
És azt, hogy csináljam meg, hogy be is adja a kés választás menüt?
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #define LIBRARY_BUYMENUS "zp50_buy_menus"
  5. #include <zp50_buy_menus>
  6. #define LIBRARY_ZOMBIECLASSES "zp50_class_zombie"
  7. #include <zp50_class_zombie>
  8. #define LIBRARY_HUMANCLASSES "zp50_class_human"
  9. #include <zp50_class_human>
  10. #define LIBRARY_ITEMS "zp50_items"
  11. #include <zp50_items>
  12. #define LIBRARY_ADMIN_MENU "zp50_admin_menu"
  13. #include <zp50_admin_menu>
  14. #define LIBRARY_RANDOMSPAWN "zp50_random_spawn"
  15. #include <zp50_random_spawn>
  16. #include <zp50_colorchat>
  17.  
  18. #define TASK_WELCOMEMSG 100
  19.  
  20. // CS Player PData Offsets (win32)
  21. const OFFSET_CSMENUCODE = 205
  22.  
  23. // Menu keys
  24. const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0
  25.  
  26. #define flag_get(%1,%2) (%1 & (1 << (%2 & 31)))
  27. #define flag_get_boolean(%1,%2) (flag_get(%1,%2) ? true : false)
  28. #define flag_set(%1,%2) %1 |= (1 << (%2 & 31))
  29. #define flag_unset(%1,%2) %1 &= ~(1 << (%2 & 31))
  30.  
  31. new g_ChooseTeamOverrideActive
  32.  
  33. new cvar_buy_custom_primary, cvar_buy_custom_secondary, cvar_buy_custom_grenades
  34. new cvar_random_spawning
  35.  
  36. public plugin_init()
  37. {
  38. register_plugin("[ZP] Main Menu", ZP_VERSION_STRING, "ZP Dev Team")
  39.  
  40. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  41.  
  42. register_clcmd("chooseteam", "clcmd_chooseteam")
  43.  
  44. register_clcmd("say /zpmenu", "clcmd_zpmenu")
  45. register_clcmd("say zpmenu", "clcmd_zpmenu")
  46.  
  47. // Menus
  48. register_menu("Main Menu", KEYSMENU, "menu_main")
  49. }
  50.  
  51. public plugin_natives()
  52. {
  53. set_module_filter("module_filter")
  54. set_native_filter("native_filter")
  55. }
  56. public module_filter(const module[])
  57. {
  58. if (equal(module, LIBRARY_BUYMENUS) || equal(module, LIBRARY_ZOMBIECLASSES) || equal(module, LIBRARY_HUMANCLASSES) || equal(module, LIBRARY_ITEMS) || equal(module, LIBRARY_ADMIN_MENU) || equal(module, LIBRARY_RANDOMSPAWN))
  59. return PLUGIN_HANDLED;
  60.  
  61. return PLUGIN_CONTINUE;
  62. }
  63. public native_filter(const name[], index, trap)
  64. {
  65. if (!trap)
  66. return PLUGIN_HANDLED;
  67.  
  68. return PLUGIN_CONTINUE;
  69. }
  70.  
  71. public plugin_cfg()
  72. {
  73. cvar_buy_custom_primary = get_cvar_pointer("zp_buy_custom_primary")
  74. cvar_buy_custom_secondary = get_cvar_pointer("zp_buy_custom_secondary")
  75. cvar_buy_custom_grenades = get_cvar_pointer("zp_buy_custom_grenades")
  76. cvar_random_spawning = get_cvar_pointer("zp_random_spawning_csdm")
  77. }
  78.  
  79. // Event Round Start
  80. public event_round_start()
  81. {
  82. // Show main menu message
  83. remove_task(TASK_WELCOMEMSG)
  84. set_task(2.0, "task_welcome_msg", TASK_WELCOMEMSG)
  85. }
  86.  
  87. // Welcome Message Task
  88. public task_welcome_msg()
  89. {
  90. zp_colored_print(0, "==== ^4Zombie Plague ^3%s^1 ====", ZP_VERSION_STR_LONG)
  91. zp_colored_print(0, "==== ^4Config by: ^3A* & Danii^1 ====")
  92. zp_colored_print(0, "%L", LANG_PLAYER, "NOTICE_INFO1")
  93. }
  94.  
  95. public clcmd_chooseteam(id)
  96. {
  97. if (flag_get(g_ChooseTeamOverrideActive, id))
  98. {
  99. show_menu_main(id)
  100. return PLUGIN_HANDLED;
  101. }
  102.  
  103. flag_set(g_ChooseTeamOverrideActive, id)
  104. return PLUGIN_CONTINUE;
  105. }
  106.  
  107. public clcmd_zpmenu(id)
  108. {
  109. show_menu_main(id)
  110. }
  111.  
  112. public client_putinserver(id)
  113. {
  114. flag_set(g_ChooseTeamOverrideActive, id)
  115. }
  116.  
  117. // Main Menu
  118. show_menu_main(id)
  119. {
  120. static menu[250]
  121. new len
  122.  
  123. // Title
  124. len += formatex(menu[len], charsmax(menu) - len, "\yJust Zombie Plague \r%s^n^n", ZP_VERSION_STR_LONG)
  125.  
  126. // 1. Buy menu
  127. if (LibraryExists(LIBRARY_BUYMENUS, LibType_Library) && (get_pcvar_num(cvar_buy_custom_primary)
  128. || get_pcvar_num(cvar_buy_custom_secondary) || get_pcvar_num(cvar_buy_custom_grenades)) && is_user_alive(id))
  129. len += formatex(menu[len], charsmax(menu) - len, "\r1.\w %L^n", id, "MENU_BUY")
  130. else
  131. len += formatex(menu[len], charsmax(menu) - len, "\d1. %L^n", id, "MENU_BUY")
  132.  
  133. // 2. Extra Items
  134. if (LibraryExists(LIBRARY_ITEMS, LibType_Library) && is_user_alive(id))
  135. len += formatex(menu[len], charsmax(menu) - len, "\r2.\w %L^n", id, "MENU_EXTRABUY")
  136. else
  137. len += formatex(menu[len], charsmax(menu) - len, "\d2. %L^n", id, "MENU_EXTRABUY")
  138.  
  139. // 3. Zombie class
  140. if (LibraryExists(LIBRARY_ZOMBIECLASSES, LibType_Library) && zp_class_zombie_get_count() > 1)
  141. len += formatex(menu[len], charsmax(menu) - len, "\r3.\w %L^n", id, "MENU_ZCLASS")
  142. else
  143. len += formatex(menu[len], charsmax(menu) - len, "\d3. %L^n", id, "MENU_ZCLASS")
  144.  
  145. // 4. Human class
  146. if (LibraryExists(LIBRARY_HUMANCLASSES, LibType_Library) && zp_class_human_get_count() > 1)
  147. len += formatex(menu[len], charsmax(menu) - len, "\r4.\w %L^n", id, "MENU_HCLASS")
  148. else
  149. len += formatex(menu[len], charsmax(menu) - len, "\d4. %L^n", id, "MENU_HCLASS")
  150.  
  151. // 5. knife choose
  152. if (LibraryExists(LIBRARY_RANDOMSPAWN, LibType_Library) && is_user_alive(id))
  153. len += formatex(menu[len], charsmax(menu) - len, "\r5.\w %L^n", id, "MENU_KNIFE")
  154. else
  155. len += formatex(menu[len], charsmax(menu) - len, "\d5. %L^n", id, "MENU_KNIFE")
  156.  
  157. // 6. Menu bind
  158. len += formatex(menu[len], charsmax(menu) - len, "\r6.\w %L^n^n", id, "MENU_BIND")
  159.  
  160. // 7. Choose Team
  161. len += formatex(menu[len], charsmax(menu) - len, "\r7.\w %L^n^n", id, "MENU_CHOOSE_TEAM")
  162.  
  163. // 9. Admin menu
  164. if (LibraryExists(LIBRARY_ADMIN_MENU, LibType_Library) && is_user_admin(id))
  165. len += formatex(menu[len], charsmax(menu) - len, "\r9.\w %L", id, "MENU_ADMIN")
  166. else
  167. len += formatex(menu[len], charsmax(menu) - len, "\d9. %L", id, "MENU_ADMIN")
  168.  
  169. // 0. Exit
  170. len += formatex(menu[len], charsmax(menu) - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
  171.  
  172. // Fix for AMXX custom menus
  173. set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  174. show_menu(id, KEYSMENU, menu, -1, "Main Menu")
  175. }
  176.  
  177. // Main Menu
  178. public menu_main(id, key)
  179. {
  180. // Player disconnected?
  181. if (!is_user_connected(id))
  182. return PLUGIN_HANDLED;
  183.  
  184. switch (key)
  185. {
  186. case 0: // Buy Menu
  187. {
  188. // Custom buy menus enabled?
  189. if (LibraryExists(LIBRARY_BUYMENUS, LibType_Library) && (get_pcvar_num(cvar_buy_custom_primary)
  190. || get_pcvar_num(cvar_buy_custom_secondary) || get_pcvar_num(cvar_buy_custom_grenades)))
  191. {
  192. // Check whether the player is able to buy anything
  193. if (is_user_alive(id))
  194. zp_buy_menus_show(id)
  195. else
  196. zp_colored_print(id, "%L", id, "CANT_BUY_WEAPONS_DEAD")
  197. }
  198. else
  199. zp_colored_print(id, "%L", id, "CUSTOM_BUY_DISABLED")
  200. }
  201. case 1: // Extra Items
  202. {
  203. // Items enabled?
  204. if (LibraryExists(LIBRARY_ITEMS, LibType_Library))
  205. {
  206. // Check whether the player is able to buy anything
  207. if (is_user_alive(id))
  208. zp_items_show_menu(id)
  209. else
  210. zp_colored_print(id, "%L", id, "CANT_BUY_ITEMS_DEAD")
  211. }
  212. else
  213. zp_colored_print(id, "%L", id, "CMD_NOT_EXTRAS")
  214. }
  215. case 2: // Zombie Classes
  216. {
  217. if (LibraryExists(LIBRARY_ZOMBIECLASSES, LibType_Library) && zp_class_zombie_get_count() > 1)
  218. zp_class_zombie_show_menu(id)
  219. else
  220. zp_colored_print(id, "%L", id, "CMD_NOT_ZCLASSES")
  221. }
  222. case 3: // Human Classes
  223. {
  224. if (LibraryExists(LIBRARY_HUMANCLASSES, LibType_Library) && zp_class_human_get_count() > 1)
  225. zp_class_human_show_menu(id)
  226. else
  227. zp_colored_print(id, "%L", id, "CMD_NOT_HCLASSES")
  228. }
  229. case 4:
  230. {
  231. // Check if player is stuck
  232. if (LibraryExists(LIBRARY_RANDOMSPAWN, LibType_Library) && is_user_alive(id))
  233. {
  234. if (is_player_stuck(id))
  235. {
  236. // Move to an initial spawn
  237. if (get_pcvar_num(cvar_random_spawning))
  238. zp_random_spawn_do(id, true) // random spawn (including CSDM)
  239. else
  240. zp_random_spawn_do(id, false) // regular spawn
  241. }
  242. else
  243. zp_colored_print(id, "%L", id, "CMD_NOT_STUCK")
  244. }
  245. else
  246. zp_colored_print(id, "%L", id, "CMD_NOT")
  247. }
  248. case 5: // Help Menu
  249. {
  250. show_menu_info(id)
  251. }
  252. case 6: // Menu override
  253. {
  254. flag_unset(g_ChooseTeamOverrideActive, id)
  255. client_cmd(id, "chooseteam")
  256. }
  257. case 8: // Admin Menu
  258. {
  259. if (LibraryExists(LIBRARY_ADMIN_MENU, LibType_Library) && is_user_admin(id))
  260. zp_admin_menu_show(id)
  261. else
  262. zp_colored_print(id, "%L", id, "NO_ADMIN_MENU")
  263. }
  264. }
  265.  
  266. return PLUGIN_HANDLED;
  267. }
  268.  
  269. // Help MOTD
  270. public show_menu_info(id)
  271. {
  272. client_cmd( id, "bind x +setlaser" );
  273. client_cmd( id, "bind c +dellaser" );
  274. }
  275.  
  276. // Check if a player is stuck (credits to VEN)
  277. stock is_player_stuck(id)
  278. {
  279. static Float:originF[3]
  280. pev(id, pev_origin, originF)
  281.  
  282. engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)
  283.  
  284. if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
  285. return true;
  286.  
  287. return false;
  288. }

_________________
****


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve: 2013.05.01. 17:53 
Offline
Őskövület
Avatar

Csatlakozott: 2011.09.17. 17:54
Hozzászólások: 2350
Megköszönt másnak: 40 alkalommal
Megköszönték neki: 57 alkalommal
1:

SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <fun>
  4. #include <engine>
  5. #include <hamsandwich>
  6. #include <zombieplague>
  7.  
  8. #define PLUGIN "Choose knifes"
  9. #define VERSION "1.0"
  10. #define AUTHOR "CHyC/4e/l"
  11.  
  12. #define VIP ADMIN_LEVEL_H
  13. #define MAXPLAYERS 32
  14.  
  15. new combat_v_model[] = "models/zb/v_combat_knife.mdl"
  16. new combat_p_model[] = "models/zb/p_combat_knife.mdl"
  17.  
  18. new strong_v_model[] = "models/zb/v_strong_knife.mdl"
  19. new strong_p_model[] = "models/zb/p_strong_knife.mdl"
  20.  
  21. new axe_v_model[] = "models/zb/v_pfire_knife.mdl"
  22. new axe_p_model[] = "models/zb/p_pfire_knife.mdl"
  23.  
  24. new katana_v_model[] = "models/zb/v_katana_knife.mdl"
  25. new katana_p_model[] = "models/zb/p_katana_knife.mdl"
  26.  
  27. new hammer_v_model[] = "models/zb/v_hammer_knife.mdl"
  28. new hammer_p_model[] = "models/zb/p_hammer_knife.mdl"
  29.  
  30. const m_pPlayer = 41
  31. const m_flNextPrimaryAttack = 46
  32. const m_flNextSecondaryAttack = 47
  33. const m_flTimeWeaponIdle = 48
  34.  
  35. new g_hasSpeed[33], SayText
  36. new g_knife_combat[33], cvar_knife_combat_jump, cvar_knife_combat_spd, cvar_knife_combat_dmg, cvar_knife_combat_knock, cvar_knife_combat_spd_attack2
  37. new g_knife_strong[33], cvar_knife_strong_jump, cvar_knife_strong_spd, cvar_knife_strong_dmg, cvar_knife_strong_knock, cvar_knife_strong_spd_attack2
  38. new g_knife_axe[33], cvar_knife_axe_jump, cvar_knife_axe_spd, cvar_knife_axe_dmg, cvar_knife_axe_knock, cvar_knife_axe_spd_attack2
  39. new g_knife_katana[33], cvar_knife_katana_jump, cvar_knife_katana_spd, cvar_knife_katana_dmg, cvar_knife_katana_knock, cvar_knife_katana_spd_attack2
  40. new g_knife_hammer[33], cvar_knife_hammer_jump, cvar_knife_hammer_spd, cvar_knife_hammer_dmg, cvar_knife_hammer_knock, cvar_hammer_spd_attack2
  41.  
  42. new const g_sound_knife[] = { "items/gunpickup2.wav" }
  43.  
  44. new const combat_sounds[][] =
  45. {
  46. "zmwpn/zb_knife/combat_deploy.wav",
  47. "zmwpn/zb_knife/combat_hit.wav" ,
  48. "zmwpn/zb_knife/combat_hit.wav" ,
  49. "zmwpn/zb_knife/combat_hit.wav" ,
  50. "zmwpn/zb_knife/combat_hit.wav" ,
  51. "zmwpn/zb_knife/combat_hitwall.wav",
  52. "zmwpn/zb_knife/combat_slash.wav",
  53. "zmwpn/zb_knife/combat_slash.wav",
  54. "zmwpn/zb_knife/combat_stab.wav"
  55. }
  56.  
  57. new const strong_sounds[][] =
  58. {
  59. "zmwpn/zb_knife/strong_deploy.wav",
  60. "zmwpn/zb_knife/strong_hit.wav",
  61. "zmwpn/zb_knife/strong_hit.wav",
  62. "zmwpn/zb_knife/strong_hit.wav",
  63. "zmwpn/zb_knife/strong_hit.wav",
  64. "zmwpn/zb_knife/strong_hitwall.wav",
  65. "zmwpn/zb_knife/strong_slash.wav",
  66. "zmwpn/zb_knife/strong_slash.wav",
  67. "zmwpn/zb_knife/strong_stab.wav"
  68. }
  69.  
  70. new const axe_sounds[][] =
  71. {
  72. "zmwpn/zb_knife/pfireknife_deploy.wav",
  73. "zmwpn/zb_knife/pfireknife_hit.wav",
  74. "zmwpn/zb_knife/pfireknife_hit.wav",
  75. "zmwpn/zb_knife/pfireknife_hit.wav",
  76. "zmwpn/zb_knife/pfireknife_hit.wav",
  77. "zmwpn/zb_knife/pfireknife_hitwall.wav",
  78. "zmwpn/zb_knife/pfireknife_slash.wav",
  79. "zmwpn/zb_knife/pfireknife_slash.wav",
  80. "zmwpn/zb_knife/pfireknife_stab.wav"
  81. }
  82.  
  83. new const katana_sounds[][] =
  84. {
  85. "zmwpn/zb_knife/katana_deploy.wav",
  86. "zmwpn/zb_knife/katana_hit.wav",
  87. "zmwpn/zb_knife/katana_hit.wav",
  88. "zmwpn/zb_knife/katana_hit.wav",
  89. "zmwpn/zb_knife/katana_hit.wav",
  90. "zmwpn/zb_knife/katana_hitwall.wav",
  91. "zmwpn/zb_knife/katana_slash.wav",
  92. "zmwpn/zb_knife/katana_slash.wav",
  93. "zmwpn/zb_knife/katana_stab.wav"
  94. }
  95.  
  96. new const hammer_sounds[][] =
  97. {
  98. "zmwpn/zb_knife/hammer_deploy.wav",
  99. "zmwpn/zb_knife/hammer_hit.wav",
  100. "zmwpn/zb_knife/hammer_hit.wav",
  101. "zmwpn/zb_knife/hammer_hit.wav",
  102. "zmwpn/zb_knife/hammer_hit.wav",
  103. "zmwpn/zb_knife/hammer_hitwall.wav",
  104. "zmwpn/zb_knife/hammer_slash.wav",
  105. "zmwpn/zb_knife/hammer_slash.wav",
  106. "zmwpn/zb_knife/hammer_stab.wav"
  107. }
  108.  
  109. new const oldknife_sounds[][] =
  110. {
  111. "weapons/knife_deploy1.wav",
  112. "weapons/knife_hit1.wav",
  113. "weapons/knife_hit2.wav",
  114. "weapons/knife_hit3.wav",
  115. "weapons/knife_hit4.wav",
  116. "weapons/knife_hitwall1.wav",
  117. "weapons/knife_slash1.wav",
  118. "weapons/knife_slash2.wav",
  119. "weapons/knife_stab.wav"
  120. }
  121.  
  122. public plugin_init()
  123. {
  124. register_plugin(PLUGIN , VERSION , AUTHOR);
  125. register_cvar("zp_addon_knife", VERSION, FCVAR_SERVER);
  126. SayText = get_user_msgid("SayText")
  127.  
  128. register_clcmd("say /knife","knife_menu",ADMIN_ALL,"knife_menu")
  129. register_clcmd("/knife","knife_menu",ADMIN_ALL,"knife_menu")
  130. register_clcmd("combat", "give_combat")
  131. register_clcmd("strong", "give_strong")
  132. register_clcmd("axe", "give_axe")
  133. register_clcmd("katana", "give_katana")
  134. register_clcmd("hammer", "give_hammer")
  135.  
  136. register_event("CurWeapon","checkWeapon","be","1=1");
  137. register_event("Damage" , "event_Damage" , "b" , "2>0");
  138.  
  139. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink");
  140. register_forward(FM_EmitSound, "fw_EmitSound");
  141.  
  142. register_message(get_user_msgid("DeathMsg"), "message_DeathMsg");
  143.  
  144. RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
  145. RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fw_Knife_SecondaryAttack_Post", 1)
  146.  
  147. cvar_knife_combat_jump= register_cvar("zp_knife_combat_jump", "290.0");
  148. cvar_knife_combat_spd = register_cvar("zp_knife_combat_spd", "310.0");
  149. cvar_knife_combat_dmg = register_cvar("zp_knife_combat_dmg" , "5.0");
  150. cvar_knife_combat_knock = register_cvar("zp_knife_combat_knock" , "6.0");
  151. cvar_knife_combat_spd_attack2 = register_cvar("zp_knife_combat_spd_attack2" , "1.3");
  152.  
  153. cvar_knife_strong_jump= register_cvar("zp_knife_strong_jump", "290.0");
  154. cvar_knife_strong_spd = register_cvar("zp_knife_strong_spd", "270.0");
  155. cvar_knife_strong_dmg = register_cvar("zp_knife_strong_dmg" , "11.0");
  156. cvar_knife_strong_knock = register_cvar("zp_knife_strong_knock" , "8.0");
  157. cvar_knife_strong_spd_attack2 = register_cvar("zp_knife_strong_spd_attack2" , "1.8");
  158.  
  159. cvar_knife_axe_jump= register_cvar("zp_knife_axe_jump", "350.0");
  160. cvar_knife_axe_spd = register_cvar("zp_knife_axe_spd", "270.0");
  161. cvar_knife_axe_dmg = register_cvar("zp_knife_axe_dmg" , "6.0");
  162. cvar_knife_axe_knock = register_cvar("zp_knife_axe_knock" , "6.0");
  163. cvar_knife_axe_spd_attack2 = register_cvar("zp_knife_axe_spd_attack2" , "1.5");
  164.  
  165. cvar_knife_katana_jump= register_cvar("zp_knife_katana_jump", "290.0");
  166. cvar_knife_katana_spd = register_cvar("zp_knife_katana_spd", "270.0");
  167. cvar_knife_katana_dmg = register_cvar("zp_knife_katana_dmg" , "5.5");
  168. cvar_knife_katana_knock = register_cvar("zp_knife_katana_knock" , "12.5");
  169. cvar_knife_katana_spd_attack2 = register_cvar("zp_knife_katana_spd_attack2" , "1.3");
  170.  
  171. cvar_knife_hammer_jump= register_cvar("zp_knife_hammer_jump", "320.0");
  172. cvar_knife_hammer_spd= register_cvar("zp_knife_hammer_spd", "300.0");
  173. cvar_knife_hammer_dmg = register_cvar("zp_knife_hammer_dmg" , "12.0");
  174. cvar_knife_hammer_knock = register_cvar("zp_knife_hammer_knock" , "13.0");
  175. cvar_hammer_spd_attack2 = register_cvar("zp_knife_hammer_spd_attack2" , "1.5");
  176.  
  177. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  178. }
  179.  
  180. public client_connect(id)
  181. {
  182. g_knife_combat[id] = false
  183. g_knife_strong[id] = false
  184. g_knife_axe[id] = false
  185. g_knife_katana[id] = false
  186. g_knife_hammer[id] = false
  187. g_hasSpeed[id] = false
  188. }
  189.  
  190. public client_disconnect(id)
  191. {
  192. g_knife_combat[id] = false
  193. g_knife_strong[id] = false
  194. g_knife_axe[id] = false
  195. g_knife_katana[id] = false
  196. g_knife_hammer[id] = false
  197. g_hasSpeed[id] = false
  198. }
  199.  
  200. public plugin_precache()
  201. {
  202. precache_model(combat_v_model)
  203. precache_model(combat_p_model)
  204. precache_model(strong_v_model)
  205. precache_model(strong_p_model)
  206. precache_model(axe_v_model)
  207. precache_model(axe_p_model)
  208. precache_model(katana_v_model)
  209. precache_model(katana_p_model)
  210. precache_model(hammer_v_model)
  211. precache_model(hammer_p_model)
  212.  
  213. precache_sound(g_sound_knife)
  214.  
  215. for(new i = 0; i < sizeof combat_sounds; i++)
  216. precache_sound(combat_sounds[i])
  217.  
  218. for(new i = 0; i < sizeof strong_sounds; i++)
  219. precache_sound(strong_sounds[i])
  220.  
  221. for(new i = 0; i < sizeof axe_sounds; i++)
  222. precache_sound(axe_sounds[i])
  223.  
  224. for(new i = 0; i < sizeof katana_sounds; i++)
  225. precache_sound(katana_sounds[i])
  226.  
  227. for(new i = 0; i < sizeof hammer_sounds; i++)
  228. precache_sound(hammer_sounds[i])
  229. }
  230.  
  231. public knife_menu(id)
  232. {
  233. if(is_user_alive(id) && !zp_get_user_zombie(id))
  234. {
  235. my_menu(id)
  236. }
  237.  
  238. return PLUGIN_HANDLED
  239. }
  240.  
  241. public my_menu(id)
  242. {
  243. new menu = menu_create("\yJust Zombie Plauge. Válasz kést!", "menu_handler");
  244. menu_additem(menu, "\wCombat \d[ \yGyors futás +40 \d]", "1", 0);
  245. menu_additem(menu, "\wStrong \d[ \yErös ütés +50 \d]", "2", 0);
  246. menu_additem(menu, "\wBlade \d[ \yMagas Ugrás +45 \d]", "3", 0);
  247. menu_additem(menu, "\wKatana \d[ \yMagas Visszalökés +55 \d]", "4", 0);
  248. menu_additem(menu, "\rHammer \d[ \r. * VIP * . \d]", "5", ADMIN_LEVEL_H);
  249.  
  250. menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  251.  
  252. menu_display(id, menu, 0);
  253. }
  254.  
  255. public menu_handler(id, menu, item)
  256. {
  257. if( item == MENU_EXIT )
  258. {
  259. menu_destroy(menu);
  260. return PLUGIN_HANDLED;
  261. }
  262.  
  263. new data[6], iName[64];
  264. new access, callback;
  265.  
  266. menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
  267.  
  268. new key = str_to_num(data);
  269.  
  270. switch(key)
  271. {
  272. case 1:
  273. {
  274. give_combat(id)
  275. menu_destroy(menu);
  276. return PLUGIN_HANDLED
  277. }
  278. case 2:
  279. {
  280. give_strong(id)
  281. menu_destroy(menu);
  282. return PLUGIN_HANDLED
  283. }
  284. case 3:
  285. {
  286. give_axe(id)
  287. menu_destroy(menu);
  288. return PLUGIN_HANDLED
  289. }
  290. case 4:
  291. {
  292. give_katana(id)
  293. menu_destroy(menu);
  294. return PLUGIN_HANDLED
  295. }
  296. case 5:
  297. {
  298. set_user_armor(id, get_user_armor(id) + 50)
  299. give_hammer(id)
  300. menu_destroy(menu);
  301. return PLUGIN_HANDLED
  302. }
  303. }
  304. menu_destroy(menu);
  305. return PLUGIN_HANDLED
  306. }
  307.  
  308. public give_combat(id)
  309. {
  310. g_knife_combat[id] = true
  311. g_knife_strong[id] = false
  312. g_knife_axe[id] = false
  313. g_knife_katana[id] = false
  314. g_knife_hammer[id] = false
  315. g_hasSpeed[id] = true
  316.  
  317. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  318. }
  319.  
  320. public give_strong(id)
  321. {
  322. g_knife_combat[id] = false
  323. g_knife_strong[id] = true
  324. g_knife_axe[id] = false
  325. g_knife_katana[id] = false
  326. g_knife_hammer[id] = false
  327. g_hasSpeed[id] = true
  328.  
  329. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  330. }
  331.  
  332. public give_axe(id)
  333. {
  334. g_knife_combat[id] = false
  335. g_knife_strong[id] = false
  336. g_knife_axe[id] = true
  337. g_knife_katana[id] = false
  338. g_knife_hammer[id] = false
  339. g_hasSpeed[id] = true
  340.  
  341. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  342. }
  343.  
  344. public give_katana(id)
  345. {
  346. g_knife_combat[id] = false
  347. g_knife_strong[id] = false
  348. g_knife_axe[id] = false
  349. g_knife_katana[id] = true
  350. g_knife_hammer[id] = false
  351. g_hasSpeed[id] = true
  352.  
  353. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  354. }
  355.  
  356.  
  357. public give_hammer(id)
  358. {
  359. if (get_user_flags(id) & VIP)
  360. {
  361. g_knife_combat[id] = false
  362. g_knife_strong[id] = false
  363. g_knife_axe[id] = false
  364. g_knife_katana[id] = false
  365. g_knife_hammer[id] = true
  366. g_hasSpeed[id] = true
  367.  
  368. engfunc(EngFunc_EmitSound, id, CHAN_BODY, g_sound_knife, 1.0, ATTN_NORM, 0, PITCH_NORM)
  369. }
  370. else
  371. {
  372. client_cmd(id, "/knife")
  373. }
  374. }
  375.  
  376. public checkWeapon(id)
  377. {
  378. new plrWeapId
  379.  
  380. plrWeapId = get_user_weapon(id)
  381.  
  382. if (plrWeapId == CSW_KNIFE && (g_knife_combat[id] || g_knife_strong[id] || g_knife_axe[id] || g_knife_katana[id] || g_knife_hammer[id]))
  383. {
  384. checkModel(id)
  385. }
  386. }
  387.  
  388. public checkModel(id)
  389. {
  390. if (zp_get_user_zombie(id))
  391. return PLUGIN_HANDLED
  392.  
  393. if (g_knife_combat[id])
  394. {
  395. set_pev(id, pev_viewmodel2, combat_v_model)
  396. set_pev(id, pev_weaponmodel2, combat_p_model)
  397. }
  398.  
  399. if (g_knife_strong[id])
  400. {
  401. set_pev(id, pev_viewmodel2, strong_v_model)
  402. set_pev(id, pev_weaponmodel2, strong_p_model)
  403. }
  404.  
  405. if (g_knife_axe[id])
  406. {
  407. set_pev(id, pev_viewmodel2, axe_v_model)
  408. set_pev(id, pev_weaponmodel2, axe_p_model)
  409. }
  410.  
  411. if (g_knife_katana[id])
  412. {
  413. set_pev(id, pev_viewmodel2, katana_v_model)
  414. set_pev(id, pev_weaponmodel2, katana_p_model)
  415. }
  416.  
  417. if (g_knife_hammer[id])
  418. {
  419. set_pev(id, pev_viewmodel2, hammer_v_model)
  420. set_pev(id, pev_weaponmodel2, hammer_p_model)
  421. }
  422. return PLUGIN_HANDLED
  423. }
  424.  
  425. public fw_EmitSound(id, channel, const sound[])
  426. {
  427. if(!is_user_alive(id) || zp_get_user_zombie(id))
  428. return FMRES_IGNORED
  429.  
  430. for(new i = 0; i < sizeof combat_sounds; i++)
  431. for(new i = 0; i < sizeof strong_sounds; i++)
  432. for(new i = 0; i < sizeof axe_sounds; i++)
  433. for(new i = 0; i < sizeof katana_sounds; i++)
  434. for(new i = 0; i < sizeof hammer_sounds; i++)
  435. {
  436. if(equal(sound, oldknife_sounds[i]))
  437. {
  438. if (g_knife_combat[id])
  439. {
  440. emit_sound(id, channel, combat_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  441. return FMRES_SUPERCEDE
  442. }
  443. if (g_knife_strong[id])
  444. {
  445. emit_sound(id, channel, strong_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  446. return FMRES_SUPERCEDE
  447. }
  448. if (g_knife_axe[id])
  449. {
  450. emit_sound(id, channel, axe_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  451. return FMRES_SUPERCEDE
  452. }
  453. if (g_knife_katana[id])
  454. {
  455. emit_sound(id, channel, katana_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  456. return FMRES_SUPERCEDE
  457. }
  458. if (g_knife_hammer[id])
  459. {
  460. emit_sound(id, channel, hammer_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  461. return FMRES_SUPERCEDE
  462. }
  463. if (!g_knife_combat[id] || !g_knife_strong[id] || !g_knife_axe[id] || !g_knife_katana[id] || !g_knife_hammer[id])
  464. {
  465. emit_sound(id, channel, oldknife_sounds[i], 1.0, ATTN_NORM, 0, PITCH_NORM)
  466. return FMRES_SUPERCEDE
  467. }
  468. }
  469. }
  470. return FMRES_IGNORED
  471. }
  472.  
  473. public message_DeathMsg(msg_id, msg_dest, id)
  474. {
  475. static szTruncatedWeapon[33], iattacker, ivictim
  476.  
  477. get_msg_arg_string(4, szTruncatedWeapon, charsmax(szTruncatedWeapon))
  478.  
  479. iattacker = get_msg_arg_int(1)
  480. ivictim = get_msg_arg_int(2)
  481.  
  482. if(!is_user_connected(iattacker) || iattacker == ivictim)
  483. return PLUGIN_CONTINUE
  484.  
  485. if (!zp_get_user_zombie(iattacker))
  486. {
  487. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  488. {
  489. if(g_knife_combat[iattacker])
  490. set_msg_arg_string(4, "Combat knife")
  491. }
  492.  
  493. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  494. {
  495. if(g_knife_strong[iattacker])
  496. set_msg_arg_string(4, "Strong knife")
  497. }
  498.  
  499. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  500. {
  501. if(g_knife_axe[iattacker])
  502. set_msg_arg_string(4, "Blade knife")
  503. }
  504.  
  505. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  506. {
  507. if(g_knife_katana[iattacker])
  508. set_msg_arg_string(4, "Katana knife")
  509. }
  510.  
  511. if(equal(szTruncatedWeapon, "knife") && get_user_weapon(iattacker) == CSW_KNIFE)
  512. {
  513. if(g_knife_hammer[iattacker])
  514. set_msg_arg_string(4, "Ice knife")
  515. }
  516. }
  517. return PLUGIN_CONTINUE
  518. }
  519.  
  520. stock print_col_chat(const id, const input[], any:...)
  521. {
  522. new count = 1, players[32];
  523. static msg[191];
  524. vformat(msg, 190, input, 3);
  525. replace_all(msg, 190, "!g", "^4"); // Green Color
  526. replace_all(msg, 190, "!y", "^1"); // Default Color
  527. replace_all(msg, 190, "!t", "^3"); // Team Color
  528. if (id) players[0] = id; else get_players(players, count, "ch");
  529. {
  530. for ( new i = 0; i < count; i++ )
  531. {
  532. if ( is_user_connected(players[i]) )
  533. {
  534. message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i]);
  535. write_byte(players[i]);
  536. write_string(msg);
  537. message_end();
  538. }
  539. }
  540. }
  541. }
  542.  
  543. public fw_PlayerPreThink(id)
  544. {
  545. if(!is_user_alive(id) || zp_get_user_zombie(id))
  546. return FMRES_IGNORED
  547.  
  548. new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
  549.  
  550. if (weapon == CSW_KNIFE && g_knife_combat[id])
  551. {
  552. g_hasSpeed[id] = true
  553. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_combat_spd))
  554. }
  555.  
  556. if(weapon == CSW_KNIFE && g_knife_combat[id])
  557. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  558. {
  559. new flags = pev(id, pev_flags)
  560. new waterlvl = pev(id, pev_waterlevel)
  561.  
  562. if (!(flags & FL_ONGROUND))
  563. return FMRES_IGNORED
  564.  
  565. if (flags & FL_WATERJUMP)
  566. return FMRES_IGNORED
  567.  
  568. if (waterlvl > 1)
  569. return FMRES_IGNORED
  570.  
  571. new Float:fVelocity[3]
  572. pev(id, pev_velocity, fVelocity)
  573.  
  574. fVelocity[2] += get_pcvar_num(cvar_knife_combat_jump)
  575.  
  576. set_pev(id, pev_velocity, fVelocity)
  577. set_pev(id, pev_gaitsequence, 6)
  578. }
  579. if (weapon == CSW_KNIFE && g_knife_strong[id])
  580. {
  581. g_hasSpeed[id] = true
  582. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_strong_spd))
  583.  
  584. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  585. {
  586. new flags = pev(id, pev_flags)
  587. new waterlvl = pev(id, pev_waterlevel)
  588.  
  589. if (!(flags & FL_ONGROUND))
  590. return FMRES_IGNORED
  591.  
  592. if (flags & FL_WATERJUMP)
  593. return FMRES_IGNORED
  594.  
  595. if (waterlvl > 1)
  596. return FMRES_IGNORED
  597.  
  598. new Float:fVelocity[3]
  599. pev(id, pev_velocity, fVelocity)
  600.  
  601. fVelocity[2] += get_pcvar_num(cvar_knife_strong_jump)
  602.  
  603. set_pev(id, pev_velocity, fVelocity)
  604. set_pev(id, pev_gaitsequence, 6)
  605. }
  606. }
  607. if (weapon == CSW_KNIFE && g_knife_axe[id])
  608. {
  609. g_hasSpeed[id] = true
  610. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_axe_spd))
  611.  
  612. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  613. {
  614. new flags = pev(id, pev_flags)
  615. new waterlvl = pev(id, pev_waterlevel)
  616.  
  617. if (!(flags & FL_ONGROUND))
  618. return FMRES_IGNORED
  619.  
  620. if (flags & FL_WATERJUMP)
  621. return FMRES_IGNORED
  622.  
  623. if (waterlvl > 1)
  624. return FMRES_IGNORED
  625.  
  626. new Float:fVelocity[3]
  627. pev(id, pev_velocity, fVelocity)
  628.  
  629. fVelocity[2] += get_pcvar_num(cvar_knife_axe_jump)
  630.  
  631. set_pev(id, pev_velocity, fVelocity)
  632. set_pev(id, pev_gaitsequence, 6)
  633. }
  634. }
  635. if (weapon == CSW_KNIFE && g_knife_katana[id])
  636. {
  637. g_hasSpeed[id] = true
  638. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_katana_spd))
  639.  
  640. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  641. {
  642. new flags = pev(id, pev_flags)
  643. new waterlvl = pev(id, pev_waterlevel)
  644.  
  645. if (!(flags & FL_ONGROUND))
  646. return FMRES_IGNORED
  647.  
  648. if (flags & FL_WATERJUMP)
  649. return FMRES_IGNORED
  650.  
  651. if (waterlvl > 1)
  652. return FMRES_IGNORED
  653.  
  654. new Float:fVelocity[3]
  655. pev(id, pev_velocity, fVelocity)
  656.  
  657. fVelocity[2] += get_pcvar_num(cvar_knife_katana_jump)
  658.  
  659. set_pev(id, pev_velocity, fVelocity)
  660. set_pev(id, pev_gaitsequence, 6)
  661. }
  662. }
  663. if (weapon == CSW_KNIFE && g_knife_hammer[id])
  664. {
  665. g_hasSpeed[id] = true
  666. set_pev(id, pev_maxspeed, get_pcvar_float(cvar_knife_hammer_spd))
  667.  
  668. if ((pev(id, pev_button) & IN_JUMP) && !(pev(id, pev_oldbuttons) & IN_JUMP))
  669. {
  670. new flags = pev(id, pev_flags)
  671. new waterlvl = pev(id, pev_waterlevel)
  672.  
  673. if (!(flags & FL_ONGROUND))
  674. return FMRES_IGNORED
  675.  
  676. if (flags & FL_WATERJUMP)
  677. return FMRES_IGNORED
  678.  
  679. if (waterlvl > 1)
  680. return FMRES_IGNORED
  681.  
  682. new Float:fVelocity[3]
  683. pev(id, pev_velocity, fVelocity)
  684.  
  685. fVelocity[2] += get_pcvar_num(cvar_knife_hammer_jump)
  686.  
  687. set_pev(id, pev_velocity, fVelocity)
  688. set_pev(id, pev_gaitsequence, 6)
  689. }
  690. }
  691. return FMRES_IGNORED
  692. }
  693.  
  694. public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
  695. {
  696. if(!is_user_connected(attacker))
  697. return HAM_IGNORED
  698.  
  699. if(zp_get_user_zombie(attacker))
  700. return HAM_IGNORED
  701.  
  702. new weapon = get_user_weapon(attacker)
  703.  
  704. if (weapon == CSW_KNIFE && g_knife_combat[attacker])
  705. {
  706. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_combat_dmg))
  707. }
  708. if (weapon == CSW_KNIFE && g_knife_strong[attacker])
  709. {
  710. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_strong_dmg))
  711. }
  712. if (weapon == CSW_KNIFE && g_knife_axe[attacker])
  713. {
  714. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_axe_dmg))
  715. }
  716. if (weapon == CSW_KNIFE && g_knife_katana[attacker])
  717. {
  718. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_katana_dmg))
  719. }
  720.  
  721. if (weapon == CSW_KNIFE && g_knife_hammer[attacker])
  722. {
  723. SetHamParamFloat(4, damage * get_pcvar_float(cvar_knife_hammer_dmg))
  724. }
  725.  
  726. return HAM_IGNORED
  727. }
  728.  
  729. public fw_Knife_SecondaryAttack_Post(knife)
  730. {
  731. static id
  732. id = get_pdata_cbase(knife, m_pPlayer, 4)
  733.  
  734. if(zp_get_user_zombie(id))
  735. return HAM_IGNORED
  736.  
  737. if(is_user_connected(id) && g_knife_combat[id])
  738. {
  739. static Float:flRate
  740. flRate = get_pcvar_float(cvar_knife_combat_spd_attack2)
  741.  
  742. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  743. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  744. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  745. }
  746.  
  747. if(is_user_connected(id) && g_knife_strong[id])
  748. {
  749. static Float:flRate
  750. flRate = get_pcvar_float(cvar_knife_strong_spd_attack2)
  751.  
  752. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  753. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  754. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  755. }
  756.  
  757. if(is_user_connected(id) && g_knife_axe[id])
  758. {
  759. static Float:flRate
  760. flRate = get_pcvar_float(cvar_knife_axe_spd_attack2)
  761.  
  762. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  763. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  764. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  765. }
  766.  
  767. if(is_user_connected(id) && g_knife_katana[id])
  768. {
  769. static Float:flRate
  770. flRate = get_pcvar_float(cvar_knife_katana_spd_attack2)
  771.  
  772. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  773. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  774. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  775. }
  776.  
  777. if(is_user_connected(id) && g_knife_hammer[id])
  778. {
  779. static Float:flRate
  780. flRate = get_pcvar_float(cvar_hammer_spd_attack2)
  781.  
  782. set_pdata_float(knife, m_flNextPrimaryAttack, flRate, 4)
  783. set_pdata_float(knife, m_flNextSecondaryAttack, flRate, 4)
  784. set_pdata_float(knife, m_flTimeWeaponIdle, flRate, 4)
  785. }
  786.  
  787. return HAM_IGNORED
  788. }
  789.  
  790. public event_Damage(id)
  791. {
  792. new weapon , attacker = get_user_attacker(id , weapon);
  793.  
  794. if(!is_user_alive(attacker))
  795. return PLUGIN_CONTINUE;
  796.  
  797. if(weapon == CSW_KNIFE && g_knife_combat[attacker])
  798. {
  799. new Float:vec[3];
  800. new Float:oldvelo[3];
  801. get_user_velocity(id, oldvelo);
  802. create_velocity_vector(id , attacker , vec);
  803. vec[0] += oldvelo[0];
  804. vec[1] += oldvelo[1];
  805. set_user_velocity(id , vec);
  806. }
  807.  
  808. if(weapon == CSW_KNIFE && g_knife_strong[attacker])
  809. {
  810. new Float:vec[3];
  811. new Float:oldvelo[3];
  812. get_user_velocity(id, oldvelo);
  813. create_velocity_vector(id , attacker , vec);
  814. vec[0] += oldvelo[0];
  815. vec[1] += oldvelo[1];
  816. set_user_velocity(id , vec);
  817. }
  818.  
  819. if(weapon == CSW_KNIFE && g_knife_axe[attacker])
  820. {
  821. new Float:vec[3];
  822. new Float:oldvelo[3];
  823. get_user_velocity(id, oldvelo);
  824. create_velocity_vector(id , attacker , vec);
  825. vec[0] += oldvelo[0];
  826. vec[1] += oldvelo[1];
  827. set_user_velocity(id , vec);
  828. }
  829.  
  830. if(weapon == CSW_KNIFE && g_knife_katana[attacker])
  831. {
  832. new Float:vec[3];
  833. new Float:oldvelo[3];
  834. get_user_velocity(id, oldvelo);
  835. create_velocity_vector(id , attacker , vec);
  836. vec[0] += oldvelo[0];
  837. vec[1] += oldvelo[1];
  838. set_user_velocity(id , vec);
  839. }
  840.  
  841. if(weapon == CSW_KNIFE && g_knife_hammer[attacker])
  842. {
  843. new Float:vec[3];
  844. new Float:oldvelo[3];
  845. get_user_velocity(id, oldvelo);
  846. create_velocity_vector(id , attacker , vec);
  847. vec[0] += oldvelo[0];
  848. vec[1] += oldvelo[1];
  849. set_user_velocity(id , vec);
  850. }
  851.  
  852. return PLUGIN_CONTINUE;
  853. }
  854.  
  855. stock create_velocity_vector(victim,attacker,Float:velocity[3])
  856. {
  857. if(!zp_get_user_zombie(victim) || !is_user_alive(attacker))
  858. return 0;
  859.  
  860. new Float:vicorigin[3];
  861. new Float:attorigin[3];
  862. entity_get_vector(victim , EV_VEC_origin , vicorigin);
  863. entity_get_vector(attacker , EV_VEC_origin , attorigin);
  864.  
  865. new Float:origin2[3]
  866. origin2[0] = vicorigin[0] - attorigin[0];
  867. origin2[1] = vicorigin[1] - attorigin[1];
  868.  
  869. new Float:largestnum = 0.0;
  870.  
  871. if(floatabs(origin2[0])>largestnum) largestnum = floatabs(origin2[0]);
  872. if(floatabs(origin2[1])>largestnum) largestnum = floatabs(origin2[1]);
  873.  
  874. origin2[0] /= largestnum;
  875. origin2[1] /= largestnum;
  876.  
  877. if (g_knife_combat[attacker])
  878. {
  879. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_combat_knock) * 3000) ) / get_entity_distance(victim , attacker);
  880. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_combat_knock) * 3000) ) / get_entity_distance(victim , attacker);
  881. }
  882.  
  883. if (g_knife_strong[attacker])
  884. {
  885. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_strong_knock) * 3000) ) / get_entity_distance(victim , attacker);
  886. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_strong_knock) * 3000) ) / get_entity_distance(victim , attacker);
  887. }
  888.  
  889. if (g_knife_axe[attacker])
  890. {
  891. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_axe_knock) * 3000) ) / get_entity_distance(victim , attacker);
  892. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_axe_knock) * 3000) ) / get_entity_distance(victim , attacker);
  893. }
  894.  
  895. if (g_knife_katana[attacker])
  896. {
  897. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_katana_knock) * 3000) ) / get_entity_distance(victim , attacker);
  898. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_katana_knock) * 3000) ) / get_entity_distance(victim , attacker);
  899. }
  900.  
  901. if (g_knife_hammer[attacker])
  902. {
  903. velocity[0] = ( origin2[0] * (get_pcvar_float(cvar_knife_hammer_knock) * 3000) ) / get_entity_distance(victim , attacker);
  904. velocity[1] = ( origin2[1] * (get_pcvar_float(cvar_knife_hammer_knock) * 3000) ) / get_entity_distance(victim , attacker);
  905. }
  906.  
  907. if(velocity[0] <= 20.0 || velocity[1] <= 20.0)
  908. velocity[2] = random_float(200.0 , 275.0);
  909.  
  910. return 1;
  911. }
  912.  
  913. public client_putinserver(id)
  914. {
  915. switch(random_num(0, 0))
  916. {
  917. case 0:
  918. {
  919. g_knife_combat[id] = true
  920. g_hasSpeed[id] = true
  921. }
  922.  
  923. }
  924. }
  925.  


2:
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #define LIBRARY_BUYMENUS "zp50_buy_menus"
  5. #include <zp50_buy_menus>
  6. #define LIBRARY_ZOMBIECLASSES "zp50_class_zombie"
  7. #include <zp50_class_zombie>
  8. #define LIBRARY_HUMANCLASSES "zp50_class_human"
  9. #include <zp50_class_human>
  10. #define LIBRARY_ITEMS "zp50_items"
  11. #include <zp50_items>
  12. #define LIBRARY_ADMIN_MENU "zp50_admin_menu"
  13. #include <zp50_admin_menu>
  14. #define LIBRARY_RANDOMSPAWN "zp50_random_spawn"
  15. #include <zp50_random_spawn>
  16. #include <zp50_colorchat>
  17.  
  18. #define TASK_WELCOMEMSG 100
  19.  
  20. // CS Player PData Offsets (win32)
  21. const OFFSET_CSMENUCODE = 205
  22.  
  23. // Menu keys
  24. const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0
  25.  
  26. #define flag_get(%1,%2) (%1 & (1 << (%2 & 31)))
  27. #define flag_get_boolean(%1,%2) (flag_get(%1,%2) ? true : false)
  28. #define flag_set(%1,%2) %1 |= (1 << (%2 & 31))
  29. #define flag_unset(%1,%2) %1 &= ~(1 << (%2 & 31))
  30.  
  31. new g_ChooseTeamOverrideActive
  32.  
  33. new cvar_buy_custom_primary, cvar_buy_custom_secondary, cvar_buy_custom_grenades
  34. new cvar_random_spawning
  35.  
  36. public plugin_init()
  37. {
  38. register_plugin("[ZP] Main Menu", ZP_VERSION_STRING, "ZP Dev Team")
  39.  
  40. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  41.  
  42. register_clcmd("chooseteam", "clcmd_chooseteam")
  43.  
  44. register_clcmd("say /zpmenu", "clcmd_zpmenu")
  45. register_clcmd("say zpmenu", "clcmd_zpmenu")
  46.  
  47. // Menus
  48. register_menu("Main Menu", KEYSMENU, "menu_main")
  49. }
  50.  
  51. public plugin_natives()
  52. {
  53. set_module_filter("module_filter")
  54. set_native_filter("native_filter")
  55. }
  56. public module_filter(const module[])
  57. {
  58. if (equal(module, LIBRARY_BUYMENUS) || equal(module, LIBRARY_ZOMBIECLASSES) || equal(module, LIBRARY_HUMANCLASSES) || equal(module, LIBRARY_ITEMS) || equal(module, LIBRARY_ADMIN_MENU) || equal(module, LIBRARY_RANDOMSPAWN))
  59. return PLUGIN_HANDLED;
  60.  
  61. return PLUGIN_CONTINUE;
  62. }
  63. public native_filter(const name[], index, trap)
  64. {
  65. if (!trap)
  66. return PLUGIN_HANDLED;
  67.  
  68. return PLUGIN_CONTINUE;
  69. }
  70.  
  71. public plugin_cfg()
  72. {
  73. cvar_buy_custom_primary = get_cvar_pointer("zp_buy_custom_primary")
  74. cvar_buy_custom_secondary = get_cvar_pointer("zp_buy_custom_secondary")
  75. cvar_buy_custom_grenades = get_cvar_pointer("zp_buy_custom_grenades")
  76. cvar_random_spawning = get_cvar_pointer("zp_random_spawning_csdm")
  77. }
  78.  
  79. // Event Round Start
  80. public event_round_start()
  81. {
  82. // Show main menu message
  83. remove_task(TASK_WELCOMEMSG)
  84. set_task(2.0, "task_welcome_msg", TASK_WELCOMEMSG)
  85. }
  86.  
  87. // Welcome Message Task
  88. public task_welcome_msg()
  89. {
  90. zp_colored_print(0, "==== ^4Zombie Plague ^3%s^1 ====", ZP_VERSION_STR_LONG)
  91. zp_colored_print(0, "==== ^4Config by: ^3A* & Danii^1 ====")
  92. zp_colored_print(0, "%L", LANG_PLAYER, "NOTICE_INFO1")
  93. }
  94.  
  95. public clcmd_chooseteam(id)
  96. {
  97. if (flag_get(g_ChooseTeamOverrideActive, id))
  98. {
  99. show_menu_main(id)
  100. return PLUGIN_HANDLED;
  101. }
  102.  
  103. flag_set(g_ChooseTeamOverrideActive, id)
  104. return PLUGIN_CONTINUE;
  105. }
  106.  
  107. public clcmd_zpmenu(id)
  108. {
  109. show_menu_main(id)
  110. }
  111.  
  112. public client_putinserver(id)
  113. {
  114. flag_set(g_ChooseTeamOverrideActive, id)
  115. }
  116.  
  117. // Main Menu
  118. show_menu_main(id)
  119. {
  120. static menu[250]
  121. new len
  122.  
  123. // Title
  124. len += formatex(menu[len], charsmax(menu) - len, "\yJust Zombie Plague \r%s^n^n", ZP_VERSION_STR_LONG)
  125.  
  126. // 1. Buy menu
  127. if (LibraryExists(LIBRARY_BUYMENUS, LibType_Library) && (get_pcvar_num(cvar_buy_custom_primary)
  128. || get_pcvar_num(cvar_buy_custom_secondary) || get_pcvar_num(cvar_buy_custom_grenades)) && is_user_alive(id))
  129. len += formatex(menu[len], charsmax(menu) - len, "\r1.\w %L^n", id, "MENU_BUY")
  130. else
  131. len += formatex(menu[len], charsmax(menu) - len, "\d1. %L^n", id, "MENU_BUY")
  132.  
  133. // 2. Extra Items
  134. if (LibraryExists(LIBRARY_ITEMS, LibType_Library) && is_user_alive(id))
  135. len += formatex(menu[len], charsmax(menu) - len, "\r2.\w %L^n", id, "MENU_EXTRABUY")
  136. else
  137. len += formatex(menu[len], charsmax(menu) - len, "\d2. %L^n", id, "MENU_EXTRABUY")
  138.  
  139. // 3. Zombie class
  140. if (LibraryExists(LIBRARY_ZOMBIECLASSES, LibType_Library) && zp_class_zombie_get_count() > 1)
  141. len += formatex(menu[len], charsmax(menu) - len, "\r3.\w %L^n", id, "MENU_ZCLASS")
  142. else
  143. len += formatex(menu[len], charsmax(menu) - len, "\d3. %L^n", id, "MENU_ZCLASS")
  144.  
  145. // 4. Human class
  146. if (LibraryExists(LIBRARY_HUMANCLASSES, LibType_Library) && zp_class_human_get_count() > 1)
  147. len += formatex(menu[len], charsmax(menu) - len, "\r4.\w %L^n", id, "MENU_HCLASS")
  148. else
  149. len += formatex(menu[len], charsmax(menu) - len, "\d4. %L^n", id, "MENU_HCLASS")
  150.  
  151. // 5. knife choose
  152. if (LibraryExists(LIBRARY_RANDOMSPAWN, LibType_Library) && is_user_alive(id))
  153. len += formatex(menu[len], charsmax(menu) - len, "\r5.\w %L^n", id, "MENU_KNIFE")
  154. else
  155. len += formatex(menu[len], charsmax(menu) - len, "\d5. %L^n", id, "MENU_KNIFE")
  156.  
  157. // 6. Menu bind
  158. len += formatex(menu[len], charsmax(menu) - len, "\r6.\w %L^n^n", id, "MENU_BIND")
  159.  
  160. // 7. Choose Team
  161. len += formatex(menu[len], charsmax(menu) - len, "\r7.\w %L^n^n", id, "MENU_CHOOSE_TEAM")
  162.  
  163. // 9. Admin menu
  164. if (LibraryExists(LIBRARY_ADMIN_MENU, LibType_Library) && is_user_admin(id))
  165. len += formatex(menu[len], charsmax(menu) - len, "\r9.\w %L", id, "MENU_ADMIN")
  166. else
  167. len += formatex(menu[len], charsmax(menu) - len, "\d9. %L", id, "MENU_ADMIN")
  168.  
  169. // 0. Exit
  170. len += formatex(menu[len], charsmax(menu) - len, "^n^n\r0.\w %L", id, "MENU_EXIT")
  171.  
  172. // Fix for AMXX custom menus
  173. set_pdata_int(id, OFFSET_CSMENUCODE, 0)
  174. show_menu(id, KEYSMENU, menu, -1, "Main Menu")
  175. }
  176.  
  177. // Main Menu
  178. public menu_main(id, key)
  179. {
  180. // Player disconnected?
  181. if (!is_user_connected(id))
  182. return PLUGIN_HANDLED;
  183.  
  184. switch (key)
  185. {
  186. case 0: // Buy Menu
  187. {
  188. // Custom buy menus enabled?
  189. if (LibraryExists(LIBRARY_BUYMENUS, LibType_Library) && (get_pcvar_num(cvar_buy_custom_primary)
  190. || get_pcvar_num(cvar_buy_custom_secondary) || get_pcvar_num(cvar_buy_custom_grenades)))
  191. {
  192. // Check whether the player is able to buy anything
  193. if (is_user_alive(id))
  194. zp_buy_menus_show(id)
  195. else
  196. zp_colored_print(id, "%L", id, "CANT_BUY_WEAPONS_DEAD")
  197. }
  198. else
  199. zp_colored_print(id, "%L", id, "CUSTOM_BUY_DISABLED")
  200. }
  201. case 1: // Extra Items
  202. {
  203. // Items enabled?
  204. if (LibraryExists(LIBRARY_ITEMS, LibType_Library))
  205. {
  206. // Check whether the player is able to buy anything
  207. if (is_user_alive(id))
  208. zp_items_show_menu(id)
  209. else
  210. zp_colored_print(id, "%L", id, "CANT_BUY_ITEMS_DEAD")
  211. }
  212. else
  213. zp_colored_print(id, "%L", id, "CMD_NOT_EXTRAS")
  214. }
  215. case 2: // Zombie Classes
  216. {
  217. if (LibraryExists(LIBRARY_ZOMBIECLASSES, LibType_Library) && zp_class_zombie_get_count() > 1)
  218. zp_class_zombie_show_menu(id)
  219. else
  220. zp_colored_print(id, "%L", id, "CMD_NOT_ZCLASSES")
  221. }
  222. case 3: // Human Classes
  223. {
  224. if (LibraryExists(LIBRARY_HUMANCLASSES, LibType_Library) && zp_class_human_get_count() > 1)
  225. zp_class_human_show_menu(id)
  226. else
  227. zp_colored_print(id, "%L", id, "CMD_NOT_HCLASSES")
  228. }
  229. case 4:
  230. {
  231. client_cmd(id, "say /knife")
  232. }
  233. case 5: // Help Menu
  234. {
  235. show_menu_info(id)
  236. }
  237. case 6: // Menu override
  238. {
  239. flag_unset(g_ChooseTeamOverrideActive, id)
  240. client_cmd(id, "chooseteam")
  241. }
  242. case 8: // Admin Menu
  243. {
  244. if (LibraryExists(LIBRARY_ADMIN_MENU, LibType_Library) && is_user_admin(id))
  245. zp_admin_menu_show(id)
  246. else
  247. zp_colored_print(id, "%L", id, "NO_ADMIN_MENU")
  248. }
  249. }
  250.  
  251. return PLUGIN_HANDLED;
  252. }
  253.  
  254. // Help MOTD
  255. public show_menu_info(id)
  256. {
  257. client_cmd( id, "bind x +setlaser" );
  258. client_cmd( id, "bind c +dellaser" );
  259. }
  260.  
  261. // Check if a player is stuck (credits to VEN)
  262. stock is_player_stuck(id)
  263. {
  264. static Float:originF[3]
  265. pev(id, pev_origin, originF)
  266.  
  267. engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0)
  268.  
  269. if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
  270. return true;
  271.  
  272. return false;
  273. }
  274.  


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve: 2013.05.01. 18:22 
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
Köszi :D

_________________
****


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  [ 3 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 41 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