hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.14. 05:00



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Majestic-12 [Bot] 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  [ 1 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Zp Lézer
HozzászólásElküldve: 2014.02.06. 17:54 
Offline
Félisten

Csatlakozott: 2012.06.19. 15:12
Hozzászólások: 926
Megköszönt másnak: 109 alkalommal
Megköszönték neki: 31 alkalommal
Valaki segítene azt szeretném tudni hogy a lézer kör végén miért nem tűnik el. Valamikor eltűnik valamikor nem ez mitől van?


SMA Forráskód: [ Mindet kijelol ]
  1. /*
  2. Shidla [SGC] | 2013
  3. ICQ: 312-298-513
  4.  
  5. 2.8.2 [Vegso Verzio] | 21.05.2013 | Forras: Zombie-Mod.Ru
  6. 2.8.3 - Raj modban tiltott a lezer lerakasa! | Modositotta: Chasper.
  7. */
  8.  
  9. #include <amxmodx>
  10. #include <fakemeta>
  11. #include <hamsandwich>
  12. #include <xs>
  13. #include <zombieplague>
  14.  
  15. #if AMXX_VERSION_NUM < 180
  16. #assert AMX Mod X v1.8.0 or greater library required!
  17. #endif
  18.  
  19. #define PLUGIN "[ZP] LaserMine"
  20. #define VERSION "2.8.3"
  21. #define AUTHOR "SandStriker / Shidla / QuZ / DJ_WEST"
  22.  
  23. #define RemoveEntity(%1) engfunc(EngFunc_RemoveEntity,%1)
  24. #define TASK_PLANT 15100
  25. #define TASK_RESET 15500
  26. #define TASK_RELEASE 15900
  27.  
  28. #define LASERMINE_TEAM pev_iuser1 //EV_INT_iuser1
  29. #define LASERMINE_OWNER pev_iuser2 //EV_INT_iuser3
  30. #define LASERMINE_STEP pev_iuser3
  31. #define LASERMINE_HITING pev_iuser4
  32. #define LASERMINE_COUNT pev_fuser1
  33.  
  34. #define LASERMINE_POWERUP pev_fuser2
  35. #define LASERMINE_BEAMTHINK pev_fuser3
  36.  
  37. #define LASERMINE_BEAMENDPOINT pev_vuser1
  38. #define MAX_MINES 10
  39. #define MODE_LASERMINE 0
  40. #define OFFSET_TEAM 114
  41. #define OFFSET_MONEY 115
  42. #define OFFSET_DEATH 444
  43.  
  44. #define cs_get_user_team(%1) CsTeams:get_offset_value(%1,OFFSET_TEAM)
  45. #define cs_get_user_deaths(%1) get_offset_value(%1,OFFSET_DEATH)
  46. #define is_valid_player(%1) (1 <= %1 <= 32)
  47.  
  48.  
  49. /*########### Цвета Мин и лазерных лучей ###########*/
  50. // Itt adhato meg az embernek a lezer szine!
  51. new const
  52. Red_Hum = 0,
  53. Green_Hum = 0,
  54. Blue_Hum = 255;
  55.  
  56. // Itt adhato meg a zombi altal lerakott lezer szine!
  57. new const
  58. Red_Zomb = 0,
  59. Green_Zomb = 255,
  60. Blue_Zomb = 0;
  61. /*####### Цвета Мин и лазерных лучей (конец) #######*/
  62.  
  63. enum CsTeams {
  64. CS_TEAM_UNASSIGNED = 0,
  65. CS_TEAM_T = 1,
  66. CS_TEAM_CT = 2,
  67. CS_TEAM_SPECTATOR = 3
  68. };
  69.  
  70. enum tripmine_e {
  71. TRIPMINE_IDLE1 = 0,
  72. TRIPMINE_IDLE2,
  73. TRIPMINE_ARM1,
  74. TRIPMINE_ARM2,
  75. TRIPMINE_FIDGET,
  76. TRIPMINE_HOLSTER,
  77. TRIPMINE_DRAW,
  78. TRIPMINE_WORLD,
  79. TRIPMINE_GROUND,
  80. };
  81.  
  82. enum
  83. {
  84. POWERUP_THINK,
  85. BEAMBREAK_THINK,
  86. EXPLOSE_THINK
  87. };
  88.  
  89. enum
  90. {
  91. POWERUP_SOUND,
  92. ACTIVATE_SOUND,
  93. STOP_SOUND
  94. };
  95.  
  96. new const
  97. ENT_MODELS[] = "models/zombie_plague/LaserMines/v_laser_mine.mdl",
  98. ENT_SOUND1[] = "weapons/mine_deploy.wav",
  99. ENT_SOUND2[] = "weapons/mine_charge.wav",
  100. ENT_SOUND3[] = "weapons/mine_activate.wav",
  101. ENT_SOUND4[] = "items/suitchargeok1.wav",
  102. ENT_SOUND5[] = "items/gunpickup2.wav",
  103. ENT_SOUND6[] = "debris/bustglass1.wav",
  104. ENT_SOUND7[] = "debris/bustglass2.wav",
  105. ENT_SPRITE1[] = "sprites/laserbeam.spr",
  106. ENT_SPRITE2[] = "sprites/lm_explode.spr";
  107.  
  108. new const
  109. ENT_CLASS_NAME[] = "lasermine",
  110. ENT_CLASS_NAME3[] = "func_breakable",
  111. gSnarkClassName[] = "wpn_snark", // Для совместимости с плагином "Snark"
  112. barnacle_class[] = "barnacle", // Для совместимости с плагином "Barnacle"
  113. weapon_box[] = "weaponbox";
  114.  
  115. new g_EntMine, beam, boom
  116. new g_LENABLE, g_LFMONEY, g_LAMMO, g_LDMG, g_LBEO, g_LTMAX, g_LCOST, g_LHEALTH, g_LMODE, g_LRADIUS, g_NOROUND, g_NEMROUND, g_SURVROUND, g_SWARMROUND
  117. new g_LRDMG,g_LFF,g_LCBT, g_LDELAY, g_LVISIBLE, g_LSTAMMO, g_LACCESS, g_LGLOW, g_LDMGMODE, g_LCLMODE
  118. new g_LCBRIGHT, g_LDSEC, g_LCMDMODE, g_LBUYMODE, g_LME;
  119. new g_msgDeathMsg,g_msgScoreInfo,g_msgDamage,g_msgStatusText;
  120. new g_dcount[33],g_nowtime,g_MaxPL
  121. new bool:g_settinglaser[33]
  122. new Float:plspeed[33], plsetting[33], g_havemine[33], g_deployed[33];
  123. //new CVAR_LMCost
  124.  
  125. public plugin_init()
  126. {
  127. register_plugin(PLUGIN, VERSION, AUTHOR);
  128.  
  129. // Вызываем функцию Laser_TakeDamage при получении урона объектом ENT_CLASS_NAME3 (func_breakable)
  130. RegisterHam(Ham_TakeDamage, ENT_CLASS_NAME3, "Laser_TakeDamage")
  131. // Add your code here...
  132. register_clcmd("+setlaser","CreateLaserMine_Progress_b");
  133. register_clcmd("-setlaser","StopCreateLaserMine");
  134. register_clcmd("+dellaser","ReturnLaserMine_Progress");
  135. register_clcmd("-dellaser","StopReturnLaserMine");
  136. register_clcmd("say","say_lasermine");
  137. register_clcmd("buy_lasermine","BuyLasermineChat");
  138.  
  139. g_LENABLE = register_cvar("zp_ltm","1")
  140. g_LACCESS = register_cvar("zp_ltm_acs","0") //0 all, 1 admin
  141. g_LMODE = register_cvar("zp_ltm_mode","0") //0 lasermine, 1 tripmine
  142. g_LAMMO = register_cvar("zp_ltm_ammo","3")
  143. g_LDMG = register_cvar("zp_ltm_dmg","60") //laser hit dmg
  144. g_LCOST = register_cvar("zp_ltm_cost","2")
  145. g_LFMONEY = register_cvar("zp_ltm_fragmoney","1")
  146. g_LHEALTH = register_cvar("zp_ltm_health","500")
  147. g_LTMAX = register_cvar("zp_ltm_teammax","100")
  148. g_LRADIUS = register_cvar("zp_ltm_radius","320.0")
  149. g_LRDMG = register_cvar("zp_ltm_rdmg","100") //radius damage
  150. g_LFF = register_cvar("zp_ltm_ff","0")
  151. g_LCBT = register_cvar("zp_ltm_cbt","ALL")
  152. g_LDELAY = register_cvar("zp_ltm_delay","0.1")
  153. g_LVISIBLE = register_cvar("zp_ltm_line","1")
  154. g_LGLOW = register_cvar("zp_ltm_glow","0")
  155. g_LCBRIGHT = register_cvar("zp_ltm_bright","255")//laser line brightness.
  156. g_LCLMODE = register_cvar("zp_ltm_color","0") //0 is team color,1 is green
  157. g_LDMGMODE = register_cvar("zp_ltm_ldmgmode","0") //0 - frame dmg, 1 - once dmg, 2 - 1 second dmg
  158. g_LDSEC = register_cvar("zp_ltm_ldmgseconds","1") //mode 2 only, damage / seconds. default 1 (sec)
  159. g_LSTAMMO = register_cvar("zp_ltm_startammo","2")
  160. g_LBUYMODE = register_cvar("zp_ltm_buymode","1");
  161. g_LCMDMODE = register_cvar("zp_ltm_cmdmode","0"); //0 is +USE key, 1 is bind, 2 is each.
  162. g_LBEO = register_cvar("zp_ltm_brokeenemy","1");
  163. g_NOROUND = register_cvar("zp_ltm_noround","1");
  164. g_NEMROUND = register_cvar("zp_ltm_nemround","1");
  165. g_SURVROUND = register_cvar("zp_ltm_survround","1");
  166. g_SWARMROUND = register_cvar("zp_ltm_swarmround","1");
  167.  
  168. register_event("DeathMsg", "DeathEvent", "a");
  169. register_event("CurWeapon", "standing", "be", "1=1");
  170. register_event("ResetHUD", "delaycount", "a");
  171. register_event("ResetHUD", "newround", "b");
  172. register_logevent("endround", 2, "0=World triggered", "1=Round_End"); // Регистрируем конец раунда
  173. register_event("Damage","CutDeploy_onDamage","b");
  174. g_msgDeathMsg = get_user_msgid("DeathMsg");
  175. g_msgScoreInfo = get_user_msgid("ScoreInfo");
  176. g_msgDamage = get_user_msgid("Damage");
  177. g_msgStatusText = get_user_msgid("StatusText");
  178.  
  179. // Forward.
  180. register_forward(FM_Think, "ltm_Think");
  181. register_forward(FM_PlayerPostThink, "ltm_PostThink");
  182. register_forward(FM_PlayerPreThink, "ltm_PreThink");
  183.  
  184. // Регистируем файл языков
  185. register_dictionary("LaserMines.txt")
  186. register_cvar("Shidla", "[ZP] LaserMines v.2.8.2 Final", FCVAR_SERVER|FCVAR_SPONLY)
  187.  
  188. // Регистрируем ExtraItem
  189. g_LME = zp_register_extra_item("Laser Mine", get_pcvar_num(g_LCOST), ZP_TEAM_ANY)
  190. }
  191.  
  192. public plugin_precache()
  193. {
  194. precache_sound(ENT_SOUND1);
  195. precache_sound(ENT_SOUND2);
  196. precache_sound(ENT_SOUND3);
  197. precache_sound(ENT_SOUND4);
  198. precache_sound(ENT_SOUND5);
  199. precache_sound(ENT_SOUND6);
  200. precache_sound(ENT_SOUND7);
  201. precache_model(ENT_MODELS);
  202. beam = precache_model(ENT_SPRITE1);
  203. boom = precache_model(ENT_SPRITE2);
  204. return PLUGIN_CONTINUE;
  205. }
  206.  
  207. public plugin_modules()
  208. {
  209. require_module("fakemeta");
  210. require_module("cstrike");
  211. }
  212.  
  213. public plugin_cfg()
  214. {
  215. g_EntMine = engfunc(EngFunc_AllocString,ENT_CLASS_NAME3);
  216. arrayset(g_havemine,0,sizeof(g_havemine));
  217. arrayset(g_deployed,0,sizeof(g_deployed));
  218. g_MaxPL = get_maxplayers();
  219.  
  220. new file[64]; get_localinfo("amxx_configsdir",file,63);
  221. format(file, 63, "%s/zp_ltm_cvars_ap.cfg", file);
  222. if(file_exists(file)) server_cmd("exec %s", file), server_exec();
  223. }
  224.  
  225. public Laser_TakeDamage(victim, inflictor, attacker, Float:f_Damage, bit_Damage)
  226. {
  227. if(get_pcvar_num(g_LBEO))
  228. {
  229. new i_Owner
  230.  
  231. // Получаем ID игрока, который поставил мину
  232. i_Owner = pev(victim, LASERMINE_OWNER)
  233.  
  234. // Если урон нанасит владелец, а так же проверка игрока.
  235. if(i_Owner == attacker || !is_valid_player(i_Owner) || !is_valid_player(attacker))
  236. return PLUGIN_CONTINUE
  237.  
  238. // Если мина установлена человеком, то урон ей наносят только зомби
  239. if((CsTeams:pev(victim, LASERMINE_TEAM) == CS_TEAM_CT) && (cs_get_user_team(attacker) != CS_TEAM_CT))
  240. return PLUGIN_CONTINUE
  241.  
  242. // Если мина установлена зомби, а владелец мины и атакующий в разных командах - урон мине могун наносить все
  243. if((CsTeams:pev(victim, LASERMINE_TEAM) == CS_TEAM_T) && ((cs_get_user_team(i_Owner) != CS_TEAM_T) || (CsTeams:pev(victim, LASERMINE_TEAM) != cs_get_user_team(attacker))))
  244. return PLUGIN_CONTINUE
  245.  
  246. return HAM_SUPERCEDE
  247. }
  248. return PLUGIN_CONTINUE
  249. }
  250.  
  251. public delaycount(id)
  252. {
  253. g_dcount[id] = floatround(get_gametime());
  254. }
  255.  
  256. bool:CheckTime(id)
  257. {
  258. g_nowtime = floatround(get_gametime()) - g_dcount[id];
  259. if(g_nowtime >= get_pcvar_num(g_LDELAY))
  260. return true;
  261. return false;
  262. }
  263.  
  264. public CreateLaserMine_Progress_b(id)
  265. {
  266. if(get_pcvar_num(g_LCMDMODE) != 0)
  267. CreateLaserMine_Progress(id);
  268. return PLUGIN_HANDLED;
  269. }
  270.  
  271. public CreateLaserMine_Progress(id)
  272. {
  273.  
  274. if(!CreateCheck(id))
  275. return PLUGIN_HANDLED;
  276. g_settinglaser[id] = true;
  277.  
  278. message_begin(MSG_ONE, 108, {0,0,0}, id);
  279. write_byte(1);
  280. write_byte(0);
  281. message_end();
  282.  
  283. set_task(1.2, "Spawn", (TASK_PLANT + id));
  284.  
  285. return PLUGIN_HANDLED;
  286. }
  287.  
  288. public ReturnLaserMine_Progress(id)
  289. {
  290.  
  291. if(!ReturnCheck(id))
  292. return PLUGIN_HANDLED;
  293. g_settinglaser[id] = true;
  294.  
  295. message_begin(MSG_ONE, 108, {0,0,0}, id);
  296. write_byte(1);
  297. write_byte(0);
  298. message_end();
  299.  
  300. set_task(1.2, "ReturnMine", (TASK_RELEASE + id));
  301.  
  302. return PLUGIN_HANDLED;
  303. }
  304.  
  305. public StopCreateLaserMine(id)
  306. {
  307.  
  308. DeleteTask(id);
  309. message_begin(MSG_ONE, 108, {0,0,0}, id);
  310. write_byte(0);
  311. write_byte(0);
  312. message_end();
  313.  
  314. return PLUGIN_HANDLED;
  315. }
  316.  
  317. public StopReturnLaserMine(id)
  318. {
  319.  
  320. DeleteTask(id);
  321. message_begin(MSG_ONE, 108, {0,0,0}, id);
  322. write_byte(0);
  323. write_byte(0);
  324. message_end();
  325.  
  326. return PLUGIN_HANDLED;
  327. }
  328.  
  329. public ReturnMine(id)
  330. {
  331. id -= TASK_RELEASE;
  332. new tgt,body,Float:vo[3],Float:to[3];
  333. get_user_aiming(id,tgt,body);
  334. if(!pev_valid(tgt)) return;
  335. pev(id,pev_origin,vo);
  336. pev(tgt,pev_origin,to);
  337. if(get_distance_f(vo,to) > 70.0) return;
  338. new EntityName[32];
  339. pev(tgt, pev_classname, EntityName, 31);
  340. if(!equal(EntityName, ENT_CLASS_NAME)) return;
  341. if(pev(tgt,LASERMINE_OWNER) != id) return;
  342. RemoveEntity(tgt);
  343.  
  344. g_havemine[id] ++;
  345. g_deployed[id] --;
  346. emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  347. ShowAmmo(id)
  348.  
  349. return;
  350. }
  351.  
  352. public Spawn(id)
  353. {
  354. id -= TASK_PLANT
  355. // motor
  356. new i_Ent = engfunc(EngFunc_CreateNamedEntity,g_EntMine);
  357. if(!i_Ent)
  358. {
  359. client_print(id, print_chat,"[Laesrmine Debug] Can't Create Entity");
  360. return PLUGIN_HANDLED_MAIN;
  361. }
  362. set_pev(i_Ent,pev_classname,ENT_CLASS_NAME);
  363.  
  364. engfunc(EngFunc_SetModel,i_Ent,ENT_MODELS);
  365.  
  366. set_pev(i_Ent,pev_solid,SOLID_NOT);
  367. set_pev(i_Ent,pev_movetype,MOVETYPE_FLY);
  368.  
  369. set_pev(i_Ent,pev_frame,0);
  370. set_pev(i_Ent,pev_body,3);
  371. set_pev(i_Ent,pev_sequence,TRIPMINE_WORLD);
  372. set_pev(i_Ent,pev_framerate,0);
  373. set_pev(i_Ent,pev_takedamage,DAMAGE_YES);
  374. set_pev(i_Ent,pev_dmg,100.0);
  375. set_user_health(i_Ent,get_pcvar_num(g_LHEALTH));
  376. new Float:vOrigin[3];
  377. new Float:vNewOrigin[3],Float:vNormal[3],Float:vTraceDirection[3],
  378. Float:vTraceEnd[3],Float:vEntAngles[3];
  379. pev(id, pev_origin, vOrigin);
  380. velocity_by_aim(id, 128, vTraceDirection);
  381. xs_vec_add(vTraceDirection, vOrigin, vTraceEnd);
  382. engfunc(EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0);
  383. new Float:fFraction;
  384. get_tr2(0, TR_flFraction, fFraction);
  385.  
  386. // -- We hit something!
  387. if(fFraction < 1.0)
  388. {
  389. // -- Save results to be used later.
  390. get_tr2(0, TR_vecEndPos, vTraceEnd);
  391. get_tr2(0, TR_vecPlaneNormal, vNormal);
  392. }
  393.  
  394.  
  395. xs_vec_mul_scalar(vNormal, 8.0, vNormal);
  396. xs_vec_add(vTraceEnd, vNormal, vNewOrigin);
  397.  
  398. engfunc(EngFunc_SetSize, i_Ent, Float:{ -4.0, -4.0, -4.0 }, Float:{ 4.0, 4.0, 4.0 });
  399. engfunc(EngFunc_SetOrigin, i_Ent, vNewOrigin);
  400.  
  401. // -- Rotate tripmine.
  402. vector_to_angle(vNormal,vEntAngles);
  403. set_pev(i_Ent,pev_angles,vEntAngles);
  404.  
  405. // -- Calculate laser end origin.
  406. new Float:vBeamEnd[3], Float:vTracedBeamEnd[3];
  407.  
  408. xs_vec_mul_scalar(vNormal, 8192.0, vNormal);
  409. xs_vec_add(vNewOrigin, vNormal, vBeamEnd);
  410.  
  411. engfunc(EngFunc_TraceLine, vNewOrigin, vBeamEnd, IGNORE_MONSTERS, -1, 0);
  412.  
  413. get_tr2(0, TR_vecPlaneNormal, vNormal);
  414. get_tr2(0, TR_vecEndPos, vTracedBeamEnd);
  415.  
  416. // -- Save results to be used later.
  417. set_pev(i_Ent, LASERMINE_OWNER, id);
  418. set_pev(i_Ent,LASERMINE_BEAMENDPOINT,vTracedBeamEnd);
  419. set_pev(i_Ent,LASERMINE_TEAM,int:cs_get_user_team(id));
  420. new Float:fCurrTime = get_gametime();
  421.  
  422. set_pev(i_Ent,LASERMINE_POWERUP, fCurrTime + 2.5);
  423. set_pev(i_Ent,LASERMINE_STEP,POWERUP_THINK);
  424. set_pev(i_Ent,pev_nextthink, fCurrTime + 0.2);
  425.  
  426. PlaySound(i_Ent,POWERUP_SOUND);
  427. g_deployed[id]++;
  428. g_havemine[id]--;
  429. DeleteTask(id);
  430. ShowAmmo(id);
  431. return 1;
  432. }
  433.  
  434. stock TeamDeployedCount(id)
  435. {
  436. static i;
  437. static CsTeams:t;t = cs_get_user_team(id);
  438. static cnt;cnt=0;
  439.  
  440. for(i = 1;i <= g_MaxPL;i++)
  441. {
  442. if(is_user_connected(i))
  443. if(t == cs_get_user_team(i))
  444. cnt += g_deployed[i];
  445. }
  446.  
  447. return cnt;
  448. }
  449.  
  450. bool:CheckCanTeam(id)
  451. {
  452. new arg[5],CsTeam:num;
  453. get_pcvar_string(g_LCBT,arg,3);
  454. if(equali(arg,"Z"))
  455. {
  456. num = CsTeam:CS_TEAM_T;
  457. }
  458. else if(equali(arg,"H"))
  459. {
  460. num = CsTeam:CS_TEAM_CT;
  461. }
  462. else if(equali(arg,"ALL") || equali(arg,"HZ") || equali(arg,"ZH"))
  463. {
  464. num = CsTeam:CS_TEAM_UNASSIGNED;
  465. }
  466. else
  467. {
  468. num = CsTeam:CS_TEAM_UNASSIGNED;
  469. }
  470. if(num != CsTeam:CS_TEAM_UNASSIGNED && num != CsTeam:cs_get_user_team(id))
  471. return false;
  472. return true;
  473. }
  474.  
  475. bool:CanCheck(id,mode) // Проверки: когда можно ставить мины
  476. {
  477. if(!get_pcvar_num(g_LENABLE))
  478. {
  479. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_NOTACTIVE")
  480.  
  481. return false;
  482. }
  483. if(get_pcvar_num(g_LACCESS) != 0)
  484. if(!(get_user_flags(id) & ADMIN_IMMUNITY))
  485. {
  486. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_NOACCESS")
  487. return false;
  488. }
  489. if(!pev_user_alive(id)) return false;
  490. if(!CheckCanTeam(id))
  491. {
  492. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_CBT")
  493. return false;
  494. }
  495. if(mode == 0)
  496. {
  497. if(g_havemine[id] <= 0)
  498. {
  499. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_DONTHAVEMINE")
  500. return false;
  501. }
  502. }
  503. if(mode == 1)
  504. {
  505. if(get_pcvar_num(g_LBUYMODE) == 0)
  506. {
  507. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_CANTBUY")
  508. return false;
  509. }
  510. if(g_havemine[id] >= get_pcvar_num(g_LAMMO))
  511. {
  512. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_HAVEMAX")
  513. return false;
  514. }
  515. if(zp_get_user_ammo_packs(id) < get_pcvar_num(g_LCOST))
  516. {
  517. client_print(id, print_chat, "%L %L%d %L", id, "CHATTAG",id, "STR_NOMONEY",get_pcvar_num(g_LCOST),id, "STR_NEEDED")
  518. return false;
  519. }
  520. }
  521. if(!CheckTime(id))
  522. {
  523. client_print(id, print_chat, "%L %L %d %L", id, "CHATTAG",id, "STR_DELAY",get_pcvar_num(g_LDELAY)-g_nowtime,id, "STR_SECONDS")
  524. return false;
  525. }
  526.  
  527. return true;
  528. }
  529.  
  530. bool:ReturnCheck(id)
  531. {
  532. if(!CanCheck(id,-1)) return false;
  533. if(g_havemine[id] + 1 > get_pcvar_num(g_LAMMO)) return false;
  534. new tgt,body,Float:vo[3],Float:to[3];
  535. get_user_aiming(id,tgt,body);
  536. if(!pev_valid(tgt)) return false;
  537. pev(id,pev_origin,vo);
  538. pev(tgt,pev_origin,to);
  539. if(get_distance_f(vo,to) > 70.0) return false;
  540. new EntityName[32];
  541. pev(tgt, pev_classname, EntityName, 31);
  542. if(!equal(EntityName, ENT_CLASS_NAME)) return false;
  543. if(pev(tgt,LASERMINE_OWNER) != id) return false;
  544. return true;
  545. }
  546.  
  547. bool:CreateCheck(id)
  548. {
  549. if(!CanCheck(id,0)) return false;
  550.  
  551. // Проверка на разрешение
  552. if(!zp_has_round_started() && get_pcvar_num(g_NOROUND))
  553. {
  554. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_NOROUND")
  555. return false;
  556. }
  557.  
  558. if(zp_is_nemesis_round() && get_pcvar_num(g_NEMROUND))
  559. {
  560. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_NEMROUND")
  561. return false;
  562. }
  563.  
  564. if(zp_is_survivor_round() && get_pcvar_num(g_SURVROUND))
  565. {
  566. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_SURVROUND")
  567. return false;
  568. }
  569.  
  570. if(zp_is_swarm_round() && get_pcvar_num(g_SWARMROUND))
  571. {
  572. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_SWARMROUND")
  573. return false;
  574. }
  575.  
  576. if(g_deployed[id] >= get_pcvar_num(g_LAMMO))
  577. {
  578. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_MAXDEPLOY")
  579. return false;
  580. }
  581.  
  582. if(TeamDeployedCount(id) >= get_pcvar_num(g_LTMAX))
  583. {
  584. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_MANYPPL")
  585. return false;
  586. }
  587. new Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vOrigin[3];
  588. pev(id, pev_origin, vOrigin);
  589. velocity_by_aim(id, 128, vTraceDirection);
  590. xs_vec_add(vTraceDirection, vOrigin, vTraceEnd);
  591. engfunc(EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0);
  592. new Float:fFraction,Float:vTraceNormal[3];
  593. get_tr2(0, TR_flFraction, fFraction);
  594. // -- We hit something!
  595. if(fFraction < 1.0)
  596. {
  597. // -- Save results to be used later.
  598. get_tr2(0, TR_vecEndPos, vTraceEnd);
  599. get_tr2(0, TR_vecPlaneNormal, vTraceNormal);
  600.  
  601. return true;
  602. }
  603.  
  604. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_PLANTWALL")
  605. DeleteTask(id);
  606. // -- Did not touched something. (not solid)
  607. return false;
  608. }
  609.  
  610. public ltm_Think(i_Ent)
  611. {
  612. if(!pev_valid(i_Ent))
  613. return FMRES_IGNORED;
  614. new EntityName[32];
  615. pev(i_Ent, pev_classname, EntityName, 31);
  616. if(!get_pcvar_num(g_LENABLE)) return FMRES_IGNORED;
  617. // -- Entity is not a tripmine, ignoring the next...
  618. if(!equal(EntityName, ENT_CLASS_NAME))
  619. return FMRES_IGNORED;
  620.  
  621. static Float:fCurrTime;
  622. fCurrTime = get_gametime();
  623.  
  624. switch(pev(i_Ent, LASERMINE_STEP))
  625. {
  626. case POWERUP_THINK :
  627. {
  628. new Float:fPowerupTime;
  629. pev(i_Ent, LASERMINE_POWERUP, fPowerupTime);
  630.  
  631. if(fCurrTime > fPowerupTime)
  632. {
  633. set_pev(i_Ent, pev_solid, SOLID_BBOX);
  634. set_pev(i_Ent, LASERMINE_STEP, BEAMBREAK_THINK);
  635.  
  636. PlaySound(i_Ent, ACTIVATE_SOUND);
  637. }
  638. if(get_pcvar_num(g_LGLOW)!=0)
  639. {
  640. if(get_pcvar_num(g_LCLMODE)==0)
  641. {
  642. switch (pev(i_Ent,LASERMINE_TEAM))
  643. {
  644. // цвет лазера Зомби
  645. case CS_TEAM_T: set_rendering(i_Ent,kRenderFxGlowShell,Red_Zomb,Green_Zomb,Blue_Zomb,kRenderNormal,5);
  646. // цвет лазера Человека
  647. case CS_TEAM_CT:set_rendering(i_Ent,kRenderFxGlowShell,Red_Hum,Green_Hum,Blue_Hum,kRenderNormal,5);
  648. }
  649. }else
  650. {
  651. // цвет лазера, если стоит "одинаковый для всех" цвет
  652. set_rendering(i_Ent,kRenderFxGlowShell,random_num(50 , 200),random_num(50 , 200),random_num(50 , 200),kRenderNormal,5);
  653. }
  654. }
  655. set_pev(i_Ent, pev_nextthink, fCurrTime + 0.1);
  656. }
  657. case BEAMBREAK_THINK :
  658. {
  659. static Float:vEnd[3],Float:vOrigin[3];
  660. pev(i_Ent, pev_origin, vOrigin);
  661. pev(i_Ent, LASERMINE_BEAMENDPOINT, vEnd);
  662.  
  663. static iHit, Float:fFraction;
  664. engfunc(EngFunc_TraceLine, vOrigin, vEnd, DONT_IGNORE_MONSTERS, i_Ent, 0);
  665.  
  666. get_tr2(0, TR_flFraction, fFraction);
  667. iHit = get_tr2(0, TR_pHit);
  668.  
  669. // -- Something has passed the laser.
  670. if(fFraction < 1.0)
  671. {
  672. // -- Ignoring others tripmines entity.
  673. if(pev_valid(iHit))
  674. {
  675. pev(iHit, pev_classname, EntityName, 31);
  676. // Игнорим всякую хрень
  677. if(!equal(EntityName, ENT_CLASS_NAME) && !equal(EntityName, gSnarkClassName) && !equal(EntityName, barnacle_class) && !equal(EntityName, weapon_box))
  678. {
  679. set_pev(i_Ent, pev_enemy, iHit);
  680.  
  681. if(get_pcvar_num(g_LMODE) == MODE_LASERMINE)
  682. CreateLaserDamage(i_Ent,iHit);
  683. else
  684. if(get_pcvar_num(g_LFF) || CsTeams:pev(i_Ent,LASERMINE_TEAM) != cs_get_user_team(iHit))
  685. set_pev(i_Ent, LASERMINE_STEP, EXPLOSE_THINK);
  686.  
  687. if (!pev_valid(i_Ent)) // если не верный объект - ничего не делаем. Спасибо DJ_WEST
  688. return FMRES_IGNORED;
  689.  
  690. set_pev(i_Ent, pev_nextthink, fCurrTime + random_float(0.1, 0.3));
  691. }
  692. }
  693. }
  694. if(get_pcvar_num(g_LDMGMODE)!=0)
  695. if(pev(i_Ent,LASERMINE_HITING) != iHit)
  696. set_pev(i_Ent,LASERMINE_HITING,iHit);
  697.  
  698. // -- Tripmine is still there.
  699. if(pev_valid(i_Ent))
  700. {
  701. static Float:fHealth;
  702. pev(i_Ent, pev_health, fHealth);
  703.  
  704. if(fHealth <= 0.0 || (pev(i_Ent,pev_flags) & FL_KILLME))
  705. {
  706. set_pev(i_Ent, LASERMINE_STEP, EXPLOSE_THINK);
  707. set_pev(i_Ent, pev_nextthink, fCurrTime + random_float(0.1, 0.3));
  708. }
  709.  
  710. static Float:fBeamthink;
  711. pev(i_Ent, LASERMINE_BEAMTHINK, fBeamthink);
  712.  
  713. if(fBeamthink < fCurrTime && get_pcvar_num(g_LVISIBLE))
  714. {
  715. DrawLaser(i_Ent, vOrigin, vEnd);
  716. set_pev(i_Ent, LASERMINE_BEAMTHINK, fCurrTime + 0.1);
  717. }
  718. set_pev(i_Ent, pev_nextthink, fCurrTime + 0.01);
  719. }
  720. }
  721. case EXPLOSE_THINK :
  722. {
  723. // -- Stopping entity to think
  724. set_pev(i_Ent, pev_nextthink, 0.0);
  725. PlaySound(i_Ent, STOP_SOUND);
  726. g_deployed[pev(i_Ent,LASERMINE_OWNER)]--;
  727. CreateExplosion(i_Ent);
  728. CreateDamage(i_Ent,get_pcvar_float(g_LRDMG),get_pcvar_float(g_LRADIUS))
  729. RemoveEntity (i_Ent);
  730. }
  731. }
  732.  
  733. return FMRES_IGNORED;
  734. }
  735.  
  736. PlaySound(i_Ent, i_SoundType)
  737. {
  738. switch (i_SoundType)
  739. {
  740. case POWERUP_SOUND :
  741. {
  742. emit_sound(i_Ent, CHAN_VOICE, ENT_SOUND1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
  743. emit_sound(i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, 0, PITCH_NORM);
  744. }
  745. case ACTIVATE_SOUND :
  746. {
  747. emit_sound(i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, 1, 75);
  748. }
  749. case STOP_SOUND :
  750. {
  751. emit_sound(i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, SND_STOP, PITCH_NORM);
  752. emit_sound(i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, SND_STOP, 75);
  753. }
  754. }
  755. }
  756.  
  757. DrawLaser(i_Ent, const Float:v_Origin[3], const Float:v_EndOrigin[3])
  758. {
  759. new tcolor[3];
  760. new teamid = pev(i_Ent, LASERMINE_TEAM);
  761. if(get_pcvar_num(g_LCLMODE) == 0)
  762. {
  763. switch(teamid){
  764. case 1:{
  765. // Цвет луча для Зомби
  766. tcolor[0] = Red_Zomb;
  767. tcolor[1] = Green_Zomb;
  768. tcolor[2] = Blue_Zomb;
  769. }
  770. case 2:{
  771. // Цвет луча для Человека
  772. tcolor[0] = Red_Hum;
  773. tcolor[1] = Green_Hum;
  774. tcolor[2] = Blue_Hum;
  775. }
  776. }
  777. }else
  778. {
  779. // Цвет луча для всез при режиме 1-н луч для всех
  780. tcolor[0] = random_num(50 , 200);
  781. tcolor[1] = random_num(50 , 200);
  782. tcolor[2] = random_num(50 , 200);
  783. }
  784. message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
  785. write_byte(TE_BEAMPOINTS);
  786. engfunc(EngFunc_WriteCoord,v_Origin[0]);
  787. engfunc(EngFunc_WriteCoord,v_Origin[1]);
  788. engfunc(EngFunc_WriteCoord,v_Origin[2]);
  789. engfunc(EngFunc_WriteCoord,v_EndOrigin[0]); //Random
  790. engfunc(EngFunc_WriteCoord,v_EndOrigin[1]); //Random
  791. engfunc(EngFunc_WriteCoord,v_EndOrigin[2]); //Random
  792. write_short(beam);
  793. write_byte(0);
  794. write_byte(0);
  795. write_byte(1); //Life
  796. write_byte(5); //Width
  797. write_byte(0); //wave
  798. write_byte(tcolor[0]); // r
  799. write_byte(tcolor[1]); // g
  800. write_byte(tcolor[2]); // b
  801. write_byte(get_pcvar_num(g_LCBRIGHT));
  802. write_byte(255);
  803. message_end();
  804. }
  805.  
  806. CreateDamage(iCurrent,Float:DmgMAX,Float:Radius)
  807. {
  808. // Get given parameters
  809. new Float:vecSrc[3];
  810. pev(iCurrent, pev_origin, vecSrc);
  811.  
  812. new AtkID =pev(iCurrent,LASERMINE_OWNER);
  813. new TeamID=pev(iCurrent,LASERMINE_TEAM);
  814.  
  815. new ent = -1;
  816. new Float:tmpdmg = DmgMAX;
  817.  
  818. new Float:kickback = 0.0;
  819. // Needed for doing some nice calculations <!-- s:P --><img src=\"{SMILIES_PATH}/icon_razz.gif\" alt=\":P\" title=\"vicces\" /><!-- s:P -->
  820. new Float:Tabsmin[3], Float:Tabsmax[3];
  821. new Float:vecSpot[3];
  822. new Float:Aabsmin[3], Float:Aabsmax[3];
  823. new Float:vecSee[3];
  824. new trRes;
  825. new Float:flFraction;
  826. new Float:vecEndPos[3];
  827. new Float:distance;
  828. new Float:origin[3], Float:vecPush[3];
  829. new Float:invlen;
  830. new Float:velocity[3];
  831. new iHitHP,iHitTeam;
  832. // Calculate falloff
  833. new Float:falloff;
  834. if(Radius > 0.0)
  835. {
  836. falloff = DmgMAX / Radius;
  837. } else {
  838. falloff = 1.0;
  839. }
  840. // Find monsters and players inside a specifiec radius
  841. while((ent = engfunc(EngFunc_FindEntityInSphere, ent, vecSrc, Radius)) != 0)
  842. {
  843. if(!pev_valid(ent)) continue;
  844. if(!(pev(ent, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER)))
  845. {
  846. // Entity is not a player or monster, ignore it
  847. continue;
  848. }
  849. if(!pev_user_alive(ent)) continue;
  850. // Reset data
  851. kickback = 1.0;
  852. tmpdmg = DmgMAX;
  853. // The following calculations are provided by Orangutanz, THANKS!
  854. // We use absmin and absmax for the most accurate information
  855. pev(ent, pev_absmin, Tabsmin);
  856. pev(ent, pev_absmax, Tabsmax);
  857. xs_vec_add(Tabsmin,Tabsmax,Tabsmin);
  858. xs_vec_mul_scalar(Tabsmin,0.5,vecSpot);
  859. pev(iCurrent, pev_absmin, Aabsmin);
  860. pev(iCurrent, pev_absmax, Aabsmax);
  861. xs_vec_add(Aabsmin,Aabsmax,Aabsmin);
  862. xs_vec_mul_scalar(Aabsmin,0.5,vecSee);
  863. engfunc(EngFunc_TraceLine, vecSee, vecSpot, 0, iCurrent, trRes);
  864. get_tr2(trRes, TR_flFraction, flFraction);
  865. // Explosion can 'see' this entity, so hurt them! (or impact through objects has been enabled xD)
  866. if(flFraction >= 0.9 || get_tr2(trRes, TR_pHit) == ent)
  867. {
  868. // Work out the distance between impact and entity
  869. get_tr2(trRes, TR_vecEndPos, vecEndPos);
  870. distance = get_distance_f(vecSrc, vecEndPos) * falloff;
  871. tmpdmg -= distance;
  872. if(tmpdmg < 0.0)
  873. tmpdmg = 0.0;
  874. // Kickback Effect
  875. if(kickback != 0.0)
  876. {
  877. xs_vec_sub(vecSpot,vecSee,origin);
  878. invlen = 1.0/get_distance_f(vecSpot, vecSee);
  879.  
  880. xs_vec_mul_scalar(origin,invlen,vecPush);
  881. pev(ent, pev_velocity, velocity)
  882. xs_vec_mul_scalar(vecPush,tmpdmg,vecPush);
  883. xs_vec_mul_scalar(vecPush,kickback,vecPush);
  884. xs_vec_add(velocity,vecPush,velocity);
  885. if(tmpdmg < 60.0)
  886. {
  887. xs_vec_mul_scalar(velocity,12.0,velocity);
  888. } else {
  889. xs_vec_mul_scalar(velocity,4.0,velocity);
  890. }
  891. if(velocity[0] != 0.0 || velocity[1] != 0.0 || velocity[2] != 0.0)
  892. {
  893. // There's some movement todo <!-- s:) --><img src=\"{SMILIES_PATH}/icon_e_smile.gif\" alt=\":)\" title=\"mosoly\" /><!-- s:) -->
  894. set_pev(ent, pev_velocity, velocity)
  895. }
  896. }
  897.  
  898. iHitHP = pev_user_health(ent) - floatround(tmpdmg)
  899. iHitTeam = int:cs_get_user_team(ent)
  900. if(iHitHP <= 0)
  901. {
  902. if(iHitTeam != TeamID)
  903. {
  904. zp_set_user_ammo_packs(AtkID,zp_get_user_ammo_packs(AtkID) + get_pcvar_num(g_LFMONEY))
  905. set_score(AtkID,ent,1,iHitHP)
  906. }else
  907. {
  908. if(get_pcvar_num(g_LFF))
  909. {
  910. zp_set_user_ammo_packs(AtkID,zp_get_user_ammo_packs(AtkID) - get_pcvar_num(g_LFMONEY))
  911. set_score(AtkID,ent,-1,iHitHP)
  912. }
  913. }
  914. }else
  915. {
  916. if(iHitTeam != TeamID || get_pcvar_num(g_LFF))
  917. {
  918. //set_pev(Player,pev_health,iHitHP)
  919. set_user_health(ent, iHitHP)
  920. engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},ent);
  921. write_byte(floatround(tmpdmg))
  922. write_byte(floatround(tmpdmg))
  923. write_long(DMG_BULLET)
  924. engfunc(EngFunc_WriteCoord,vecSrc[0])
  925. engfunc(EngFunc_WriteCoord,vecSrc[1])
  926. engfunc(EngFunc_WriteCoord,vecSrc[2])
  927. message_end()
  928. }
  929. }
  930. }
  931. }
  932. return
  933. }
  934.  
  935. bool:pev_user_alive(ent)
  936. {
  937. new deadflag = pev(ent,pev_deadflag);
  938. if(deadflag != DEAD_NO)
  939. return false;
  940. return true;
  941. }
  942.  
  943. CreateExplosion(iCurrent)
  944. {
  945. new Float:vOrigin[3];
  946. pev(iCurrent,pev_origin,vOrigin);
  947.  
  948. message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
  949. write_byte(99); //99 = KillBeam
  950. write_short(iCurrent);
  951. message_end();
  952.  
  953. engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vOrigin, 0);
  954. write_byte(TE_EXPLOSION);
  955. engfunc(EngFunc_WriteCoord,vOrigin[0]);
  956. engfunc(EngFunc_WriteCoord,vOrigin[1]);
  957. engfunc(EngFunc_WriteCoord,vOrigin[2]);
  958. write_short(boom);
  959. write_byte(30);
  960. write_byte(15);
  961. write_byte(0);
  962. message_end();
  963. }
  964.  
  965. CreateLaserDamage(iCurrent,isHit)
  966. {
  967. if(isHit < 0) return PLUGIN_CONTINUE
  968. switch(get_pcvar_num(g_LDMGMODE))
  969. {
  970. case 1:
  971. {
  972. if(pev(iCurrent,LASERMINE_HITING) == isHit)
  973. return PLUGIN_CONTINUE
  974. }
  975. case 2:
  976. {
  977. if(pev(iCurrent,LASERMINE_HITING) == isHit)
  978. {
  979. static Float:cnt
  980. static now,htime;now = floatround(get_gametime())
  981.  
  982. pev(iCurrent,LASERMINE_COUNT,cnt)
  983. htime = floatround(cnt)
  984. if(now - htime < get_pcvar_num(g_LDSEC))
  985. {
  986. return PLUGIN_CONTINUE;
  987. }else{
  988. set_pev(iCurrent,LASERMINE_COUNT,get_gametime())
  989. }
  990. }else
  991. {
  992. set_pev(iCurrent,LASERMINE_COUNT,get_gametime())
  993. }
  994. }
  995. }
  996.  
  997. new Float:vOrigin[3],Float:vEnd[3]
  998. pev(iCurrent,pev_origin,vOrigin)
  999. pev(iCurrent,pev_vuser1,vEnd)
  1000.  
  1001. new teamid = pev(iCurrent, LASERMINE_TEAM)
  1002.  
  1003. new szClassName[32]
  1004. new Alive,God
  1005. new iHitTeam,iHitHP,id
  1006. new hitscore
  1007.  
  1008. szClassName[0] = '^0'
  1009. pev(isHit,pev_classname,szClassName,32)
  1010. if((pev(isHit, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER)))
  1011. {
  1012. Alive = pev_user_alive(isHit)
  1013. God = get_user_godmode(isHit)
  1014. if(!Alive || God) return PLUGIN_CONTINUE
  1015. iHitTeam = int:cs_get_user_team(isHit)
  1016. iHitHP = pev_user_health(isHit) - get_pcvar_num(g_LDMG)
  1017. id = pev(iCurrent,LASERMINE_OWNER)//, szNetName[32]
  1018. if(iHitHP <= 0)
  1019. {
  1020. if(iHitTeam != teamid)
  1021. {
  1022. emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM)
  1023. hitscore = 1
  1024. zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id) + get_pcvar_num(g_LFMONEY))
  1025. set_score(id,isHit,hitscore,iHitHP)
  1026. }else
  1027. {
  1028. if(get_pcvar_num(g_LFF))
  1029. {
  1030. emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM)
  1031. hitscore = -1
  1032. zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id) - get_pcvar_num(g_LFMONEY))
  1033. set_score(id,isHit,hitscore,iHitHP)
  1034. }
  1035. }
  1036. }else if(iHitTeam != teamid || get_pcvar_num(g_LFF))
  1037. {
  1038. emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM)
  1039. set_user_health(isHit,iHitHP)
  1040. set_pev(iCurrent,LASERMINE_HITING,isHit);
  1041. engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},isHit);
  1042. write_byte(get_pcvar_num(g_LDMG))
  1043. write_byte(get_pcvar_num(g_LDMG))
  1044. write_long(DMG_BULLET)
  1045. engfunc(EngFunc_WriteCoord,vOrigin[0])
  1046. engfunc(EngFunc_WriteCoord,vOrigin[1])
  1047. engfunc(EngFunc_WriteCoord,vOrigin[2])
  1048. message_end()
  1049. }
  1050. }else if(equal(szClassName, ENT_CLASS_NAME3))
  1051. {
  1052. new hl;
  1053. hl = pev_user_health(isHit);
  1054. set_user_health(isHit,hl-get_pcvar_num(g_LDMG));
  1055. }
  1056. return PLUGIN_CONTINUE
  1057. }
  1058.  
  1059. stock pev_user_health(id)
  1060. {
  1061. new Float:health
  1062. pev(id,pev_health,health)
  1063. return floatround(health)
  1064. }
  1065.  
  1066. stock set_user_health(id,health)
  1067. {
  1068. health > 0 ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);
  1069. }
  1070.  
  1071. stock get_user_godmode(index) {
  1072. new Float:val
  1073. pev(index, pev_takedamage, val)
  1074.  
  1075. return (val == DAMAGE_NO)
  1076. }
  1077.  
  1078. stock set_user_frags(index, frags)
  1079. {
  1080. set_pev(index, pev_frags, float(frags))
  1081.  
  1082. return 1
  1083. }
  1084.  
  1085. stock pev_user_frags(index)
  1086. {
  1087. new Float:frags;
  1088. pev(index,pev_frags,frags);
  1089. return floatround(frags);
  1090. }
  1091.  
  1092. set_score(id,target,hitscore,HP){
  1093.  
  1094. new idfrags = pev_user_frags(id) + hitscore// get_user_frags(id) + hitscore
  1095. set_user_frags(id,idfrags)
  1096. new tarfrags = pev_user_frags(target) + 1 //get_user_frags(target) + 1
  1097. set_user_frags(target,tarfrags)
  1098. new idteam = int:cs_get_user_team(id)
  1099. new iddeaths = cs_get_user_deaths(id)
  1100.  
  1101.  
  1102. message_begin(MSG_ALL, g_msgDeathMsg, {0, 0, 0} ,0)
  1103. write_byte(id)
  1104. write_byte(target)
  1105. write_byte(0)
  1106. write_string(ENT_CLASS_NAME)
  1107. message_end()
  1108.  
  1109. message_begin(MSG_ALL, g_msgScoreInfo)
  1110. write_byte(id)
  1111. write_short(idfrags)
  1112. write_short(iddeaths)
  1113. write_short(0)
  1114. write_short(idteam)
  1115. message_end()
  1116.  
  1117. set_msg_block(g_msgDeathMsg, BLOCK_ONCE)
  1118.  
  1119. set_user_health(target, HP)
  1120.  
  1121. }
  1122.  
  1123. public BuyLasermine(id)
  1124. {
  1125. if(!CanCheck(id,1)) return PLUGIN_CONTINUE
  1126.  
  1127. g_havemine[id]++;
  1128.  
  1129. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_BOUGHT")
  1130.  
  1131. emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  1132. ShowAmmo(id)
  1133. return PLUGIN_HANDLED
  1134. }
  1135.  
  1136. public BuyLasermineChat(id)
  1137. {
  1138. if(!CanCheck(id,1)) return PLUGIN_CONTINUE
  1139.  
  1140. zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id) - get_pcvar_num(g_LCOST))
  1141. g_havemine[id]++;
  1142.  
  1143. client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_BOUGHT")
  1144.  
  1145. emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  1146. ShowAmmo(id)
  1147. return PLUGIN_HANDLED
  1148. }
  1149.  
  1150. public zp_extra_item_selected(id, itemid)
  1151. {
  1152. if(itemid == g_LME)
  1153. BuyLasermine(id)
  1154.  
  1155. if(g_havemine[id] >= get_pcvar_num(g_LAMMO))
  1156. return ZP_PLUGIN_HANDLED
  1157.  
  1158. return PLUGIN_CONTINUE
  1159. }
  1160.  
  1161. ShowAmmo(id)
  1162. {
  1163. new ammo[51]
  1164. new PlugStat[ 555 char ];
  1165. formatex(PlugStat, charsmax(PlugStat), "%L", LANG_PLAYER, "STR_STATE")
  1166. formatex(ammo, 50, "%s %i/%i",PlugStat, g_havemine[id],get_pcvar_num(g_LAMMO))
  1167.  
  1168. message_begin(MSG_ONE, g_msgStatusText, {0,0,0}, id)
  1169. write_byte(0)
  1170. write_string(ammo)
  1171. message_end()
  1172. }
  1173.  
  1174. public showInfo(id)
  1175. {
  1176. client_print(id, print_chat, "%L", id, "STR_REF")
  1177. }
  1178.  
  1179. public say_lasermine(id){
  1180. new said[32]
  1181. read_argv(1,said,31);
  1182. if(!get_pcvar_num(g_LENABLE))
  1183. {
  1184. return PLUGIN_CONTINUE
  1185. }
  1186. if(equali(said,"/buy lasermine")||equali(said,"/lm")||equali(said,"buy_lasermine")){
  1187. BuyLasermineChat(id)
  1188. }else if(equali(said, "lasermine") || equali(said, "/lasermine")){
  1189. const SIZE = 1024
  1190. new msg[SIZE+1],len = 0;
  1191. len += formatex(msg[len], SIZE - len, "<html><body>")
  1192. len += formatex(msg[len], SIZE - len, "<p><b>Lezer</b></p><br/><br/>")
  1193. len += formatex(msg[len], SIZE - len, "<p>Fel tudsz tenni a falra lezert.</p><br/>")
  1194. len += formatex(msg[len], SIZE - len, "<p>A lezer megoli az ellenfeleket, ha belemennek!</p><br/><br/>")
  1195. len += formatex(msg[len], SIZE - len, "<p><b>Lezer parancsok:</b></p><br/><br/>")
  1196. len += formatex(msg[len], SIZE - len, "<p><b>Ird: /buy lasermine</b> vagy <b>/lm</b> hogy lezert vehess!<br/>")
  1197. len += formatex(msg[len], SIZE - len, "<b>buy_lasermine</b> //Hogy F2-vel lezert vehess, ird a consolba: bind ^"F2^" buy_lasermine<br/>")
  1198. len += formatex(msg[len], SIZE - len, "<b>+setlaser</b> //bind mouse3 +setlaser : using mouse3 set lasermine on wall<br/>")
  1199. len += formatex(msg[len], SIZE - len, "</body></html>")
  1200. show_motd(id, msg, "Lasermine Entity help")
  1201. return PLUGIN_CONTINUE
  1202. }
  1203. else if(containi(said, "laser") != -1) {
  1204. showInfo(id)
  1205. return PLUGIN_CONTINUE
  1206. }
  1207. return PLUGIN_CONTINUE
  1208. }
  1209.  
  1210. public standing(id)
  1211. {
  1212. if(!g_settinglaser[id])
  1213. return PLUGIN_CONTINUE
  1214.  
  1215. set_pev(id, pev_maxspeed, 1.0)
  1216.  
  1217. return PLUGIN_CONTINUE
  1218. }
  1219.  
  1220. public ltm_PostThink(id)
  1221. {
  1222. if(!g_settinglaser[id] && plsetting[id]){
  1223. resetspeed(id)
  1224. }
  1225. else if(g_settinglaser[id] && !plsetting[id]) {
  1226. pev(id, pev_maxspeed,plspeed[id])
  1227. set_pev(id, pev_maxspeed, 1.0)
  1228. }
  1229. plsetting[id] = g_settinglaser[id]
  1230. return FMRES_IGNORED
  1231. }
  1232.  
  1233. public ltm_PreThink(id)
  1234. {
  1235. if(!pev_user_alive(id) || g_settinglaser[id] == true || is_user_bot(id) || get_pcvar_num(g_LCMDMODE) == 1)
  1236. return FMRES_IGNORED;
  1237.  
  1238. if(pev(id, pev_button) & IN_USE && !(pev(id, pev_oldbuttons) & IN_USE))
  1239. CreateLaserMine_Progress(id)
  1240. return FMRES_IGNORED;
  1241. }
  1242.  
  1243. resetspeed(id)
  1244. {
  1245. set_pev(id, pev_maxspeed, plspeed[id])
  1246. }
  1247.  
  1248. public client_putinserver(id){
  1249. g_deployed[id] = 0;
  1250. g_havemine[id] = 0;
  1251. DeleteTask(id);
  1252. return PLUGIN_CONTINUE
  1253. }
  1254.  
  1255. public client_disconnect(id){
  1256. if(!get_pcvar_num(g_LENABLE))
  1257. return PLUGIN_CONTINUE
  1258. DeleteTask(id);
  1259. RemoveAllTripmines(id);
  1260. return PLUGIN_CONTINUE
  1261. }
  1262.  
  1263.  
  1264. public newround(id){
  1265. if(!get_pcvar_num(g_LENABLE))
  1266. return PLUGIN_CONTINUE
  1267. pev(id, pev_maxspeed,plspeed[id])
  1268. DeleteTask(id);
  1269. RemoveAllTripmines(id);
  1270. //client_print(id, print_chat, "[ZP][LM][DeBug] All Mines removied!");
  1271. delaycount(id);
  1272. SetStartAmmo(id);
  1273. return PLUGIN_CONTINUE
  1274. }
  1275.  
  1276. public endround(id)
  1277. {
  1278. if(!get_pcvar_num(g_LENABLE))
  1279. return PLUGIN_CONTINUE
  1280.  
  1281. // Удаление мин после конца раунда
  1282. DeleteTask(id);
  1283. RemoveAllTripmines(id);
  1284.  
  1285. return PLUGIN_CONTINUE
  1286. }
  1287.  
  1288. public DeathEvent(){
  1289. if(!get_pcvar_num(g_LENABLE))
  1290. return PLUGIN_CONTINUE
  1291.  
  1292. new id = read_data(2)
  1293. if(is_user_connected(id)) DeleteTask(id);
  1294. return PLUGIN_CONTINUE
  1295. }
  1296.  
  1297. public RemoveAllTripmines(i_Owner)
  1298. {
  1299. new iEnt = g_MaxPL + 1;
  1300. new clsname[32];
  1301. while((iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", ENT_CLASS_NAME)))
  1302. {
  1303. if(i_Owner)
  1304. {
  1305. if(pev(iEnt, LASERMINE_OWNER) != i_Owner)
  1306. continue;
  1307. clsname[0] = '^0'
  1308. pev(iEnt, pev_classname, clsname, sizeof(clsname)-1);
  1309. if(equali(clsname, ENT_CLASS_NAME))
  1310. {
  1311. PlaySound(iEnt, STOP_SOUND);
  1312. RemoveEntity(iEnt);
  1313. }
  1314. }
  1315. else
  1316. set_pev(iEnt, pev_flags, FL_KILLME);
  1317. }
  1318. g_deployed[i_Owner]=0;
  1319. }
  1320.  
  1321. SetStartAmmo(id)
  1322. {
  1323. new stammo = get_pcvar_num(g_LSTAMMO);
  1324. if(stammo <= 0) return PLUGIN_CONTINUE;
  1325. g_havemine[id] = (g_havemine[id] <= stammo) ? stammo : g_havemine[id];
  1326. return PLUGIN_CONTINUE;
  1327. }
  1328.  
  1329. public CutDeploy_onDamage(id)
  1330. {
  1331. if(get_user_health(id) < 1)
  1332. DeleteTask(id);
  1333. }
  1334.  
  1335. DeleteTask(id)
  1336. {
  1337. if(task_exists((TASK_PLANT + id)))
  1338. {
  1339. remove_task((TASK_PLANT + id))
  1340. }
  1341. if(task_exists((TASK_RELEASE + id)))
  1342. {
  1343. remove_task((TASK_RELEASE + id))
  1344. }
  1345. g_settinglaser[id] = false
  1346. return PLUGIN_CONTINUE;
  1347. }
  1348.  
  1349. stock set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
  1350. {
  1351. static Float:RenderColor[3];
  1352. RenderColor[0] = float(r);
  1353. RenderColor[1] = float(g);
  1354. RenderColor[2] = float(b);
  1355.  
  1356. set_pev(entity, pev_renderfx, fx);
  1357. set_pev(entity, pev_rendercolor, RenderColor);
  1358. set_pev(entity, pev_rendermode, render);
  1359. set_pev(entity, pev_renderamt, float(amount));
  1360.  
  1361. return 1
  1362. }
  1363.  
  1364. // Gets offset data
  1365. get_offset_value(id, type)
  1366. {
  1367. new key = -1;
  1368. switch(type)
  1369. {
  1370. case OFFSET_TEAM: key = OFFSET_TEAM;
  1371. case OFFSET_MONEY:
  1372. key = OFFSET_MONEY;
  1373. case OFFSET_DEATH: key = OFFSET_DEATH;
  1374. }
  1375. if(key != -1)
  1376. {
  1377. if(is_amd64_server()) key += 25;
  1378. return get_pdata_int(id, key);
  1379. }
  1380. return -1;
  1381. }
  1382. stock print_color(const id, const input[], any:...)
  1383. {
  1384. new count = 1, players[32]
  1385. static msg[191]
  1386. vformat(msg, 190, input, 3)
  1387.  
  1388. replace_all(msg, 190, "!g", "^4")
  1389. replace_all(msg, 190, "!y", "^1")
  1390. replace_all(msg, 190, "!t", "^3")
  1391. replace_all(msg, 190, "á", "á")
  1392. replace_all(msg, 190, "é", "Ă©")
  1393. replace_all(msg, 190, "í", "Ă­")
  1394. replace_all(msg, 190, "ó", "Ăł")
  1395. replace_all(msg, 190, "ö", "ö")
  1396. replace_all(msg, 190, "ő", "Ĺ‘")
  1397. replace_all(msg, 190, "ú", "Ăş")
  1398. replace_all(msg, 190, "ü", "ĂĽ")
  1399. replace_all(msg, 190, "ű", "ű")
  1400. replace_all(msg, 190, "Á", "Á")
  1401. replace_all(msg, 190, "É", "É")
  1402. replace_all(msg, 190, "Í", "ĂŤ")
  1403. replace_all(msg, 190, "Ó", "Ă“")
  1404. replace_all(msg, 190, "Ö", "Ă–")
  1405. replace_all(msg, 190, "Ő", "Ő")
  1406. replace_all(msg, 190, "Ú", "Ăš")
  1407. replace_all(msg, 190, "Ü", "Ăś")
  1408. replace_all(msg, 190, "Ű", "Ĺ°")
  1409.  
  1410. if (id) players[0] = id; else get_players(players, count, "ch")
  1411. {
  1412. for (new i = 0; i < count; i++)
  1413. {
  1414. if (is_user_connected(players[i]))
  1415. {
  1416. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  1417. write_byte(players[i])
  1418. write_string(msg)
  1419. message_end()
  1420. }
  1421. }
  1422. }
  1423. return PLUGIN_HANDLED
  1424. }
  1425.  

_________________
Kép


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


Ki van itt

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