hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.04.27. 10:20



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: Google [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  [ 5 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Lasermine
HozzászólásElküldve: 2014.02.07. 20:04 
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 ezt szeretném átalakítani de van hozzá egy include ami egyik online átalakítóban sincs benne hogy tudnám átalakítani?

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

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Lasermine
HozzászólásElküldve: 2014.02.07. 20:07 
Offline
Tiszteletbeli
Avatar

Csatlakozott: 2011.08.15. 14:42
Hozzászólások: 1345
Megköszönt másnak: 10 alkalommal
Megköszönték neki: 277 alkalommal
Töltsd le az amxx studiot és azzal konvertálj: http://www.amxmodx.org/downloads.php

_________________
Üdvözlettel: BBk
[AmxModX] Általam fordított pluginok
Death of Legend Fun Server History
NetMozi.com - Filmes fórum Badboy.killer
foximaxi

Ők köszönték meg Badboy.killer nek ezt a hozzászólást: Tomos (2014.02.07. 21:59)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Lasermine
HozzászólásElküldve: 2014.02.07. 20:10 
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
Badboy.killer írta:
Töltsd le az amxx studiot és azzal konvertálj: http://www.amxmodx.org/downloads.php


Ehhez include hogy tudok hozzá adni?

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Lasermine
HozzászólásElküldve: 2014.02.07. 20:15 
Offline
Tiszteletbeli
Avatar

Csatlakozott: 2011.08.15. 14:42
Hozzászólások: 1345
Megköszönt másnak: 10 alkalommal
Megköszönték neki: 277 alkalommal
Tudtommal ez az összes include-t tartalmazza. De, ha mégsem, akkor megkeresed ahova telepítetted, majd compile/include mappa

_________________
Üdvözlettel: BBk
[AmxModX] Általam fordított pluginok
Death of Legend Fun Server History
NetMozi.com - Filmes fórum Badboy.killer
foximaxi


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Lasermine
HozzászólásElküldve: 2014.02.07. 20:35 
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
Badboy.killer írta:
Tudtommal ez az összes include-t tartalmazza. De, ha mégsem, akkor megkeresed ahova telepítetted, majd compile/include mappa


Nem tudnád átkonvertálni nekem és elküldeni privátba?

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


Ki van itt

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