hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.05.24. 07:46



Jelenlévő felhasználók

Jelenleg 459 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 457 vendég

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

Regisztrált felhasználók: Bing [Bot], 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: Lézer Zombie Plauge 5.0
HozzászólásElküldve: 2012.12.10. 19:32 
Offline
Lelkes
Avatar

Csatlakozott: 2011.02.03. 17:33
Hozzászólások: 22
Megköszönt másnak: 2 alkalommal
Üdv! Az lenne a bajom, hogy a zombi szerverem (Zombie Plauge 5.0.8) változó időközönként kifagy (néha van olyan hogy óránként).
A logban ez van:
Kód:
L 11/18/2012 - 14:52:50: Start of error session.
L 11/18/2012 - 14:52:50: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20121118.log")
L 11/18/2012 - 14:52:50: [FAKEMETA] Invalid entity
L 11/18/2012 - 14:52:50: [AMXX] Displaying debug trace (plugin "zp_lasermine_28.amxx")
L 11/18/2012 - 14:52:50: [AMXX] Run time error 10: native error (native "set_pev")
L 11/18/2012 - 14:52:50: [AMXX]    [0] zp_lasermine_28.sma::ltm_Think (line 781)
L 11/18/2012 - 14:52:50: [AMXX]    [1] zp_lasermine_28.sma::ltm_Think (line 776)

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

Az lenne a kérésem hogy valaki kijavítaná hogy ne legyen baja, és még azt szeretném ha minden lézer a kör végén kikapcsoljon.


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 17 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