- | Afiseaza codul
[code] #include <amxmodx> #include <fakemeta> #include <xs> #define PLUGIN "Tripmine" #define VERSION "2.3" #define AUTHOR "ExTreamCS" #define RemoveEntity(%1) engfunc(EngFunc_RemoveEntity,%1) #define TASK_PLANT 15100 #define TASK_RESET 15500 #define TASK_RELEASE 15900 #define LASERMINE_TEAM pev_iuser1//EV_INT_iuser1 #define LASERMINE_OWNER pev_iuser2 //EV_INT_iuser3 #define LASERMINE_STEP pev_iuser3 #define LASERMINE_HITING pev_iuser4 #define LASERMINE_COUNT pev_fuser1 #define LASERMINE_POWERUP pev_fuser2 #define LASERMINE_BEAMTHINK pev_fuser3 #define LASERMINE_BEAMENDPOINT pev_vuser1 #define MAX_MINES 10 #define MODE_LASERMINE 0 #define OFFSET_TEAM 114 #define OFFSET_MONEY 115 #define OFFSET_DEATH 444 #define cs_get_user_team(%1) CsTeams:get_offset_value(%1,OFFSET_TEAM) #define cs_get_user_deaths(%1) get_offset_value(%1,OFFSET_DEATH) #define cs_get_user_money(%1) get_offset_value(%1,OFFSET_MONEY) #define cs_set_user_money(%1,%2) set_offset_value(%1,OFFSET_MONEY,%2) enum CsTeams { CS_TEAM_UNASSIGNED = 0, CS_TEAM_T = 1, CS_TEAM_CT = 2, CS_TEAM_SPECTATOR = 3 }; enum tripmine_e { TRIPMINE_IDLE1 = 0, TRIPMINE_IDLE2, TRIPMINE_ARM1, TRIPMINE_ARM2, TRIPMINE_FIDGET, TRIPMINE_HOLSTER, TRIPMINE_DRAW, TRIPMINE_WORLD, TRIPMINE_GROUND, }; enum { POWERUP_THINK, BEAMBREAK_THINK, EXPLOSE_THINK }; enum { POWERUP_SOUND, ACTIVATE_SOUND, STOP_SOUND }; new const ENT_MODELS[] = "models/v_laser_new.mdl", ENT_SOUND1[] = "weapons/mine_deploy.wav", ENT_SOUND2[] = "weapons/mine_charge.wav", ENT_SOUND3[] = "weapons/mine_activate.wav", ENT_SOUND4[] = "debris/beamstart9.wav", ENT_SOUND5[] = "items/gunpickup2.wav", ENT_SOUND6[] = "debris/bustglass1.wav", ENT_SOUND7[] = "debris/bustglass2.wav", ENT_SPRITE1[] = "sprites/laserbeam.spr", ENT_SPRITE2[] = "sprites/zerogxplode.spr"; new const ENT_CLASS_NAME[] = "lasermine", ENT_CLASS_NAME3[] = "func_breakable"; new const CHATTAG[] = "[Lasermine]", STR_NOTACTIVE[] = "Laserele nu sunt activate.", STR_DONTHAVEMINE[] = "Nu ai nici un laser.", STR_MAXDEPLOY[] = "Numarul maxim de lasere a fost atins.", STR_MANYPPL[] = "Prea multe lasere in echipa ta...", STR_PLANTWALL[] = "Trebuie sa plantezi laserul pe zid!", STR_REF[] = "Refer to a lasermine rule with this server. say 'lasermine'", STR_CBT[] = "Esti Zombie!Nu poti cumpara si planta un laser.", STR_CANTBUY[] = "Nu poti cumpara pe acest server.", STR_HAVEMAX[] = "Ai numarul maxim de lasere.", STR_NOMONEY[] = "Nu ai destui bani sa cumperi un laser! ($", STR_NEEDED[] = "needed)", STR_DELAY[] = "Poti cumpara si planta lasere in", STR_SECONDS[] = "secunde.", STR_BOUGHT[] = "Tocmai ai cumparat un laser.", STR_STATE[] = "LaserMines Ammo:", STR_NOACCESS[] = "Nu ai acces la aceasta comanda."; new g_EntMine; new beam, boom new g_LENABLE,g_LFMONEY,g_LAMMO,g_LDMG, g_LTMAX,g_LCOST,g_LHEALTH,g_LMODE,g_LRADIUS,g_LRDMG,g_LFF,g_LCBT; new g_LDELAY,/*g_LTHINK,*/g_LVISIBLE, g_LSTAMMO,g_LACCESS,g_LGLOW,g_LDMGMODE,g_LCLMODE,g_LCBRIGHT,g_LDSEC,g_LCMDMODE,g_LBUYMODE; new g_dcount[33],g_nowtime,g_MaxPL new bool:g_settinglaser[33] new g_msgDeathMsg,g_msgScoreInfo,g_msgDamage,g_msgStatusText,g_msgMoney; new Float:plspeed[33] new plsetting[33] new g_havemine[33]; new g_deployed[33]; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("+setlaser","CreateLaserMine_Progress_b"); register_clcmd("-setlaser","StopCreateLaserMine"); register_clcmd("+dellaser","ReturnLaserMine_Progress"); register_clcmd("-dellaser","StopReturnLaserMine"); register_clcmd("say","say_lasermine"); register_clcmd("buy_lasermine","BuyLasermine"); g_LENABLE = register_cvar("amx_ltm","1"); g_LACCESS = register_cvar("amx_ltm_acs","0"); //0 all, 1 admin g_LMODE = register_cvar("amx_ltm_mode","0"); //0 lasermine, 1 tripmine g_LAMMO = register_cvar("amx_ltm_ammo","1"); g_LDMG = register_cvar("amx_ltm_dmg","10000"); //laser hit dmg g_LCOST = register_cvar("amx_ltm_cost","0"); g_LFMONEY = register_cvar("amx_ltm_fragmoney","0"); g_LHEALTH = register_cvar("amx_ltm_health","500"); g_LTMAX = register_cvar("amx_ltm_teammax","20"); g_LRADIUS = register_cvar("amx_ltm_radius","25.0"); g_LRDMG = register_cvar("amx_ltm_rdmg","1000"); //radius damage g_LFF = register_cvar("amx_ltm_ff","0"); g_LCBT = register_cvar("amx_ltm_cbt","ALL"); g_LBUYMODE = register_cvar("amx_ltm_buymode","1"); g_LDELAY = register_cvar("amx_ltm_delay","14"); g_LVISIBLE = register_cvar("amx_ltm_line","1"); g_LGLOW = register_cvar("amx_ltm_glow","1"); g_LCBRIGHT = register_cvar("amx_ltm_bright","255"); //laser line brightness. g_LCLMODE = register_cvar("amx_ltm_color","0"); //0 is team color,1 is green g_LDMGMODE = register_cvar("amx_ltm_ldmgmode","0"); //0 - frame dmg, 1 - once dmg, 2 - 1 second dmg g_LDSEC = register_cvar("amx_ltm_ldmgseconds","1"); //mode 2 only, damage / seconds. default 1 (sec) g_LSTAMMO = register_cvar("amx_ltm_startammo","2"); g_LCMDMODE = register_cvar("amx_ltm_cmdmode","1"); //0 is +USE key, 1 is bind, 2 is each. register_event("DeathMsg", "DeathEvent", "a"); register_event("CurWeapon", "standing", "be", "1=1"); register_event("ResetHUD", "delaycount", "a"); register_event("ResetHUD", "newround", "b"); register_event("Damage","CutDeploy_onDamage","b"); g_msgDeathMsg = get_user_msgid("DeathMsg"); g_msgScoreInfo = get_user_msgid("ScoreInfo"); g_msgDamage = get_user_msgid("Damage"); g_msgStatusText = get_user_msgid("StatusText"); g_msgMoney = get_user_msgid("Money"); register_forward(FM_Think, "ltm_Think" ); register_forward(FM_PlayerPostThink, "ltm_PostThink" ); register_forward(FM_PlayerPreThink, "ltm_PreThink"); } public plugin_precache() { precache_sound(ENT_SOUND1); precache_sound(ENT_SOUND2); precache_sound(ENT_SOUND3); precache_sound(ENT_SOUND4); precache_sound(ENT_SOUND5); precache_sound(ENT_SOUND6); precache_sound(ENT_SOUND7); precache_model(ENT_MODELS); beam = precache_model(ENT_SPRITE1); boom = precache_model(ENT_SPRITE2); return PLUGIN_CONTINUE; } public plugin_modules() { require_module("fakemeta"); require_module("cstrike"); } public plugin_cfg() { g_EntMine = engfunc(EngFunc_AllocString,ENT_CLASS_NAME3); arrayset(g_havemine,0,sizeof(g_havemine)); arrayset(g_deployed,0,sizeof(g_deployed)); g_MaxPL = get_maxplayers(); new file[64]; get_localinfo("amxx_configsdir",file,63); if(file_exists(file)) server_cmd("exec %s", file), server_exec(); } public delaycount(id) { g_dcount[id] = floatround(get_gametime()); } bool:CheckTime(id) { g_nowtime = floatround(get_gametime()) - g_dcount[id]; if(g_nowtime >= get_pcvar_num(g_LDELAY)) return true; return false; } public CreateLaserMine_Progress_b(id) { if(get_pcvar_num(g_LCMDMODE) != 0) CreateLaserMine_Progress(id); return PLUGIN_HANDLED; } public CreateLaserMine_Progress(id) { if (!CreateCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "Spawn", (TASK_PLANT + id)); return PLUGIN_HANDLED; } public ReturnLaserMine_Progress(id) { if (!ReturnCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "ReturnMine", (TASK_RELEASE + id)); return PLUGIN_HANDLED; } public StopCreateLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public StopReturnLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public ReturnMine(id) { id -= TASK_RELEASE; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return; if(pev(tgt,LASERMINE_OWNER) != id) return; RemoveEntity(tgt); g_havemine[id] ++; g_deployed[id] --; emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return; } public Spawn( id ) { id -= TASK_PLANT new i_Ent = engfunc(EngFunc_CreateNamedEntity,g_EntMine); if(!i_Ent) { client_print(id,print_chat,"[Laesrmine Debug] Can't Create Entity"); return PLUGIN_HANDLED_MAIN; } set_pev(i_Ent,pev_classname,ENT_CLASS_NAME); engfunc(EngFunc_SetModel,i_Ent,ENT_MODELS); set_pev(i_Ent,pev_solid,SOLID_NOT); set_pev(i_Ent,pev_movetype,MOVETYPE_FLY); set_pev(i_Ent,pev_frame,0); set_pev(i_Ent,pev_body,3); set_pev(i_Ent,pev_sequence,TRIPMINE_WORLD); set_pev(i_Ent,pev_framerate,0); set_pev(i_Ent,pev_takedamage,DAMAGE_YES); set_pev(i_Ent,pev_dmg,100.0); set_user_health(i_Ent,get_pcvar_num(g_LHEALTH)); new Float:vOrigin[3]; new Float:vNewOrigin[3],Float:vNormal[3],Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vEntAngles[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); } xs_vec_mul_scalar( vNormal, 8.0, vNormal ); xs_vec_add( vTraceEnd, vNormal, vNewOrigin ); engfunc(EngFunc_SetSize, i_Ent, Float:{ -4.0, -4.0, -4.0 }, Float:{ 4.0, 4.0, 4.0 } ); engfunc(EngFunc_SetOrigin, i_Ent, vNewOrigin ); vector_to_angle(vNormal,vEntAngles ); set_pev(i_Ent,pev_angles,vEntAngles ); new Float:vBeamEnd[3], Float:vTracedBeamEnd[3]; xs_vec_mul_scalar(vNormal, 8192.0, vNormal ); xs_vec_add( vNewOrigin, vNormal, vBeamEnd ); engfunc( EngFunc_TraceLine, vNewOrigin, vBeamEnd, IGNORE_MONSTERS, -1, 0 ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); get_tr2( 0, TR_vecEndPos, vTracedBeamEnd ); set_pev(i_Ent, LASERMINE_OWNER, id ); set_pev(i_Ent,LASERMINE_BEAMENDPOINT,vTracedBeamEnd); set_pev(i_Ent,LASERMINE_TEAM,int:cs_get_user_team(id)); new Float:fCurrTime = get_gametime(); set_pev(i_Ent,LASERMINE_POWERUP, fCurrTime + 2.5 ); set_pev(i_Ent,LASERMINE_STEP,POWERUP_THINK); set_pev(i_Ent,pev_nextthink, fCurrTime + 0.2 ); PlaySound(i_Ent,POWERUP_SOUND ); g_deployed[id]++; g_havemine[id]--; DeleteTask(id); ShowAmmo(id); return 1; } stock TeamDeployedCount(id) { static i; static CsTeams:t;t = cs_get_user_team(id); static cnt;cnt=0; for(i = 1;i <= g_MaxPL;i++) { if(is_user_connected(i)) if(t == cs_get_user_team(i)) cnt += g_deployed; } return cnt; } bool:CheckCanTeam(id) { new arg[5],CsTeam:num; get_pcvar_string(g_LCBT,arg,3); if(equali(arg,"T")) { num = CsTeam:CS_TEAM_T; } else if(equali(arg,"CT")) { num = CsTeam:CS_TEAM_CT; } else if(equali(arg,"ALL")) { num = CsTeam:CS_TEAM_UNASSIGNED; } else { num = CsTeam:CS_TEAM_UNASSIGNED; } if(num != CsTeam:CS_TEAM_UNASSIGNED && num != CsTeam:cs_get_user_team(id)) return false; return true; } bool:CanCheck(id,mode) { if( !get_pcvar_num( g_LENABLE ) ) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOTACTIVE); return false; } if( get_pcvar_num(g_LACCESS) != 0) if(!(get_user_flags(id) & ADMIN_IMMUNITY)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOACCESS); return false; } if(!pev_user_alive(id)) return false; if (!CheckCanTeam(id)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CBT); return false; } if( mode == 0) { if(g_havemine[id] <= 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_DONTHAVEMINE); return false; } } if (mode == 1) { if (get_pcvar_num(g_LBUYMODE) == 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CANTBUY); return false; } if (g_havemine[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_HAVEMAX); return false; } if (cs_get_user_money(id) < get_pcvar_num(g_LCOST)) { client_print(id, print_chat, "%s %s%d %s",CHATTAG, STR_NOMONEY,get_pcvar_num(g_LCOST),STR_NEEDED); return false; } } if(!CheckTime(id)) { client_print(id,print_chat, "%s %s %d %s",CHATTAG,STR_DELAY,get_pcvar_num(g_LDELAY)-g_nowtime,STR_SECONDS); return false; } return true; } bool:ReturnCheck( id ) { if(!CanCheck(id,-1)) return false; if(g_havemine[id] + 1 > get_pcvar_num(g_LAMMO)) return false; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return false; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return false; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return false; if(pev(tgt,LASERMINE_OWNER) != id) return false; return true; } bool:CreateCheck( id ) { if (!CanCheck(id,0)) return false; if (g_deployed[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MAXDEPLOY); return false; } //client_print(id,print_chat,"[Lasermine] your team deployed %d",TeamDeployedCount(id)) if(TeamDeployedCount(id) >= get_pcvar_num(g_LTMAX)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MANYPPL); return false; } new Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vOrigin[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction,Float:vTraceNormal[3]; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vTraceNormal ); return true; } client_print(id, print_chat, "%s %s",CHATTAG,STR_PLANTWALL) DeleteTask(id); return false; } public ltm_Think( i_Ent ) { if ( !pev_valid( i_Ent ) ) return FMRES_IGNORED; new EntityName[32]; pev( i_Ent, pev_classname, EntityName, 31); if(!get_pcvar_num(g_LENABLE)) return FMRES_IGNORED; if ( !equal( EntityName, ENT_CLASS_NAME ) ) return FMRES_IGNORED; static Float:fCurrTime; fCurrTime = get_gametime(); switch( pev( i_Ent, LASERMINE_STEP ) ) { case POWERUP_THINK : { new Float:fPowerupTime; pev( i_Ent, LASERMINE_POWERUP, fPowerupTime ); if( fCurrTime > fPowerupTime ) { set_pev( i_Ent, pev_solid, SOLID_BBOX ); set_pev( i_Ent, LASERMINE_STEP, BEAMBREAK_THINK ); PlaySound( i_Ent, ACTIVATE_SOUND ); } if(get_pcvar_num(g_LGLOW)!=0) { if(get_pcvar_num(g_LCLMODE)==0) { switch (pev(i_Ent,LASERMINE_TEAM)) { case CS_TEAM_T: set_rendering(i_Ent,kRenderFxGlowShell,255,0,0,kRenderNormal,5); case CS_TEAM_CT:set_rendering(i_Ent,kRenderFxGlowShell,0,0,255,kRenderNormal,5); } }else { set_rendering(i_Ent,kRenderFxGlowShell,0,255,0,kRenderNormal,5); } } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.1 ); } case BEAMBREAK_THINK : { static Float:vEnd[3],Float:vOrigin[3]; pev( i_Ent, pev_origin, vOrigin ); pev( i_Ent, LASERMINE_BEAMENDPOINT, vEnd ); static iHit, Float:fFraction; engfunc( EngFunc_TraceLine, vOrigin, vEnd, DONT_IGNORE_MONSTERS, i_Ent, 0 ); get_tr2( 0, TR_flFraction, fFraction ); iHit = get_tr2( 0, TR_pHit ); if ( fFraction < 1.0 ) { if(pev_valid(iHit)) { pev( iHit, pev_classname, EntityName, 31 ); if( !equal( EntityName, ENT_CLASS_NAME ) ) { set_pev( i_Ent, pev_enemy, iHit ); if(get_pcvar_num(g_LMODE) == MODE_LASERMINE) CreateLaserDamage(i_Ent,iHit); else if(get_pcvar_num(g_LFF) || CsTeams:pev(i_Ent,LASERMINE_TEAM) != cs_get_user_team(iHit)) set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } } } if(get_pcvar_num(g_LDMGMODE)!=0) if(pev(i_Ent,LASERMINE_HITING) != iHit) set_pev(i_Ent,LASERMINE_HITING,iHit); if ( pev_valid( i_Ent )) { static Float:fHealth; pev( i_Ent, pev_health, fHealth ); if( fHealth <= 0.0 || (pev(i_Ent,pev_flags) & FL_KILLME)) { set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } static Float:fBeamthink; pev( i_Ent, LASERMINE_BEAMTHINK, fBeamthink ); if( fBeamthink < fCurrTime && get_pcvar_num(g_LVISIBLE)) { DrawLaser(i_Ent, vOrigin, vEnd ); set_pev( i_Ent, LASERMINE_BEAMTHINK, fCurrTime + 0.1 ); } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.01 ); } } case EXPLOSE_THINK : { set_pev( i_Ent, pev_nextthink, 0.0 ); PlaySound( i_Ent, STOP_SOUND ); g_deployed[pev(i_Ent,LASERMINE_OWNER)]--; CreateExplosion( i_Ent ); CreateDamage(i_Ent,get_pcvar_float(g_LRDMG),get_pcvar_float(g_LRADIUS)) RemoveEntity ( i_Ent ); } } return FMRES_IGNORED; } PlaySound( i_Ent, i_SoundType ) { switch ( i_SoundType ) { case POWERUP_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, 0, PITCH_NORM ); } case ACTIVATE_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, 1, 75 ); } case STOP_SOUND : { emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, SND_STOP, PITCH_NORM ); emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, SND_STOP, 75 ); } } } DrawLaser(i_Ent, const Float:v_Origin[3], const Float:v_EndOrigin[3] ) { new tcolor[3]; new teamid = pev(i_Ent, LASERMINE_TEAM); if(get_pcvar_num(g_LCLMODE) == 0) { switch(teamid){ case 1:{ tcolor[0] = 255; tcolor[1] = 0; tcolor[2] = 0; } case 2:{ tcolor[0] = 0; tcolor[1] = 0; tcolor[2] = 255; } } }else { tcolor[0] = 0; tcolor[1] = 255; tcolor[2] = 0; } message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_BEAMPOINTS); engfunc(EngFunc_WriteCoord,v_Origin[0]); engfunc(EngFunc_WriteCoord,v_Origin[1]); engfunc(EngFunc_WriteCoord,v_Origin[2]); engfunc(EngFunc_WriteCoord,v_EndOrigin[0]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[1]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[2]); //Random write_short(beam); write_byte(0); write_byte(0); write_byte(1); //Life write_byte(5); //Width write_byte(0); //wave write_byte(tcolor[0]); // r write_byte(tcolor[1]); // g write_byte(tcolor[2]); // b write_byte(get_pcvar_num(g_LCBRIGHT)); write_byte(255); message_end(); } /* CreateDamage(iCurrent,DmgMAX,Float:Radius) { new AtkID = pev(iCurrent,LASERMINE_OWNER)// entity_get_int(iCurrent,LASERMINE_OWNER) new TeamID= pev(iCurrent,LASERMINE_TEAM) //entity_get_int(iCurrent,LASERMINE_INT_TEAM) new Player = -1; new Float:distance,dmg; new Float:tOrigin[3]; new Float:vOrigin[3]; new iHitHP,iHitTeam; pev(iCurrent,pev_origin,vOrigin); while((Player = engfunc(EngFunc_FindEntityInSphere, Player, vOrigin, Radius)) != 0) { if(is_user_alive(Player)) { pev(Player,pev_origin,tOrigin) distance = get_distance_f(vOrigin, tOrigin) dmg = floatround(DmgMAX - ((DmgMAX / Radius) * distance)) iHitHP = pev_user_health(Player) - dmg iHitTeam = int:bio_get_user_team(Player) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(Player, iHitHP) message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, {0,0,0}, Player) write_byte(dmg) write_byte(dmg) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } } } Player = engfunc(EngFunc_FindEntityInSphere,Player,vOrigin,Radius) } return PLUGIN_CONTINUE } */ CreateDamage(iCurrent,Float:DmgMAX,Float:Radius) { new Float:vecSrc[3]; pev(iCurrent, pev_origin, vecSrc); new AtkID =pev(iCurrent,LASERMINE_OWNER); new TeamID=pev(iCurrent,LASERMINE_TEAM); new ent = -1; new Float:tmpdmg = DmgMAX; new Float:kickback = 0.0; new Float:Tabsmin[3], Float:Tabsmax[3]; new Float:vecSpot[3]; new Float:Aabsmin[3], Float:Aabsmax[3]; new Float:vecSee[3]; new trRes; new Float:flFraction; new Float:vecEndPos[3]; new Float:distance; new Float:origin[3], Float:vecPush[3]; new Float:invlen; new Float:velocity[3]; new iHitHP,iHitTeam; new Float:falloff; if (Radius > 0.0) { falloff = DmgMAX / Radius; } else { falloff = 1.0; } while((ent = engfunc(EngFunc_FindEntityInSphere, ent, vecSrc, Radius)) != 0) { if(!pev_valid(ent)) continue; if(!(pev(ent, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { continue; } if(!pev_user_alive(ent)) continue; kickback = 1.0; tmpdmg = DmgMAX; pev(ent, pev_absmin, Tabsmin); pev(ent, pev_absmax, Tabsmax); xs_vec_add(Tabsmin,Tabsmax,Tabsmin); xs_vec_mul_scalar(Tabsmin,0.5,vecSpot); pev(iCurrent, pev_absmin, Aabsmin); pev(iCurrent, pev_absmax, Aabsmax); xs_vec_add(Aabsmin,Aabsmax,Aabsmin); xs_vec_mul_scalar(Aabsmin,0.5,vecSee); engfunc(EngFunc_TraceLine, vecSee, vecSpot, 0, iCurrent, trRes); get_tr2(trRes, TR_flFraction, flFraction); if (flFraction >= 0.9 || get_tr2(trRes, TR_pHit) == ent) { get_tr2(trRes, TR_vecEndPos, vecEndPos); distance = get_distance_f(vecSrc, vecEndPos) * falloff; tmpdmg -= distance; if(tmpdmg < 0.0) tmpdmg = 0.0; if(kickback != 0.0) { xs_vec_sub(vecSpot,vecSee,origin); invlen = 1.0/get_distance_f(vecSpot, vecSee); xs_vec_mul_scalar(origin,invlen,vecPush); pev(ent, pev_velocity, velocity) xs_vec_mul_scalar(vecPush,tmpdmg,vecPush); xs_vec_mul_scalar(vecPush,kickback,vecPush); xs_vec_add(velocity,vecPush,velocity); if(tmpdmg < 60.0) { xs_vec_mul_scalar(velocity,12.0,velocity); } else { xs_vec_mul_scalar(velocity,4.0,velocity); } if(velocity[0] != 0.0 || velocity[1] != 0.0 || velocity[2] != 0.0) { // There's some movement todo :) set_pev(ent, pev_velocity, velocity) } } iHitHP = pev_user_health(ent) - floatround(tmpdmg) iHitTeam = int:cs_get_user_team(ent) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(ent, iHitHP) engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},ent); write_byte(floatround(tmpdmg)) write_byte(floatround(tmpdmg)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vecSrc[0]) engfunc(EngFunc_WriteCoord,vecSrc[1]) engfunc(EngFunc_WriteCoord,vecSrc[2]) message_end() } } } } return } bool:pev_user_alive(ent) { new deadflag = pev(ent,pev_deadflag); if(deadflag != DEAD_NO) return false; return true; } CreateExplosion(iCurrent) { new Float:vOrigin[3]; pev(iCurrent,pev_origin,vOrigin); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(99); //99 = KillBeam write_short(iCurrent); message_end(); engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vOrigin, 0); write_byte(TE_EXPLOSION); engfunc(EngFunc_WriteCoord,vOrigin[0]); engfunc(EngFunc_WriteCoord,vOrigin[1]); engfunc(EngFunc_WriteCoord,vOrigin[2]); write_short(boom); write_byte(30); write_byte(15); write_byte(0); message_end(); } CreateLaserDamage(iCurrent,isHit) { if(isHit < 0 ) return PLUGIN_CONTINUE switch(get_pcvar_num(g_LDMGMODE)) { case 1: { if(pev(iCurrent,LASERMINE_HITING) == isHit) return PLUGIN_CONTINUE } case 2: { if(pev(iCurrent,LASERMINE_HITING) == isHit) { static Float:cnt static now,htime;now = floatround(get_gametime()) pev(iCurrent,LASERMINE_COUNT,cnt) htime = floatround(cnt) if(now - htime < get_pcvar_num(g_LDSEC)) { return PLUGIN_CONTINUE; }else{ set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } }else { set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } } } new Float:vOrigin[3],Float:vEnd[3] pev(iCurrent,pev_origin,vOrigin) pev(iCurrent,pev_vuser1,vEnd) new teamid = pev(iCurrent, LASERMINE_TEAM) new szClassName[32] new Alive,God new iHitTeam,iHitHP,id new hitscore szClassName[0] = '^0' pev(isHit,pev_classname,szClassName,32) if((pev(isHit, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { Alive = pev_user_alive(isHit) God = get_user_godmode(isHit) if(!Alive || God) return PLUGIN_CONTINUE iHitTeam = int:cs_get_user_team(isHit) iHitHP = pev_user_health(isHit) - get_pcvar_num(g_LDMG) id = pev(iCurrent,LASERMINE_OWNER)//, szNetName[32] if(iHitHP <= 0) { if(iHitTeam != teamid) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = 1 cs_set_user_money(id,cs_get_user_money(id) + get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) }else { if(get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = -1 cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) } } }else if(iHitTeam != teamid || get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) set_user_health(isHit,iHitHP) set_pev(iCurrent,LASERMINE_HITING,isHit); engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},isHit); write_byte(get_pcvar_num(g_LDMG)) write_byte(get_pcvar_num(g_LDMG)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } }else if(equal(szClassName, ENT_CLASS_NAME3)) { new hl; hl = pev_user_health(isHit); set_user_health(isHit,hl-get_pcvar_num(g_LDMG)); } return PLUGIN_CONTINUE } stock pev_user_health(id) { new Float:health pev(id,pev_health,health) return floatround(health) } stock set_user_health(id,health) { health > 0 ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id); } stock get_user_godmode(index) { new Float:val pev(index, pev_takedamage, val) return (val == DAMAGE_NO) } stock set_user_frags(index, frags) { set_pev(index, pev_frags, float(frags)) return 1 } stock pev_user_frags(index) { new Float:frags; pev(index,pev_frags,frags); return floatround(frags); } set_score(id,target,hitscore,HP){ new idfrags = pev_user_frags(id) + hitscore set_user_frags(id,idfrags) new tarfrags = pev_user_frags(target) + 1 set_user_frags(target,tarfrags) new idteam = int:cs_get_user_team(id) new iddeaths = cs_get_user_deaths(id) message_begin(MSG_ALL, g_msgDeathMsg, {0, 0, 0} ,0) write_byte(id) write_byte(target) write_byte(0) write_string(ENT_CLASS_NAME) message_end() message_begin(MSG_ALL, g_msgScoreInfo) write_byte(id) write_short(idfrags) write_short(iddeaths) write_short(0) write_short(idteam) message_end() set_msg_block(g_msgDeathMsg, BLOCK_ONCE) set_user_health(target, HP) } public BuyLasermine(id) { if( !CanCheck(id,1) ) return PLUGIN_CONTINUE cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LCOST)) g_havemine[id]++; client_print(id, print_chat, "%s %s",CHATTAG,STR_BOUGHT) emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return PLUGIN_HANDLED } ShowAmmo(id) { new ammo[51] formatex(ammo, 50, "%s %i/%i",STR_STATE, g_havemine[id],get_pcvar_num(g_LAMMO)) message_begin(MSG_ONE, g_msgStatusText, {0,0,0}, id) write_byte(0) write_string(ammo) message_end() } public showInfo(id) { client_print(id, print_chat, STR_REF) } public say_lasermine(id){ new said[32] read_argv(1,said,31); if( !get_pcvar_num( g_LENABLE ) ){ return PLUGIN_CONTINUE } if (equali(said,"/buy lasermine")||equali(said,"/lm")){ BuyLasermine(id) }else if (equali(said, "lasermine") || equali(said, "/lasermine")){ const SIZE = 1024 new msg[SIZE+1],len = 0; len += formatex(msg[len], SIZE - len, "<html><body>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p>You can be setting the mine on the wall.</p><br/>") len += formatex(msg[len], SIZE - len, "<p>That laser will give what touched it damage.</p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine Commands</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>Say /buy lasermine</b> or <b>Say /lm</b> //buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>buy_lasermine</b> //bind ^"F2^" buy_lasermine : using F2 buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>+setlaser</b> //bind mouse3 +setlaser : using mouse3 set lasermine on wall<br/>") len += formatex(msg[len], SIZE - len, "</body></html>") show_motd(id, msg, "Lasermine Entity help") return PLUGIN_CONTINUE } else if (containi(said, "laser") != -1) { showInfo(id) return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public standing(id) { if (!g_settinglaser[id]) return PLUGIN_CONTINUE set_pev(id, pev_maxspeed, 1.0) return PLUGIN_CONTINUE } public ltm_PostThink(id) { if (!g_settinglaser[id] && plsetting[id]){ resetspeed(id) } else if (g_settinglaser[id] && !plsetting[id]) { pev(id, pev_maxspeed,plspeed[id]) set_pev(id, pev_maxspeed, 1.0) } plsetting[id] = g_settinglaser[id] return FMRES_IGNORED } public ltm_PreThink(id) { if (!pev_user_alive(id) || g_settinglaser[id] == true || is_user_bot(id) || get_pcvar_num(g_LCMDMODE) == 1) return FMRES_IGNORED; if(pev(id, pev_button ) & IN_USE && !(pev(id, pev_oldbuttons ) & IN_USE )) CreateLaserMine_Progress(id) return FMRES_IGNORED; } resetspeed(id) { set_pev(id, pev_maxspeed, plspeed[id]) } public client_putinserver(id){ g_deployed[id] = 0; g_havemine[id] = 0; DeleteTask(id); return PLUGIN_CONTINUE } public client_disconnect(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE DeleteTask(id); RemoveAllTripmines(id); return PLUGIN_CONTINUE } public newround(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE pev(id, pev_maxspeed,plspeed[id]) DeleteTask(id); RemoveAllTripmines(id); delaycount(id); SetStartAmmo(id); return PLUGIN_CONTINUE } public DeathEvent(){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE new id = read_data(2) if(is_user_connected(id)) DeleteTask(id); return PLUGIN_CONTINUE } public RemoveAllTripmines( i_Owner ) { new iEnt = g_MaxPL + 1; new clsname[32]; while( ( iEnt = engfunc( EngFunc_FindEntityByString, iEnt, "classname", ENT_CLASS_NAME ) ) ) { if ( i_Owner ) { if( pev( iEnt, LASERMINE_OWNER ) != i_Owner ) continue; clsname[0] = '^0' pev( iEnt, pev_classname, clsname, sizeof(clsname)-1 ); if ( equali( clsname, ENT_CLASS_NAME ) ) { PlaySound( iEnt, STOP_SOUND ); RemoveEntity( iEnt ); } } else set_pev( iEnt, pev_flags, FL_KILLME ); } g_deployed[i_Owner]=0; } SetStartAmmo(id) { new stammo = get_pcvar_num(g_LSTAMMO); if(stammo <= 0) return PLUGIN_CONTINUE; g_havemine[id] = (g_havemine[id] <= stammo) ? stammo : g_havemine[id]; return PLUGIN_CONTINUE; } public CutDeploy_onDamage(id) { if(get_user_health(id) < 1) DeleteTask(id); } DeleteTask(id) { if (task_exists((TASK_PLANT + id))) { remove_task((TASK_PLANT + id)) } if (task_exists((TASK_RELEASE + id))) { remove_task((TASK_RELEASE + id)) } g_settinglaser[id] = false return PLUGIN_CONTINUE; } stock set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); set_pev(entity, pev_renderfx, fx); set_pev(entity, pev_rendercolor, RenderColor); set_pev(entity, pev_rendermode, render); set_pev(entity, pev_renderamt, float(amount)); return 1 } get_offset_value(id, type) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; return get_pdata_int(id, key); } return -1; } set_offset_value(id, type, value) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { message_begin(MSG_ONE_UNRELIABLE, g_msgMoney, {0,0,0}, id); write_long(value); write_byte(1); // Flash (difference between new and old money) message_end(); } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; set_pdata_int(id, key, value); } return PLUGIN_CONTINUE; } [/code]
Modificare lasemine mentru mod nemesis
Modificari necesare ale pluginurilor
Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com
- alynut
- Administrator
- Posts: 7121
- Joined: 02 Jul 2012, 06:31
- Detinator Steam: Da
- CS Status: In concediu, activez mai rar .
- SteamID: alynut991
- Reputatie: Fost Administrator
Fost Intermediar - Location: Bucuresti
- Has thanked: 183 times
- Been thanked: 441 times
Salut am acest plugin pentru lasere si vreau ca la modul nemesis sa nu aiba acces nimeni la lasere .
-
- Fost moderator
- Posts: 9362
- Joined: 06 Jul 2013, 22:08
- Detinator Steam: Da
- Detinator server CS: Nu
- Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn - Has thanked: 492 times
- Been thanked: 547 times
vezi asa daca merge:
- | Afiseaza codul
#include <amxmodx> //#include <zombieplague> #include <fakemeta> #include <xs> #define PLUGIN "Tripmine" #define VERSION "2.3" #define AUTHOR "ExTreamCS" #define RemoveEntity(%1) engfunc(EngFunc_RemoveEntity,%1) #define TASK_PLANT 15100 #define TASK_RESET 15500 #define TASK_RELEASE 15900 #define LASERMINE_TEAM pev_iuser1//EV_INT_iuser1 #define LASERMINE_OWNER pev_iuser2 //EV_INT_iuser3 #define LASERMINE_STEP pev_iuser3 #define LASERMINE_HITING pev_iuser4 #define LASERMINE_COUNT pev_fuser1 #define LASERMINE_POWERUP pev_fuser2 #define LASERMINE_BEAMTHINK pev_fuser3 #define LASERMINE_BEAMENDPOINT pev_vuser1 #define MAX_MINES 10 #define MODE_LASERMINE 0 #define OFFSET_TEAM 114 #define OFFSET_MONEY 115 #define OFFSET_DEATH 444 #define cs_get_user_team(%1) CsTeams:get_offset_value(%1,OFFSET_TEAM) #define cs_get_user_deaths(%1) get_offset_value(%1,OFFSET_DEATH) #define cs_get_user_money(%1) get_offset_value(%1,OFFSET_MONEY) #define cs_set_user_money(%1,%2) set_offset_value(%1,OFFSET_MONEY,%2) enum CsTeams { CS_TEAM_UNASSIGNED = 0, CS_TEAM_T = 1, CS_TEAM_CT = 2, CS_TEAM_SPECTATOR = 3 }; enum tripmine_e { TRIPMINE_IDLE1 = 0, TRIPMINE_IDLE2, TRIPMINE_ARM1, TRIPMINE_ARM2, TRIPMINE_FIDGET, TRIPMINE_HOLSTER, TRIPMINE_DRAW, TRIPMINE_WORLD, TRIPMINE_GROUND, }; enum { POWERUP_THINK, BEAMBREAK_THINK, EXPLOSE_THINK }; enum { POWERUP_SOUND, ACTIVATE_SOUND, STOP_SOUND }; new const ENT_MODELS[] = "models/v_laser_new.mdl", ENT_SOUND1[] = "weapons/mine_deploy.wav", ENT_SOUND2[] = "weapons/mine_charge.wav", ENT_SOUND3[] = "weapons/mine_activate.wav", ENT_SOUND4[] = "debris/beamstart9.wav", ENT_SOUND5[] = "items/gunpickup2.wav", ENT_SOUND6[] = "debris/bustglass1.wav", ENT_SOUND7[] = "debris/bustglass2.wav", ENT_SPRITE1[] = "sprites/laserbeam.spr", ENT_SPRITE2[] = "sprites/zerogxplode.spr"; new const ENT_CLASS_NAME[] = "lasermine", ENT_CLASS_NAME3[] = "func_breakable"; new const CHATTAG[] = "[Lasermine]", STR_NOTACTIVE[] = "Laserele nu sunt activate.", STR_DONTHAVEMINE[] = "Nu ai nici un laser.", STR_MAXDEPLOY[] = "Numarul maxim de lasere a fost atins.", STR_MANYPPL[] = "Prea multe lasere in echipa ta...", STR_PLANTWALL[] = "Trebuie sa plantezi laserul pe zid!", STR_REF[] = "Refer to a lasermine rule with this server. say 'lasermine'", STR_CBT[] = "Esti Zombie!Nu poti cumpara si planta un laser.", STR_CANTBUY[] = "Nu poti cumpara pe acest server.", STR_HAVEMAX[] = "Ai numarul maxim de lasere.", STR_NOMONEY[] = "Nu ai destui bani sa cumperi un laser! ($", STR_NEEDED[] = "needed)", STR_DELAY[] = "Poti cumpara si planta lasere in", STR_SECONDS[] = "secunde.", STR_BOUGHT[] = "Tocmai ai cumparat un laser.", STR_STATE[] = "LaserMines Ammo:", STR_NOACCESS[] = "Nu ai acces la aceasta comanda."; new g_EntMine; new beam, boom new g_LENABLE,g_LFMONEY,g_LAMMO,g_LDMG, g_LTMAX,g_LCOST,g_LHEALTH,g_LMODE,g_LRADIUS,g_LRDMG,g_LFF,g_LCBT; new g_LDELAY,/*g_LTHINK,*/g_LVISIBLE, g_LSTAMMO,g_LACCESS,g_LGLOW,g_LDMGMODE,g_LCLMODE,g_LCBRIGHT,g_LDSEC,g_LCMDMODE,g_LBUYMODE; new g_dcount[33],g_nowtime,g_MaxPL new bool:g_settinglaser[33] new g_msgDeathMsg,g_msgScoreInfo,g_msgDamage,g_msgStatusText,g_msgMoney; new Float:plspeed[33] new plsetting[33] new g_havemine[33]; new g_deployed[33]; native zp_is_nemesis_round() public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("+setlaser","CreateLaserMine_Progress_b"); register_clcmd("-setlaser","StopCreateLaserMine"); register_clcmd("+dellaser","ReturnLaserMine_Progress"); register_clcmd("-dellaser","StopReturnLaserMine"); register_clcmd("say","say_lasermine"); register_clcmd("buy_lasermine","BuyLasermine"); g_LENABLE = register_cvar("amx_ltm","1"); g_LACCESS = register_cvar("amx_ltm_acs","0"); //0 all, 1 admin g_LMODE = register_cvar("amx_ltm_mode","0"); //0 lasermine, 1 tripmine g_LAMMO = register_cvar("amx_ltm_ammo","1"); g_LDMG = register_cvar("amx_ltm_dmg","10000"); //laser hit dmg g_LCOST = register_cvar("amx_ltm_cost","0"); g_LFMONEY = register_cvar("amx_ltm_fragmoney","0"); g_LHEALTH = register_cvar("amx_ltm_health","500"); g_LTMAX = register_cvar("amx_ltm_teammax","20"); g_LRADIUS = register_cvar("amx_ltm_radius","25.0"); g_LRDMG = register_cvar("amx_ltm_rdmg","1000"); //radius damage g_LFF = register_cvar("amx_ltm_ff","0"); g_LCBT = register_cvar("amx_ltm_cbt","ALL"); g_LBUYMODE = register_cvar("amx_ltm_buymode","1"); g_LDELAY = register_cvar("amx_ltm_delay","14"); g_LVISIBLE = register_cvar("amx_ltm_line","1"); g_LGLOW = register_cvar("amx_ltm_glow","1"); g_LCBRIGHT = register_cvar("amx_ltm_bright","255"); //laser line brightness. g_LCLMODE = register_cvar("amx_ltm_color","0"); //0 is team color,1 is green g_LDMGMODE = register_cvar("amx_ltm_ldmgmode","0"); //0 - frame dmg, 1 - once dmg, 2 - 1 second dmg g_LDSEC = register_cvar("amx_ltm_ldmgseconds","1"); //mode 2 only, damage / seconds. default 1 (sec) g_LSTAMMO = register_cvar("amx_ltm_startammo","2"); g_LCMDMODE = register_cvar("amx_ltm_cmdmode","1"); //0 is +USE key, 1 is bind, 2 is each. register_event("DeathMsg", "DeathEvent", "a"); register_event("CurWeapon", "standing", "be", "1=1"); register_event("ResetHUD", "delaycount", "a"); register_event("ResetHUD", "newround", "b"); register_event("Damage","CutDeploy_onDamage","b"); g_msgDeathMsg = get_user_msgid("DeathMsg"); g_msgScoreInfo = get_user_msgid("ScoreInfo"); g_msgDamage = get_user_msgid("Damage"); g_msgStatusText = get_user_msgid("StatusText"); g_msgMoney = get_user_msgid("Money"); register_forward(FM_Think, "ltm_Think" ); register_forward(FM_PlayerPostThink, "ltm_PostThink" ); register_forward(FM_PlayerPreThink, "ltm_PreThink"); } public plugin_precache() { precache_sound(ENT_SOUND1); precache_sound(ENT_SOUND2); precache_sound(ENT_SOUND3); precache_sound(ENT_SOUND4); precache_sound(ENT_SOUND5); precache_sound(ENT_SOUND6); precache_sound(ENT_SOUND7); precache_model(ENT_MODELS); beam = precache_model(ENT_SPRITE1); boom = precache_model(ENT_SPRITE2); } public plugin_modules() { require_module("fakemeta"); require_module("cstrike"); } public plugin_cfg() { g_EntMine = engfunc(EngFunc_AllocString,ENT_CLASS_NAME3); arrayset(g_havemine,0,sizeof(g_havemine)); arrayset(g_deployed,0,sizeof(g_deployed)); g_MaxPL = get_maxplayers(); new file[64]; get_localinfo("amxx_configsdir",file,63); if(file_exists(file)) server_cmd("exec %s", file), server_exec(); } public delaycount(id) { g_dcount[id] = floatround(get_gametime()); } bool:CheckTime(id) { g_nowtime = floatround(get_gametime()) - g_dcount[id]; if(g_nowtime >= get_pcvar_num(g_LDELAY)) return true; return false; } public CreateLaserMine_Progress_b(id) { if(zp_is_nemesis_round()) { client_print(id,print_chat,"[ZP] Nu poti folosi lasermine cand este runda de nemesis") return 1 } if(get_pcvar_num(g_LCMDMODE) != 0) CreateLaserMine_Progress(id); return 1; } public CreateLaserMine_Progress(id) { if (!CreateCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "Spawn", (TASK_PLANT + id)); return PLUGIN_HANDLED; } public ReturnLaserMine_Progress(id) { if (!ReturnCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "ReturnMine", (TASK_RELEASE + id)); return PLUGIN_HANDLED; } public StopCreateLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public StopReturnLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public ReturnMine(id) { id -= TASK_RELEASE; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return; if(pev(tgt,LASERMINE_OWNER) != id) return; RemoveEntity(tgt); g_havemine[id] ++; g_deployed[id] --; emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return; } public Spawn( id ) { id -= TASK_PLANT new i_Ent = engfunc(EngFunc_CreateNamedEntity,g_EntMine); if(!i_Ent) { client_print(id,print_chat,"[Laesrmine Debug] Can't Create Entity"); return PLUGIN_HANDLED_MAIN; } set_pev(i_Ent,pev_classname,ENT_CLASS_NAME); engfunc(EngFunc_SetModel,i_Ent,ENT_MODELS); set_pev(i_Ent,pev_solid,SOLID_NOT); set_pev(i_Ent,pev_movetype,MOVETYPE_FLY); set_pev(i_Ent,pev_frame,0); set_pev(i_Ent,pev_body,3); set_pev(i_Ent,pev_sequence,TRIPMINE_WORLD); set_pev(i_Ent,pev_framerate,0); set_pev(i_Ent,pev_takedamage,DAMAGE_YES); set_pev(i_Ent,pev_dmg,100.0); set_user_health(i_Ent,get_pcvar_num(g_LHEALTH)); new Float:vOrigin[3]; new Float:vNewOrigin[3],Float:vNormal[3],Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vEntAngles[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); } xs_vec_mul_scalar( vNormal, 8.0, vNormal ); xs_vec_add( vTraceEnd, vNormal, vNewOrigin ); engfunc(EngFunc_SetSize, i_Ent, Float:{ -4.0, -4.0, -4.0 }, Float:{ 4.0, 4.0, 4.0 } ); engfunc(EngFunc_SetOrigin, i_Ent, vNewOrigin ); vector_to_angle(vNormal,vEntAngles ); set_pev(i_Ent,pev_angles,vEntAngles ); new Float:vBeamEnd[3], Float:vTracedBeamEnd[3]; xs_vec_mul_scalar(vNormal, 8192.0, vNormal ); xs_vec_add( vNewOrigin, vNormal, vBeamEnd ); engfunc( EngFunc_TraceLine, vNewOrigin, vBeamEnd, IGNORE_MONSTERS, -1, 0 ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); get_tr2( 0, TR_vecEndPos, vTracedBeamEnd ); set_pev(i_Ent, LASERMINE_OWNER, id ); set_pev(i_Ent,LASERMINE_BEAMENDPOINT,vTracedBeamEnd); set_pev(i_Ent,LASERMINE_TEAM,int:cs_get_user_team(id)); new Float:fCurrTime = get_gametime(); set_pev(i_Ent,LASERMINE_POWERUP, fCurrTime + 2.5 ); set_pev(i_Ent,LASERMINE_STEP,POWERUP_THINK); set_pev(i_Ent,pev_nextthink, fCurrTime + 0.2 ); PlaySound(i_Ent,POWERUP_SOUND ); g_deployed[id]++; g_havemine[id]--; DeleteTask(id); ShowAmmo(id); return 1; } stock TeamDeployedCount(id) { static i; static CsTeams:t;t = cs_get_user_team(id); static cnt;cnt=0; for(i = 1;i <= g_MaxPL;i++) { if(is_user_connected(i)) if(t == cs_get_user_team(i)) cnt += g_deployed; } return cnt; } bool:CheckCanTeam(id) { new arg[5],CsTeam:num; get_pcvar_string(g_LCBT,arg,3); if(equali(arg,"T")) { num = CsTeam:CS_TEAM_T; } else if(equali(arg,"CT")) { num = CsTeam:CS_TEAM_CT; } else if(equali(arg,"ALL")) { num = CsTeam:CS_TEAM_UNASSIGNED; } else { num = CsTeam:CS_TEAM_UNASSIGNED; } if(num != CsTeam:CS_TEAM_UNASSIGNED && num != CsTeam:cs_get_user_team(id)) return false; return true; } bool:CanCheck(id,mode) { if( !get_pcvar_num( g_LENABLE ) ) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOTACTIVE); return false; } if( get_pcvar_num(g_LACCESS) != 0) if(!(get_user_flags(id) & ADMIN_IMMUNITY)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOACCESS); return false; } if(!pev_user_alive(id)) return false; if (!CheckCanTeam(id)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CBT); return false; } if( mode == 0) { if(g_havemine[id] <= 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_DONTHAVEMINE); return false; } } if (mode == 1) { if (get_pcvar_num(g_LBUYMODE) == 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CANTBUY); return false; } if (g_havemine[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_HAVEMAX); return false; } if (cs_get_user_money(id) < get_pcvar_num(g_LCOST)) { client_print(id, print_chat, "%s %s%d %s",CHATTAG, STR_NOMONEY,get_pcvar_num(g_LCOST),STR_NEEDED); return false; } } if(!CheckTime(id)) { client_print(id,print_chat, "%s %s %d %s",CHATTAG,STR_DELAY,get_pcvar_num(g_LDELAY)-g_nowtime,STR_SECONDS); return false; } return true; } bool:ReturnCheck( id ) { if(!CanCheck(id,-1)) return false; if(g_havemine[id] + 1 > get_pcvar_num(g_LAMMO)) return false; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return false; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return false; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return false; if(pev(tgt,LASERMINE_OWNER) != id) return false; return true; } bool:CreateCheck( id ) { if (!CanCheck(id,0)) return false; if (g_deployed[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MAXDEPLOY); return false; } //client_print(id,print_chat,"[Lasermine] your team deployed %d",TeamDeployedCount(id)) if(TeamDeployedCount(id) >= get_pcvar_num(g_LTMAX)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MANYPPL); return false; } new Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vOrigin[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction,Float:vTraceNormal[3]; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vTraceNormal ); return true; } client_print(id, print_chat, "%s %s",CHATTAG,STR_PLANTWALL) DeleteTask(id); return false; } public ltm_Think( i_Ent ) { if ( !pev_valid( i_Ent ) ) return FMRES_IGNORED; new EntityName[32]; pev( i_Ent, pev_classname, EntityName, 31); if(!get_pcvar_num(g_LENABLE)) return FMRES_IGNORED; if ( !equal( EntityName, ENT_CLASS_NAME ) ) return FMRES_IGNORED; static Float:fCurrTime; fCurrTime = get_gametime(); switch( pev( i_Ent, LASERMINE_STEP ) ) { case POWERUP_THINK : { new Float:fPowerupTime; pev( i_Ent, LASERMINE_POWERUP, fPowerupTime ); if( fCurrTime > fPowerupTime ) { set_pev( i_Ent, pev_solid, SOLID_BBOX ); set_pev( i_Ent, LASERMINE_STEP, BEAMBREAK_THINK ); PlaySound( i_Ent, ACTIVATE_SOUND ); } if(get_pcvar_num(g_LGLOW)!=0) { if(get_pcvar_num(g_LCLMODE)==0) { switch (pev(i_Ent,LASERMINE_TEAM)) { case CS_TEAM_T: set_rendering(i_Ent,kRenderFxGlowShell,255,0,0,kRenderNormal,5); case CS_TEAM_CT:set_rendering(i_Ent,kRenderFxGlowShell,0,0,255,kRenderNormal,5); } }else { set_rendering(i_Ent,kRenderFxGlowShell,0,255,0,kRenderNormal,5); } } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.1 ); } case BEAMBREAK_THINK : { static Float:vEnd[3],Float:vOrigin[3]; pev( i_Ent, pev_origin, vOrigin ); pev( i_Ent, LASERMINE_BEAMENDPOINT, vEnd ); static iHit, Float:fFraction; engfunc( EngFunc_TraceLine, vOrigin, vEnd, DONT_IGNORE_MONSTERS, i_Ent, 0 ); get_tr2( 0, TR_flFraction, fFraction ); iHit = get_tr2( 0, TR_pHit ); if ( fFraction < 1.0 ) { if(pev_valid(iHit)) { pev( iHit, pev_classname, EntityName, 31 ); if( !equal( EntityName, ENT_CLASS_NAME ) ) { set_pev( i_Ent, pev_enemy, iHit ); if(get_pcvar_num(g_LMODE) == MODE_LASERMINE) CreateLaserDamage(i_Ent,iHit); else if(get_pcvar_num(g_LFF) || CsTeams:pev(i_Ent,LASERMINE_TEAM) != cs_get_user_team(iHit)) set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } } } if(get_pcvar_num(g_LDMGMODE)!=0) if(pev(i_Ent,LASERMINE_HITING) != iHit) set_pev(i_Ent,LASERMINE_HITING,iHit); if ( pev_valid( i_Ent )) { static Float:fHealth; pev( i_Ent, pev_health, fHealth ); if( fHealth <= 0.0 || (pev(i_Ent,pev_flags) & FL_KILLME)) { set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } static Float:fBeamthink; pev( i_Ent, LASERMINE_BEAMTHINK, fBeamthink ); if( fBeamthink < fCurrTime && get_pcvar_num(g_LVISIBLE)) { DrawLaser(i_Ent, vOrigin, vEnd ); set_pev( i_Ent, LASERMINE_BEAMTHINK, fCurrTime + 0.1 ); } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.01 ); } } case EXPLOSE_THINK : { set_pev( i_Ent, pev_nextthink, 0.0 ); PlaySound( i_Ent, STOP_SOUND ); g_deployed[pev(i_Ent,LASERMINE_OWNER)]--; CreateExplosion( i_Ent ); CreateDamage(i_Ent,get_pcvar_float(g_LRDMG),get_pcvar_float(g_LRADIUS)) RemoveEntity ( i_Ent ); } } return FMRES_IGNORED; } PlaySound( i_Ent, i_SoundType ) { switch ( i_SoundType ) { case POWERUP_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, 0, PITCH_NORM ); } case ACTIVATE_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, 1, 75 ); } case STOP_SOUND : { emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, SND_STOP, PITCH_NORM ); emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, SND_STOP, 75 ); } } } DrawLaser(i_Ent, const Float:v_Origin[3], const Float:v_EndOrigin[3] ) { new tcolor[3]; new teamid = pev(i_Ent, LASERMINE_TEAM); if(get_pcvar_num(g_LCLMODE) == 0) { switch(teamid){ case 1:{ tcolor[0] = 255; tcolor[1] = 0; tcolor[2] = 0; } case 2:{ tcolor[0] = 0; tcolor[1] = 0; tcolor[2] = 255; } } }else { tcolor[0] = 0; tcolor[1] = 255; tcolor[2] = 0; } message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_BEAMPOINTS); engfunc(EngFunc_WriteCoord,v_Origin[0]); engfunc(EngFunc_WriteCoord,v_Origin[1]); engfunc(EngFunc_WriteCoord,v_Origin[2]); engfunc(EngFunc_WriteCoord,v_EndOrigin[0]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[1]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[2]); //Random write_short(beam); write_byte(0); write_byte(0); write_byte(1); //Life write_byte(5); //Width write_byte(0); //wave write_byte(tcolor[0]); // r write_byte(tcolor[1]); // g write_byte(tcolor[2]); // b write_byte(get_pcvar_num(g_LCBRIGHT)); write_byte(255); message_end(); } /* CreateDamage(iCurrent,DmgMAX,Float:Radius) { new AtkID = pev(iCurrent,LASERMINE_OWNER)// entity_get_int(iCurrent,LASERMINE_OWNER) new TeamID= pev(iCurrent,LASERMINE_TEAM) //entity_get_int(iCurrent,LASERMINE_INT_TEAM) new Player = -1; new Float:distance,dmg; new Float:tOrigin[3]; new Float:vOrigin[3]; new iHitHP,iHitTeam; pev(iCurrent,pev_origin,vOrigin); while((Player = engfunc(EngFunc_FindEntityInSphere, Player, vOrigin, Radius)) != 0) { if(is_user_alive(Player)) { pev(Player,pev_origin,tOrigin) distance = get_distance_f(vOrigin, tOrigin) dmg = floatround(DmgMAX - ((DmgMAX / Radius) * distance)) iHitHP = pev_user_health(Player) - dmg iHitTeam = int:bio_get_user_team(Player) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(Player, iHitHP) message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, {0,0,0}, Player) write_byte(dmg) write_byte(dmg) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } } } Player = engfunc(EngFunc_FindEntityInSphere,Player,vOrigin,Radius) } return PLUGIN_CONTINUE } */ CreateDamage(iCurrent,Float:DmgMAX,Float:Radius) { new Float:vecSrc[3]; pev(iCurrent, pev_origin, vecSrc); new AtkID =pev(iCurrent,LASERMINE_OWNER); new TeamID=pev(iCurrent,LASERMINE_TEAM); new ent = -1; new Float:tmpdmg = DmgMAX; new Float:kickback = 0.0; new Float:Tabsmin[3], Float:Tabsmax[3]; new Float:vecSpot[3]; new Float:Aabsmin[3], Float:Aabsmax[3]; new Float:vecSee[3]; new trRes; new Float:flFraction; new Float:vecEndPos[3]; new Float:distance; new Float:origin[3], Float:vecPush[3]; new Float:invlen; new Float:velocity[3]; new iHitHP,iHitTeam; new Float:falloff; if (Radius > 0.0) { falloff = DmgMAX / Radius; } else { falloff = 1.0; } while((ent = engfunc(EngFunc_FindEntityInSphere, ent, vecSrc, Radius)) != 0) { if(!pev_valid(ent)) continue; if(!(pev(ent, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { continue; } if(!pev_user_alive(ent)) continue; kickback = 1.0; tmpdmg = DmgMAX; pev(ent, pev_absmin, Tabsmin); pev(ent, pev_absmax, Tabsmax); xs_vec_add(Tabsmin,Tabsmax,Tabsmin); xs_vec_mul_scalar(Tabsmin,0.5,vecSpot); pev(iCurrent, pev_absmin, Aabsmin); pev(iCurrent, pev_absmax, Aabsmax); xs_vec_add(Aabsmin,Aabsmax,Aabsmin); xs_vec_mul_scalar(Aabsmin,0.5,vecSee); engfunc(EngFunc_TraceLine, vecSee, vecSpot, 0, iCurrent, trRes); get_tr2(trRes, TR_flFraction, flFraction); if (flFraction >= 0.9 || get_tr2(trRes, TR_pHit) == ent) { get_tr2(trRes, TR_vecEndPos, vecEndPos); distance = get_distance_f(vecSrc, vecEndPos) * falloff; tmpdmg -= distance; if(tmpdmg < 0.0) tmpdmg = 0.0; if(kickback != 0.0) { xs_vec_sub(vecSpot,vecSee,origin); invlen = 1.0/get_distance_f(vecSpot, vecSee); xs_vec_mul_scalar(origin,invlen,vecPush); pev(ent, pev_velocity, velocity) xs_vec_mul_scalar(vecPush,tmpdmg,vecPush); xs_vec_mul_scalar(vecPush,kickback,vecPush); xs_vec_add(velocity,vecPush,velocity); if(tmpdmg < 60.0) { xs_vec_mul_scalar(velocity,12.0,velocity); } else { xs_vec_mul_scalar(velocity,4.0,velocity); } if(velocity[0] != 0.0 || velocity[1] != 0.0 || velocity[2] != 0.0) { // There's some movement todo :) set_pev(ent, pev_velocity, velocity) } } iHitHP = pev_user_health(ent) - floatround(tmpdmg) iHitTeam = int:cs_get_user_team(ent) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(ent, iHitHP) engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},ent); write_byte(floatround(tmpdmg)) write_byte(floatround(tmpdmg)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vecSrc[0]) engfunc(EngFunc_WriteCoord,vecSrc[1]) engfunc(EngFunc_WriteCoord,vecSrc[2]) message_end() } } } } return } bool:pev_user_alive(ent) { new deadflag = pev(ent,pev_deadflag); if(deadflag != DEAD_NO) return false; return true; } CreateExplosion(iCurrent) { new Float:vOrigin[3]; pev(iCurrent,pev_origin,vOrigin); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(99); //99 = KillBeam write_short(iCurrent); message_end(); engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vOrigin, 0); write_byte(TE_EXPLOSION); engfunc(EngFunc_WriteCoord,vOrigin[0]); engfunc(EngFunc_WriteCoord,vOrigin[1]); engfunc(EngFunc_WriteCoord,vOrigin[2]); write_short(boom); write_byte(30); write_byte(15); write_byte(0); message_end(); } CreateLaserDamage(iCurrent,isHit) { if(isHit < 0 ) return PLUGIN_CONTINUE switch(get_pcvar_num(g_LDMGMODE)) { case 1: { if(pev(iCurrent,LASERMINE_HITING) == isHit) return PLUGIN_CONTINUE } case 2: { if(pev(iCurrent,LASERMINE_HITING) == isHit) { static Float:cnt static now,htime;now = floatround(get_gametime()) pev(iCurrent,LASERMINE_COUNT,cnt) htime = floatround(cnt) if(now - htime < get_pcvar_num(g_LDSEC)) { return PLUGIN_CONTINUE; }else{ set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } }else { set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } } } new Float:vOrigin[3],Float:vEnd[3] pev(iCurrent,pev_origin,vOrigin) pev(iCurrent,pev_vuser1,vEnd) new teamid = pev(iCurrent, LASERMINE_TEAM) new szClassName[32] new Alive,God new iHitTeam,iHitHP,id new hitscore szClassName[0] = '^0' pev(isHit,pev_classname,szClassName,32) if((pev(isHit, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { Alive = pev_user_alive(isHit) God = get_user_godmode(isHit) if(!Alive || God) return PLUGIN_CONTINUE iHitTeam = int:cs_get_user_team(isHit) iHitHP = pev_user_health(isHit) - get_pcvar_num(g_LDMG) id = pev(iCurrent,LASERMINE_OWNER)//, szNetName[32] if(iHitHP <= 0) { if(iHitTeam != teamid) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = 1 cs_set_user_money(id,cs_get_user_money(id) + get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) }else { if(get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = -1 cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) } } }else if(iHitTeam != teamid || get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) set_user_health(isHit,iHitHP) set_pev(iCurrent,LASERMINE_HITING,isHit); engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},isHit); write_byte(get_pcvar_num(g_LDMG)) write_byte(get_pcvar_num(g_LDMG)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } }else if(equal(szClassName, ENT_CLASS_NAME3)) { new hl; hl = pev_user_health(isHit); set_user_health(isHit,hl-get_pcvar_num(g_LDMG)); } return PLUGIN_CONTINUE } stock pev_user_health(id) { new Float:health pev(id,pev_health,health) return floatround(health) } stock set_user_health(id,health) { health > 0 ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id); } stock get_user_godmode(index) { new Float:val pev(index, pev_takedamage, val) return (val == DAMAGE_NO) } stock set_user_frags(index, frags) { set_pev(index, pev_frags, float(frags)) return 1 } stock pev_user_frags(index) { new Float:frags; pev(index,pev_frags,frags); return floatround(frags); } set_score(id,target,hitscore,HP){ new idfrags = pev_user_frags(id) + hitscore set_user_frags(id,idfrags) new tarfrags = pev_user_frags(target) + 1 set_user_frags(target,tarfrags) new idteam = int:cs_get_user_team(id) new iddeaths = cs_get_user_deaths(id) message_begin(MSG_ALL, g_msgDeathMsg, {0, 0, 0} ,0) write_byte(id) write_byte(target) write_byte(0) write_string(ENT_CLASS_NAME) message_end() message_begin(MSG_ALL, g_msgScoreInfo) write_byte(id) write_short(idfrags) write_short(iddeaths) write_short(0) write_short(idteam) message_end() set_msg_block(g_msgDeathMsg, BLOCK_ONCE) set_user_health(target, HP) } public BuyLasermine(id) { if( !CanCheck(id,1) ) return PLUGIN_CONTINUE cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LCOST)) g_havemine[id]++; client_print(id, print_chat, "%s %s",CHATTAG,STR_BOUGHT) emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return PLUGIN_HANDLED } ShowAmmo(id) { new ammo[51] formatex(ammo, 50, "%s %i/%i",STR_STATE, g_havemine[id],get_pcvar_num(g_LAMMO)) message_begin(MSG_ONE, g_msgStatusText, {0,0,0}, id) write_byte(0) write_string(ammo) message_end() } public showInfo(id) { client_print(id, print_chat, STR_REF) } public say_lasermine(id){ new said[32] read_argv(1,said,31); if( !get_pcvar_num( g_LENABLE ) ){ return PLUGIN_CONTINUE } if (equali(said,"/buy lasermine")||equali(said,"/lm")){ BuyLasermine(id) }else if (equali(said, "lasermine") || equali(said, "/lasermine")){ const SIZE = 1024 new msg[SIZE+1],len = 0; len += formatex(msg[len], SIZE - len, "<html><body>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p>You can be setting the mine on the wall.</p><br/>") len += formatex(msg[len], SIZE - len, "<p>That laser will give what touched it damage.</p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine Commands</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>Say /buy lasermine</b> or <b>Say /lm</b> //buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>buy_lasermine</b> //bind ^"F2^" buy_lasermine : using F2 buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>+setlaser</b> //bind mouse3 +setlaser : using mouse3 set lasermine on wall<br/>") len += formatex(msg[len], SIZE - len, "</body></html>") show_motd(id, msg, "Lasermine Entity help") return PLUGIN_CONTINUE } else if (containi(said, "laser") != -1) { showInfo(id) return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public standing(id) { if (!g_settinglaser[id]) return PLUGIN_CONTINUE set_pev(id, pev_maxspeed, 1.0) return PLUGIN_CONTINUE } public ltm_PostThink(id) { if (!g_settinglaser[id] && plsetting[id]){ resetspeed(id) } else if (g_settinglaser[id] && !plsetting[id]) { pev(id, pev_maxspeed,plspeed[id]) set_pev(id, pev_maxspeed, 1.0) } plsetting[id] = g_settinglaser[id] return FMRES_IGNORED } public ltm_PreThink(id) { if (!pev_user_alive(id) || g_settinglaser[id] == true || is_user_bot(id) || get_pcvar_num(g_LCMDMODE) == 1) return FMRES_IGNORED; if(pev(id, pev_button ) & IN_USE && !(pev(id, pev_oldbuttons ) & IN_USE )) CreateLaserMine_Progress(id) return FMRES_IGNORED; } resetspeed(id) { set_pev(id, pev_maxspeed, plspeed[id]) } public client_putinserver(id){ g_deployed[id] = 0; g_havemine[id] = 0; DeleteTask(id); return PLUGIN_CONTINUE } public client_disconnect(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE DeleteTask(id); RemoveAllTripmines(id); return PLUGIN_CONTINUE } public newround(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE pev(id, pev_maxspeed,plspeed[id]) DeleteTask(id); RemoveAllTripmines(id); delaycount(id); SetStartAmmo(id); return PLUGIN_CONTINUE } public DeathEvent(){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE new id = read_data(2) if(is_user_connected(id)) DeleteTask(id); return PLUGIN_CONTINUE } public RemoveAllTripmines( i_Owner ) { new iEnt = g_MaxPL + 1; new clsname[32]; while( ( iEnt = engfunc( EngFunc_FindEntityByString, iEnt, "classname", ENT_CLASS_NAME ) ) ) { if ( i_Owner ) { if( pev( iEnt, LASERMINE_OWNER ) != i_Owner ) continue; clsname[0] = '^0' pev( iEnt, pev_classname, clsname, sizeof(clsname)-1 ); if ( equali( clsname, ENT_CLASS_NAME ) ) { PlaySound( iEnt, STOP_SOUND ); RemoveEntity( iEnt ); } } else set_pev( iEnt, pev_flags, FL_KILLME ); } g_deployed[i_Owner]=0; } SetStartAmmo(id) { new stammo = get_pcvar_num(g_LSTAMMO); if(stammo <= 0) return PLUGIN_CONTINUE; g_havemine[id] = (g_havemine[id] <= stammo) ? stammo : g_havemine[id]; return PLUGIN_CONTINUE; } public CutDeploy_onDamage(id) { if(get_user_health(id) < 1) DeleteTask(id); } DeleteTask(id) { if (task_exists((TASK_PLANT + id))) { remove_task((TASK_PLANT + id)) } if (task_exists((TASK_RELEASE + id))) { remove_task((TASK_RELEASE + id)) } g_settinglaser[id] = false return PLUGIN_CONTINUE; } stock set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); set_pev(entity, pev_renderfx, fx); set_pev(entity, pev_rendercolor, RenderColor); set_pev(entity, pev_rendermode, render); set_pev(entity, pev_renderamt, float(amount)); return 1 } get_offset_value(id, type) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; return get_pdata_int(id, key); } return -1; } set_offset_value(id, type, value) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { message_begin(MSG_ONE_UNRELIABLE, g_msgMoney, {0,0,0}, id); write_long(value); write_byte(1); // Flash (difference between new and old money) message_end(); } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; set_pdata_int(id, key, value); } return PLUGIN_CONTINUE; }
- YONTU
- Scripter eXtreamCS
- Posts: 2466
- Joined: 10 May 2013, 14:25
- Detinator Steam: Nu
- CS Status: Everyone is looking at ur shoes
- Reputatie: Moderator ajutator
Fost scripter eXtreamCS - Location: Gura Humorului
- Has thanked: 256 times
- Been thanked: 288 times
- Contact:
pentru ce mod de zm?
„Peste douăzeci de ani vei fi dezamăgit din cauza lucrurilor pe care nu le-ai făcut, nu din cauza celor pe care le-ai făcut.” - Mark Twain
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș
Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114
„Asa e si in viata, hotii castiga, prostii care invata pierd.” - Mihai Nemeș
Bio.LeagueCs.Ro - Biohazard v4.4 Xmas Edition
discord: IonutC#5114
Experinta in: Java/Spring boot/Angular/C/C++/C#/Javascript/Python/HTML/CSS/Pawn/SQL
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
Ai nevoie de ajutorul meu? Ma poti gasi doar la adresa de discord de mai sus.
- alynut
- Administrator
- Posts: 7121
- Joined: 02 Jul 2012, 06:31
- Detinator Steam: Da
- CS Status: In concediu, activez mai rar .
- SteamID: alynut991
- Reputatie: Fost Administrator
Fost Intermediar - Location: Bucuresti
- Has thanked: 183 times
- Been thanked: 441 times
Este Zombie Plague OutStanding [Copie ]
Si vreau la moduri sa nu se poata pune lasere .
Si vreau la moduri sa nu se poata pune lasere .
- alynut
- Administrator
- Posts: 7121
- Joined: 02 Jul 2012, 06:31
- Detinator Steam: Da
- CS Status: In concediu, activez mai rar .
- SteamID: alynut991
- Reputatie: Fost Administrator
Fost Intermediar - Location: Bucuresti
- Has thanked: 183 times
- Been thanked: 441 times
In scripting/include arescosmynnnn wrote:zombie outsanding ce fisier .inc cere ? zombieplague.inc ?
- zombieplague.inc asta | Afiseaza codul
[code]/*================================================================================ --------------------------------------- -*- Zombie Plague 4.3 Includes File -*- --------------------------------------- ------------------------------------------------------- -*- Dont use this include file for your plugins -*- -*- This file is for backwards compatibility only. -*- -*- Use the zombie_plague_advance.inc file insteead -*- ------------------------------------------------------- =================================================================================*/ #if defined _zombieplague_included #endinput #endif #define _zombieplague_included /* Teams for zp_register_extra_item() */ #define ZP_TEAM_ZOMBIE (1<<0) #define ZP_TEAM_HUMAN (1<<1) #define ZP_TEAM_NEMESIS (1<<2) #define ZP_TEAM_SURVIVOR (1<<3) /* Game modes for zp_round_started() */ enum { MODE_INFECTION = 1, MODE_NEMESIS, MODE_SURVIVOR, MODE_SWARM, MODE_MULTI, MODE_PLAGUE } /* Winner teams for zp_round_ended() */ enum { WIN_NO_ONE = 0, WIN_ZOMBIES, WIN_HUMANS } /* Custom forward return values */ #define ZP_PLUGIN_HANDLED 97 /** * Returns whether a player is a zombie. * * @param id Player index. * @return True if it is, false otherwise. */ native zp_get_user_zombie(id) /** * Returns whether a player is a nemesis. * * @param id Player index. * @return True if it is, false otherwise. */ native zp_get_user_nemesis(id) /** * Returns whether a player is a survivor. * * @param id Player index. * @return True if it is, false otherwise. */ native zp_get_user_survivor(id) /** * Returns whether a player is the first zombie. * * @param id Player index. * @return True if it is, false otherwise. */ native zp_get_user_first_zombie(id) /** * Returns whether a player is the last zombie. * * @param id Player index. * @return True if it is, false otherwise. */ native zp_get_user_last_zombie(id) /** * Returns whether a player is the last human. * * @param id Player index. * @return True if it is, false otherwise. */ native zp_get_user_last_human(id) /** * Returns a player's current zombie class ID. * * @param id Player index. * @return Internal zombie class ID, or -1 if not yet chosen. */ native zp_get_user_zombie_class(id) /** * Returns a player's next zombie class ID (for the next infection). * * @param id Player index. * @return Internal zombie class ID, or -1 if not yet chosen. */ native zp_get_user_next_class(id) /** * Sets a player's next zombie class ID (for the next infection). * * @param id Player index. * @param classid A valid zombie class ID. * @return True on success, false otherwise. */ native zp_set_user_zombie_class(id, classid) /** * Returns a player's ammo pack count. * * @param id Player index. * @return Number of ammo packs owned. */ native zp_get_user_ammo_packs(id) /** * Sets a player's ammo pack count. * * @param id Player index. * @param amount New quantity of ammo packs owned. */ native zp_set_user_ammo_packs(id, amount) /** * Returns the default maximum health of a zombie. * * Note: Takes into account first zombie's HP multiplier. * * @param id Player index. * @return Maximum amount of health points, or -1 if not a normal zombie. */ native zp_get_zombie_maxhealth(id) /** * Returns a player's custom flashlight batteries charge. * * @param id Player index. * @return Charge percent (0 to 100). */ native zp_get_user_batteries(id) /** * Sets a player's custom flashlight batteries charge. * * @param id Player index. * @param value New charge percent (0 to 100). */ native zp_set_user_batteries(id, charge) /** * Returns whether a player has night vision. * * @param id Player index. * @return True if it has, false otherwise. */ native zp_get_user_nightvision(id) /** * Sets whether a player has night vision. * * @param id Player index. * @param set True to give, false for removing it. */ native zp_set_user_nightvision(id, set) /** * Forces a player to become a zombie. * * Note: Unavailable for last human/survivor. * * @param id Player index to be infected. * @param infector Player index who infected him (optional). * @param silent If set, there will be no HUD messages or infection sounds. * @param rewards Whether to show DeathMsg and reward frags, hp, and ammo packs to infector. * @return True on success, false otherwise. */ native zp_infect_user(id, infector = 0, silent = 0, rewards = 0) /** * Forces a player to become a human. * * Note: Unavailable for last zombie/nemesis. * * @param id Player index to be cured. * @param silent If set, there will be no HUD messages or antidote sounds. * @return True on success, false otherwise. */ native zp_disinfect_user(id, silent = 0) /** * Forces a player to become a nemesis. * * Note: Unavailable for last human/survivor. * * @param id Player index to turn into nemesis. * @return True on success, false otherwise. */ native zp_make_user_nemesis(id) /** * Forces a player to become a survivor. * * Note: Unavailable for last zombie/nemesis. * * @param id Player index to turn into survivor. * @return True on success, false otherwise. */ native zp_make_user_survivor(id) /** * Respawns a player into a specific team. * * @param id Player index to be respawned. * @param team Team to respawn the player into (ZP_TEAM_ZOMBIE or ZP_TEAM_HUMAN). * @return True on success, false otherwise. */ native zp_respawn_user(id, team) /** * Forces a player to buy an extra item. * * @param id Player index. * @param itemid A valid extra item ID. * @param ignorecost If set, item's cost won't be deduced from player. * @return True on success, false otherwise. */ native zp_force_buy_extra_item(id, itemid, ignorecost = 0) /** * Returns whether the ZP round has started, i.e. first zombie * has been chosen or a game mode has begun. * * @return 0 - Round not started * 1 - Round started * 2 - Round starting */ native zp_has_round_started() /** * Returns whether the current round is a nemesis round. * * @return True if it is, false otherwise. */ native zp_is_nemesis_round() /** * Returns whether the current round is a survivor round. * * @return True if it is, false otherwise. */ native zp_is_survivor_round() /** * Returns whether the current round is a swarm round. * * @return True if it is, false otherwise. */ native zp_is_swarm_round() /** * Returns whether the current round is a plague round. * * @return True if it is, false otherwise. */ native zp_is_plague_round() /** * Returns number of alive zombies. * * @return Zombie count. */ native zp_get_zombie_count() /** * Returns number of alive humans. * * @return Human count. */ native zp_get_human_count() /** * Returns number of alive nemesis. * * @return Nemesis count. */ native zp_get_nemesis_count() /** * Returns number of alive survivors. * * @return Survivor count. */ native zp_get_survivor_count() /** * Registers a custom item which will be added to the extra items menu of ZP. * * Note: The returned extra item ID can be later used to catch item * purchase events for the zp_extra_item_selected() forward. * * Note: ZP_TEAM_NEMESIS and ZP_TEAM_SURVIVOR can be used to make * an item available to Nemesis and Survivors respectively. * * @param name Caption to display on the menu. * @param cost Ammo packs to be deducted on purchase. * @param teams Bitsum of teams it should be available for. * @return An internal extra item ID, or -1 on failure. */ native zp_register_extra_item(const name[], cost, teams) /** * Registers a custom class which will be added to the zombie classes menu of ZP. * * Note: The returned zombie class ID can be later used to identify * the class when calling the zp_get_user_zombie_class() natives. * * @param name Caption to display on the menu. * @param info Brief description of the class. * @param model Player model to be used. * @param clawmodel Claws model to be used. * @param hp Initial health points. * @param speed Maximum speed. * @param gravity Gravity multiplier. * @param knockback Knockback multiplier. * @return An internal zombie class ID, or -1 on failure. */ native zp_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback) /** * Returns an extra item's ID. * * @param name Item name to look for. * @return Internal extra item ID, or -1 if not found. */ native zp_get_extra_item_id(const name[]) /** * Returns a zombie class' ID. * * @param name Class name to look for. * @return Internal zombie class ID, or -1 if not found. */ native zp_get_zombie_class_id(const name[]) /** * Called when the ZP round starts, i.e. first zombie * is chosen or a game mode begins. * * @param gamemode Mode which has started. * @param id Affected player's index (if applicable). */ forward zp_round_started(gamemode, id) /** * Called when the round ends. * * @param winteam Team which has won the round. */ forward zp_round_ended(winteam) /** * Called when a player gets infected. * * @param id Player index who was infected. * @param infector Player index who infected him (if applicable). * @param nemesis Whether the player was turned into a nemesis. */ forward zp_user_infected_pre(id, infector, nemesis) forward zp_user_infected_post(id, infector, nemesis) /** * Called when a player turns back to human. * * @param id Player index who was cured. * @param survivor Whether the player was turned into a survivor. */ forward zp_user_humanized_pre(id, survivor) forward zp_user_humanized_post(id, survivor) /** * Called on a player infect/cure attempt. You can use this to block * an infection/humanization by returning ZP_PLUGIN_HANDLED in your plugin. * * Note: Right now this is only available after the ZP round starts, since some * situations (like blocking a first zombie's infection) are not yet handled. */ forward zp_user_infect_attempt(id, infector, nemesis) forward zp_user_humanize_attempt(id, survivor) /** * Called when a player buys an extra item from the ZP menu. * * Note: You can now return ZP_PLUGIN_HANDLED in your plugin to block * the purchase and the player will be automatically refunded. * * @param id Player index of purchaser. * @param itemid Internal extra item ID. */ forward zp_extra_item_selected(id, itemid) /** * Called when a player gets unfrozen (frostnades). * * @param id Player index. */ forward zp_user_unfrozen(id) /** * Called when a player becomes the last zombie. * * Note: This is called for the first zombie too. * * @param id Player index. */ forward zp_user_last_zombie(id) /** * Called when a player becomes the last human. * * @param id Player index. */ forward zp_user_last_human(id) /** * @deprecated - Do not use! * For backwards compatibility only. */ #define ZP_TEAM_ANY 0 [/code]
-
- Fost moderator
- Posts: 9362
- Joined: 06 Jul 2013, 22:08
- Detinator Steam: Da
- Detinator server CS: Nu
- Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn - Has thanked: 492 times
- Been thanked: 547 times
- | Afiseaza codul
#include <amxmodx> #include <fakemeta> #include <xs> #define PLUGIN "Tripmine" #define VERSION "2.3" #define AUTHOR "ExTreamCS" #define RemoveEntity(%1) engfunc(EngFunc_RemoveEntity,%1) #define TASK_PLANT 15100 #define TASK_RESET 15500 #define TASK_RELEASE 15900 #define LASERMINE_TEAM pev_iuser1//EV_INT_iuser1 #define LASERMINE_OWNER pev_iuser2 //EV_INT_iuser3 #define LASERMINE_STEP pev_iuser3 #define LASERMINE_HITING pev_iuser4 #define LASERMINE_COUNT pev_fuser1 #define LASERMINE_POWERUP pev_fuser2 #define LASERMINE_BEAMTHINK pev_fuser3 #define LASERMINE_BEAMENDPOINT pev_vuser1 #define MAX_MINES 10 #define MODE_LASERMINE 0 #define OFFSET_TEAM 114 #define OFFSET_MONEY 115 #define OFFSET_DEATH 444 #define cs_get_user_team(%1) CsTeams:get_offset_value(%1,OFFSET_TEAM) #define cs_get_user_deaths(%1) get_offset_value(%1,OFFSET_DEATH) #define cs_get_user_money(%1) get_offset_value(%1,OFFSET_MONEY) #define cs_set_user_money(%1,%2) set_offset_value(%1,OFFSET_MONEY,%2) enum CsTeams { CS_TEAM_UNASSIGNED = 0, CS_TEAM_T = 1, CS_TEAM_CT = 2, CS_TEAM_SPECTATOR = 3 }; enum tripmine_e { TRIPMINE_IDLE1 = 0, TRIPMINE_IDLE2, TRIPMINE_ARM1, TRIPMINE_ARM2, TRIPMINE_FIDGET, TRIPMINE_HOLSTER, TRIPMINE_DRAW, TRIPMINE_WORLD, TRIPMINE_GROUND, }; enum { POWERUP_THINK, BEAMBREAK_THINK, EXPLOSE_THINK }; enum { POWERUP_SOUND, ACTIVATE_SOUND, STOP_SOUND }; new const ENT_MODELS[] = "models/v_laser_new.mdl", ENT_SOUND1[] = "weapons/mine_deploy.wav", ENT_SOUND2[] = "weapons/mine_charge.wav", ENT_SOUND3[] = "weapons/mine_activate.wav", ENT_SOUND4[] = "debris/beamstart9.wav", ENT_SOUND5[] = "items/gunpickup2.wav", ENT_SOUND6[] = "debris/bustglass1.wav", ENT_SOUND7[] = "debris/bustglass2.wav", ENT_SPRITE1[] = "sprites/laserbeam.spr", ENT_SPRITE2[] = "sprites/zerogxplode.spr"; new const ENT_CLASS_NAME[] = "lasermine", ENT_CLASS_NAME3[] = "func_breakable"; new const CHATTAG[] = "[Lasermine]", STR_NOTACTIVE[] = "Laserele nu sunt activate.", STR_DONTHAVEMINE[] = "Nu ai nici un laser.", STR_MAXDEPLOY[] = "Numarul maxim de lasere a fost atins.", STR_MANYPPL[] = "Prea multe lasere in echipa ta...", STR_PLANTWALL[] = "Trebuie sa plantezi laserul pe zid!", STR_REF[] = "Refer to a lasermine rule with this server. say 'lasermine'", STR_CBT[] = "Esti Zombie!Nu poti cumpara si planta un laser.", STR_CANTBUY[] = "Nu poti cumpara pe acest server.", STR_HAVEMAX[] = "Ai numarul maxim de lasere.", STR_NOMONEY[] = "Nu ai destui bani sa cumperi un laser! ($", STR_NEEDED[] = "needed)", STR_DELAY[] = "Poti cumpara si planta lasere in", STR_SECONDS[] = "secunde.", STR_BOUGHT[] = "Tocmai ai cumparat un laser.", STR_STATE[] = "LaserMines Ammo:", STR_NOACCESS[] = "Nu ai acces la aceasta comanda."; new g_EntMine; new beam, boom new g_LENABLE,g_LFMONEY,g_LAMMO,g_LDMG, g_LTMAX,g_LCOST,g_LHEALTH,g_LMODE,g_LRADIUS,g_LRDMG,g_LFF,g_LCBT; new g_LDELAY,/*g_LTHINK,*/g_LVISIBLE, g_LSTAMMO,g_LACCESS,g_LGLOW,g_LDMGMODE,g_LCLMODE,g_LCBRIGHT,g_LDSEC,g_LCMDMODE,g_LBUYMODE; new g_dcount[33],g_nowtime,g_MaxPL new bool:g_settinglaser[33] new g_msgDeathMsg,g_msgScoreInfo,g_msgDamage,g_msgStatusText,g_msgMoney; new Float:plspeed[33] new plsetting[33] new g_havemine[33]; new g_deployed[33]; native zp_is_nemesis_round() native zp_is_survivor_round() native zp_is_swarm_round() native zp_is_plague_round() native zp_is_sniper_round() native zp_is_assassin_round() #pragma tabsize 0 public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("+setlaser","CreateLaserMine_Progress_b"); register_clcmd("-setlaser","StopCreateLaserMine"); register_clcmd("+dellaser","ReturnLaserMine_Progress"); register_clcmd("-dellaser","StopReturnLaserMine"); register_clcmd("say","say_lasermine"); register_clcmd("buy_lasermine","BuyLasermine"); g_LENABLE = register_cvar("amx_ltm","1"); g_LACCESS = register_cvar("amx_ltm_acs","0"); //0 all, 1 admin g_LMODE = register_cvar("amx_ltm_mode","0"); //0 lasermine, 1 tripmine g_LAMMO = register_cvar("amx_ltm_ammo","1"); g_LDMG = register_cvar("amx_ltm_dmg","10000"); //laser hit dmg g_LCOST = register_cvar("amx_ltm_cost","0"); g_LFMONEY = register_cvar("amx_ltm_fragmoney","0"); g_LHEALTH = register_cvar("amx_ltm_health","500"); g_LTMAX = register_cvar("amx_ltm_teammax","20"); g_LRADIUS = register_cvar("amx_ltm_radius","25.0"); g_LRDMG = register_cvar("amx_ltm_rdmg","1000"); //radius damage g_LFF = register_cvar("amx_ltm_ff","0"); g_LCBT = register_cvar("amx_ltm_cbt","ALL"); g_LBUYMODE = register_cvar("amx_ltm_buymode","1"); g_LDELAY = register_cvar("amx_ltm_delay","14"); g_LVISIBLE = register_cvar("amx_ltm_line","1"); g_LGLOW = register_cvar("amx_ltm_glow","1"); g_LCBRIGHT = register_cvar("amx_ltm_bright","255"); //laser line brightness. g_LCLMODE = register_cvar("amx_ltm_color","0"); //0 is team color,1 is green g_LDMGMODE = register_cvar("amx_ltm_ldmgmode","0"); //0 - frame dmg, 1 - once dmg, 2 - 1 second dmg g_LDSEC = register_cvar("amx_ltm_ldmgseconds","1"); //mode 2 only, damage / seconds. default 1 (sec) g_LSTAMMO = register_cvar("amx_ltm_startammo","2"); g_LCMDMODE = register_cvar("amx_ltm_cmdmode","1"); //0 is +USE key, 1 is bind, 2 is each. register_event("DeathMsg", "DeathEvent", "a"); register_event("CurWeapon", "standing", "be", "1=1"); register_event("ResetHUD", "delaycount", "a"); register_event("ResetHUD", "newround", "b"); register_event("Damage","CutDeploy_onDamage","b"); g_msgDeathMsg = get_user_msgid("DeathMsg"); g_msgScoreInfo = get_user_msgid("ScoreInfo"); g_msgDamage = get_user_msgid("Damage"); g_msgStatusText = get_user_msgid("StatusText"); g_msgMoney = get_user_msgid("Money"); register_forward(FM_Think, "ltm_Think" ); register_forward(FM_PlayerPostThink, "ltm_PostThink" ); register_forward(FM_PlayerPreThink, "ltm_PreThink"); } public plugin_precache() { precache_sound(ENT_SOUND1); precache_sound(ENT_SOUND2); precache_sound(ENT_SOUND3); precache_sound(ENT_SOUND4); precache_sound(ENT_SOUND5); precache_sound(ENT_SOUND6); precache_sound(ENT_SOUND7); precache_model(ENT_MODELS); beam = precache_model(ENT_SPRITE1); boom = precache_model(ENT_SPRITE2); } public plugin_modules() { require_module("fakemeta"); require_module("cstrike"); } public plugin_cfg() { g_EntMine = engfunc(EngFunc_AllocString,ENT_CLASS_NAME3); arrayset(g_havemine,0,sizeof(g_havemine)); arrayset(g_deployed,0,sizeof(g_deployed)); g_MaxPL = get_maxplayers(); new file[64]; get_localinfo("amxx_configsdir",file,63); if(file_exists(file)) server_cmd("exec %s", file), server_exec(); } public delaycount(id) { g_dcount[id] = floatround(get_gametime()); } bool:CheckTime(id) { g_nowtime = floatround(get_gametime()) - g_dcount[id]; if(g_nowtime >= get_pcvar_num(g_LDELAY)) return true; return false; } public CreateLaserMine_Progress_b(id) { if(get_pcvar_num(g_LCMDMODE) != 0) CreateLaserMine_Progress(id); return 1; } public CreateLaserMine_Progress(id) { if (!CreateCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "Spawn", (TASK_PLANT + id)); return PLUGIN_HANDLED; } public ReturnLaserMine_Progress(id) { if (!ReturnCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "ReturnMine", (TASK_RELEASE + id)); return PLUGIN_HANDLED; } public StopCreateLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public StopReturnLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public ReturnMine(id) { id -= TASK_RELEASE; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return; if(pev(tgt,LASERMINE_OWNER) != id) return; RemoveEntity(tgt); g_havemine[id] ++; g_deployed[id] --; emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return; } public Spawn( id ) { id -= TASK_PLANT new i_Ent = engfunc(EngFunc_CreateNamedEntity,g_EntMine); if(!i_Ent) { client_print(id,print_chat,"[Laesrmine Debug] Can't Create Entity"); return PLUGIN_HANDLED_MAIN; } set_pev(i_Ent,pev_classname,ENT_CLASS_NAME); engfunc(EngFunc_SetModel,i_Ent,ENT_MODELS); set_pev(i_Ent,pev_solid,SOLID_NOT); set_pev(i_Ent,pev_movetype,MOVETYPE_FLY); set_pev(i_Ent,pev_frame,0); set_pev(i_Ent,pev_body,3); set_pev(i_Ent,pev_sequence,TRIPMINE_WORLD); set_pev(i_Ent,pev_framerate,0); set_pev(i_Ent,pev_takedamage,DAMAGE_YES); set_pev(i_Ent,pev_dmg,100.0); set_user_health(i_Ent,get_pcvar_num(g_LHEALTH)); new Float:vOrigin[3]; new Float:vNewOrigin[3],Float:vNormal[3],Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vEntAngles[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); } xs_vec_mul_scalar( vNormal, 8.0, vNormal ); xs_vec_add( vTraceEnd, vNormal, vNewOrigin ); engfunc(EngFunc_SetSize, i_Ent, Float:{ -4.0, -4.0, -4.0 }, Float:{ 4.0, 4.0, 4.0 } ); engfunc(EngFunc_SetOrigin, i_Ent, vNewOrigin ); vector_to_angle(vNormal,vEntAngles ); set_pev(i_Ent,pev_angles,vEntAngles ); new Float:vBeamEnd[3], Float:vTracedBeamEnd[3]; xs_vec_mul_scalar(vNormal, 8192.0, vNormal ); xs_vec_add( vNewOrigin, vNormal, vBeamEnd ); engfunc( EngFunc_TraceLine, vNewOrigin, vBeamEnd, IGNORE_MONSTERS, -1, 0 ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); get_tr2( 0, TR_vecEndPos, vTracedBeamEnd ); set_pev(i_Ent, LASERMINE_OWNER, id ); set_pev(i_Ent,LASERMINE_BEAMENDPOINT,vTracedBeamEnd); set_pev(i_Ent,LASERMINE_TEAM,int:cs_get_user_team(id)); new Float:fCurrTime = get_gametime(); set_pev(i_Ent,LASERMINE_POWERUP, fCurrTime + 2.5 ); set_pev(i_Ent,LASERMINE_STEP,POWERUP_THINK); set_pev(i_Ent,pev_nextthink, fCurrTime + 0.2 ); PlaySound(i_Ent,POWERUP_SOUND ); g_deployed[id]++; g_havemine[id]--; DeleteTask(id); ShowAmmo(id); return 1; } stock TeamDeployedCount(id) { static i; static CsTeams:t;t = cs_get_user_team(id); static cnt;cnt=0; for(i = 1;i <= g_MaxPL;i++) { if(is_user_connected(i)) if(t == cs_get_user_team(i)) cnt += g_deployed; } return cnt; } bool:CheckCanTeam(id) { new arg[5],CsTeam:num; get_pcvar_string(g_LCBT,arg,3); if(equali(arg,"T")) { num = CsTeam:CS_TEAM_T; } else if(equali(arg,"CT")) { num = CsTeam:CS_TEAM_CT; } else if(equali(arg,"ALL")) { num = CsTeam:CS_TEAM_UNASSIGNED; } else { num = CsTeam:CS_TEAM_UNASSIGNED; } if(num != CsTeam:CS_TEAM_UNASSIGNED && num != CsTeam:cs_get_user_team(id)) return false; return true; } bool:CanCheck(id,mode) { if( !get_pcvar_num( g_LENABLE ) ) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOTACTIVE); return false; } if( get_pcvar_num(g_LACCESS) != 0) if(!(get_user_flags(id) & ADMIN_IMMUNITY)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOACCESS); return false; } if(!pev_user_alive(id)) return false; if (!CheckCanTeam(id)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CBT); return false; } if( mode == 0) { if(g_havemine[id] <= 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_DONTHAVEMINE); return false; } } if (mode == 1) { if (get_pcvar_num(g_LBUYMODE) == 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CANTBUY); return false; } if (g_havemine[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_HAVEMAX); return false; } if (cs_get_user_money(id) < get_pcvar_num(g_LCOST)) { client_print(id, print_chat, "%s %s%d %s",CHATTAG, STR_NOMONEY,get_pcvar_num(g_LCOST),STR_NEEDED); return false; } } if(!CheckTime(id)) { client_print(id,print_chat, "%s %s %d %s",CHATTAG,STR_DELAY,get_pcvar_num(g_LDELAY)-g_nowtime,STR_SECONDS); return false; } return true; } bool:ReturnCheck( id ) { if(!CanCheck(id,-1)) return false; if(g_havemine[id] + 1 > get_pcvar_num(g_LAMMO)) return false; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return false; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return false; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return false; if(pev(tgt,LASERMINE_OWNER) != id) return false; return true; } bool:CreateCheck( id ) { if (!CanCheck(id,0)) return false; if (g_deployed[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MAXDEPLOY); return false; } //client_print(id,print_chat,"[Lasermine] your team deployed %d",TeamDeployedCount(id)) if(TeamDeployedCount(id) >= get_pcvar_num(g_LTMAX)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MANYPPL); return false; } new Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vOrigin[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction,Float:vTraceNormal[3]; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vTraceNormal ); return true; } client_print(id, print_chat, "%s %s",CHATTAG,STR_PLANTWALL) DeleteTask(id); return false; } public ltm_Think( i_Ent ) { if ( !pev_valid( i_Ent ) ) return FMRES_IGNORED; new EntityName[32]; pev( i_Ent, pev_classname, EntityName, 31); if(!get_pcvar_num(g_LENABLE)) return FMRES_IGNORED; if ( !equal( EntityName, ENT_CLASS_NAME ) ) return FMRES_IGNORED; static Float:fCurrTime; fCurrTime = get_gametime(); switch( pev( i_Ent, LASERMINE_STEP ) ) { case POWERUP_THINK : { new Float:fPowerupTime; pev( i_Ent, LASERMINE_POWERUP, fPowerupTime ); if( fCurrTime > fPowerupTime ) { set_pev( i_Ent, pev_solid, SOLID_BBOX ); set_pev( i_Ent, LASERMINE_STEP, BEAMBREAK_THINK ); PlaySound( i_Ent, ACTIVATE_SOUND ); } if(get_pcvar_num(g_LGLOW)!=0) { if(get_pcvar_num(g_LCLMODE)==0) { switch (pev(i_Ent,LASERMINE_TEAM)) { case CS_TEAM_T: set_rendering(i_Ent,kRenderFxGlowShell,255,0,0,kRenderNormal,5); case CS_TEAM_CT:set_rendering(i_Ent,kRenderFxGlowShell,0,0,255,kRenderNormal,5); } }else { set_rendering(i_Ent,kRenderFxGlowShell,0,255,0,kRenderNormal,5); } } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.1 ); } case BEAMBREAK_THINK : { static Float:vEnd[3],Float:vOrigin[3]; pev( i_Ent, pev_origin, vOrigin ); pev( i_Ent, LASERMINE_BEAMENDPOINT, vEnd ); static iHit, Float:fFraction; engfunc( EngFunc_TraceLine, vOrigin, vEnd, DONT_IGNORE_MONSTERS, i_Ent, 0 ); get_tr2( 0, TR_flFraction, fFraction ); iHit = get_tr2( 0, TR_pHit ); if ( fFraction < 1.0 ) { if(pev_valid(iHit)) { pev( iHit, pev_classname, EntityName, 31 ); if( !equal( EntityName, ENT_CLASS_NAME ) ) { set_pev( i_Ent, pev_enemy, iHit ); if(get_pcvar_num(g_LMODE) == MODE_LASERMINE) CreateLaserDamage(i_Ent,iHit); else if(get_pcvar_num(g_LFF) || CsTeams:pev(i_Ent,LASERMINE_TEAM) != cs_get_user_team(iHit)) set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } } } if(get_pcvar_num(g_LDMGMODE)!=0) if(pev(i_Ent,LASERMINE_HITING) != iHit) set_pev(i_Ent,LASERMINE_HITING,iHit); if ( pev_valid( i_Ent )) { static Float:fHealth; pev( i_Ent, pev_health, fHealth ); if( fHealth <= 0.0 || (pev(i_Ent,pev_flags) & FL_KILLME)) { set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } static Float:fBeamthink; pev( i_Ent, LASERMINE_BEAMTHINK, fBeamthink ); if( fBeamthink < fCurrTime && get_pcvar_num(g_LVISIBLE)) { DrawLaser(i_Ent, vOrigin, vEnd ); set_pev( i_Ent, LASERMINE_BEAMTHINK, fCurrTime + 0.1 ); } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.01 ); } } case EXPLOSE_THINK : { set_pev( i_Ent, pev_nextthink, 0.0 ); PlaySound( i_Ent, STOP_SOUND ); g_deployed[pev(i_Ent,LASERMINE_OWNER)]--; CreateExplosion( i_Ent ); CreateDamage(i_Ent,get_pcvar_float(g_LRDMG),get_pcvar_float(g_LRADIUS)) RemoveEntity ( i_Ent ); } } return FMRES_IGNORED; } PlaySound( i_Ent, i_SoundType ) { switch ( i_SoundType ) { case POWERUP_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, 0, PITCH_NORM ); } case ACTIVATE_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, 1, 75 ); } case STOP_SOUND : { emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, SND_STOP, PITCH_NORM ); emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, SND_STOP, 75 ); } } } DrawLaser(i_Ent, const Float:v_Origin[3], const Float:v_EndOrigin[3] ) { new tcolor[3]; new teamid = pev(i_Ent, LASERMINE_TEAM); if(get_pcvar_num(g_LCLMODE) == 0) { switch(teamid){ case 1:{ tcolor[0] = 255; tcolor[1] = 0; tcolor[2] = 0; } case 2:{ tcolor[0] = 0; tcolor[1] = 0; tcolor[2] = 255; } } }else { tcolor[0] = 0; tcolor[1] = 255; tcolor[2] = 0; } message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_BEAMPOINTS); engfunc(EngFunc_WriteCoord,v_Origin[0]); engfunc(EngFunc_WriteCoord,v_Origin[1]); engfunc(EngFunc_WriteCoord,v_Origin[2]); engfunc(EngFunc_WriteCoord,v_EndOrigin[0]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[1]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[2]); //Random write_short(beam); write_byte(0); write_byte(0); write_byte(1); //Life write_byte(5); //Width write_byte(0); //wave write_byte(tcolor[0]); // r write_byte(tcolor[1]); // g write_byte(tcolor[2]); // b write_byte(get_pcvar_num(g_LCBRIGHT)); write_byte(255); message_end(); } /* CreateDamage(iCurrent,DmgMAX,Float:Radius) { new AtkID = pev(iCurrent,LASERMINE_OWNER)// entity_get_int(iCurrent,LASERMINE_OWNER) new TeamID= pev(iCurrent,LASERMINE_TEAM) //entity_get_int(iCurrent,LASERMINE_INT_TEAM) new Player = -1; new Float:distance,dmg; new Float:tOrigin[3]; new Float:vOrigin[3]; new iHitHP,iHitTeam; pev(iCurrent,pev_origin,vOrigin); while((Player = engfunc(EngFunc_FindEntityInSphere, Player, vOrigin, Radius)) != 0) { if(is_user_alive(Player)) { pev(Player,pev_origin,tOrigin) distance = get_distance_f(vOrigin, tOrigin) dmg = floatround(DmgMAX - ((DmgMAX / Radius) * distance)) iHitHP = pev_user_health(Player) - dmg iHitTeam = int:bio_get_user_team(Player) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(Player, iHitHP) message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, {0,0,0}, Player) write_byte(dmg) write_byte(dmg) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } } } Player = engfunc(EngFunc_FindEntityInSphere,Player,vOrigin,Radius) } return PLUGIN_CONTINUE } */ CreateDamage(iCurrent,Float:DmgMAX,Float:Radius) { new Float:vecSrc[3]; pev(iCurrent, pev_origin, vecSrc); new AtkID =pev(iCurrent,LASERMINE_OWNER); new TeamID=pev(iCurrent,LASERMINE_TEAM); new ent = -1; new Float:tmpdmg = DmgMAX; new Float:kickback = 0.0; new Float:Tabsmin[3], Float:Tabsmax[3]; new Float:vecSpot[3]; new Float:Aabsmin[3], Float:Aabsmax[3]; new Float:vecSee[3]; new trRes; new Float:flFraction; new Float:vecEndPos[3]; new Float:distance; new Float:origin[3], Float:vecPush[3]; new Float:invlen; new Float:velocity[3]; new iHitHP,iHitTeam; new Float:falloff; if (Radius > 0.0) { falloff = DmgMAX / Radius; } else { falloff = 1.0; } while((ent = engfunc(EngFunc_FindEntityInSphere, ent, vecSrc, Radius)) != 0) { if(!pev_valid(ent)) continue; if(!(pev(ent, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { continue; } if(!pev_user_alive(ent)) continue; kickback = 1.0; tmpdmg = DmgMAX; pev(ent, pev_absmin, Tabsmin); pev(ent, pev_absmax, Tabsmax); xs_vec_add(Tabsmin,Tabsmax,Tabsmin); xs_vec_mul_scalar(Tabsmin,0.5,vecSpot); pev(iCurrent, pev_absmin, Aabsmin); pev(iCurrent, pev_absmax, Aabsmax); xs_vec_add(Aabsmin,Aabsmax,Aabsmin); xs_vec_mul_scalar(Aabsmin,0.5,vecSee); engfunc(EngFunc_TraceLine, vecSee, vecSpot, 0, iCurrent, trRes); get_tr2(trRes, TR_flFraction, flFraction); if (flFraction >= 0.9 || get_tr2(trRes, TR_pHit) == ent) { get_tr2(trRes, TR_vecEndPos, vecEndPos); distance = get_distance_f(vecSrc, vecEndPos) * falloff; tmpdmg -= distance; if(tmpdmg < 0.0) tmpdmg = 0.0; if(kickback != 0.0) { xs_vec_sub(vecSpot,vecSee,origin); invlen = 1.0/get_distance_f(vecSpot, vecSee); xs_vec_mul_scalar(origin,invlen,vecPush); pev(ent, pev_velocity, velocity) xs_vec_mul_scalar(vecPush,tmpdmg,vecPush); xs_vec_mul_scalar(vecPush,kickback,vecPush); xs_vec_add(velocity,vecPush,velocity); if(tmpdmg < 60.0) { xs_vec_mul_scalar(velocity,12.0,velocity); } else { xs_vec_mul_scalar(velocity,4.0,velocity); } if(velocity[0] != 0.0 || velocity[1] != 0.0 || velocity[2] != 0.0) { // There's some movement todo :) set_pev(ent, pev_velocity, velocity) } } iHitHP = pev_user_health(ent) - floatround(tmpdmg) iHitTeam = int:cs_get_user_team(ent) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(ent, iHitHP) engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},ent); write_byte(floatround(tmpdmg)) write_byte(floatround(tmpdmg)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vecSrc[0]) engfunc(EngFunc_WriteCoord,vecSrc[1]) engfunc(EngFunc_WriteCoord,vecSrc[2]) message_end() } } } } return } bool:pev_user_alive(ent) { new deadflag = pev(ent,pev_deadflag); if(deadflag != DEAD_NO) return false; return true; } CreateExplosion(iCurrent) { new Float:vOrigin[3]; pev(iCurrent,pev_origin,vOrigin); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(99); //99 = KillBeam write_short(iCurrent); message_end(); engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vOrigin, 0); write_byte(TE_EXPLOSION); engfunc(EngFunc_WriteCoord,vOrigin[0]); engfunc(EngFunc_WriteCoord,vOrigin[1]); engfunc(EngFunc_WriteCoord,vOrigin[2]); write_short(boom); write_byte(30); write_byte(15); write_byte(0); message_end(); } CreateLaserDamage(iCurrent,isHit) { if(isHit < 0 ) return PLUGIN_CONTINUE switch(get_pcvar_num(g_LDMGMODE)) { case 1: { if(pev(iCurrent,LASERMINE_HITING) == isHit) return PLUGIN_CONTINUE } case 2: { if(pev(iCurrent,LASERMINE_HITING) == isHit) { static Float:cnt static now,htime;now = floatround(get_gametime()) pev(iCurrent,LASERMINE_COUNT,cnt) htime = floatround(cnt) if(now - htime < get_pcvar_num(g_LDSEC)) { return PLUGIN_CONTINUE; }else{ set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } }else { set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } } } new Float:vOrigin[3],Float:vEnd[3] pev(iCurrent,pev_origin,vOrigin) pev(iCurrent,pev_vuser1,vEnd) new teamid = pev(iCurrent, LASERMINE_TEAM) new szClassName[32] new Alive,God new iHitTeam,iHitHP,id new hitscore szClassName[0] = '^0' pev(isHit,pev_classname,szClassName,32) if((pev(isHit, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { Alive = pev_user_alive(isHit) God = get_user_godmode(isHit) if(!Alive || God) return PLUGIN_CONTINUE iHitTeam = int:cs_get_user_team(isHit) iHitHP = pev_user_health(isHit) - get_pcvar_num(g_LDMG) id = pev(iCurrent,LASERMINE_OWNER)//, szNetName[32] if(iHitHP <= 0) { if(iHitTeam != teamid) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = 1 cs_set_user_money(id,cs_get_user_money(id) + get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) }else { if(get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = -1 cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) } } }else if(iHitTeam != teamid || get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) set_user_health(isHit,iHitHP) set_pev(iCurrent,LASERMINE_HITING,isHit); engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},isHit); write_byte(get_pcvar_num(g_LDMG)) write_byte(get_pcvar_num(g_LDMG)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } }else if(equal(szClassName, ENT_CLASS_NAME3)) { new hl; hl = pev_user_health(isHit); set_user_health(isHit,hl-get_pcvar_num(g_LDMG)); } return PLUGIN_CONTINUE } stock pev_user_health(id) { new Float:health pev(id,pev_health,health) return floatround(health) } stock set_user_health(id,health) { health > 0 ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id); } stock get_user_godmode(index) { new Float:val pev(index, pev_takedamage, val) return (val == DAMAGE_NO) } stock set_user_frags(index, frags) { set_pev(index, pev_frags, float(frags)) return 1 } stock pev_user_frags(index) { new Float:frags; pev(index,pev_frags,frags); return floatround(frags); } set_score(id,target,hitscore,HP){ new idfrags = pev_user_frags(id) + hitscore set_user_frags(id,idfrags) new tarfrags = pev_user_frags(target) + 1 set_user_frags(target,tarfrags) new idteam = int:cs_get_user_team(id) new iddeaths = cs_get_user_deaths(id) message_begin(MSG_ALL, g_msgDeathMsg, {0, 0, 0} ,0) write_byte(id) write_byte(target) write_byte(0) write_string(ENT_CLASS_NAME) message_end() message_begin(MSG_ALL, g_msgScoreInfo) write_byte(id) write_short(idfrags) write_short(iddeaths) write_short(0) write_short(idteam) message_end() set_msg_block(g_msgDeathMsg, BLOCK_ONCE) set_user_health(target, HP) } public BuyLasermine(id) { if(zp_is_nemesis_round() || zp_is_survivor_round() || zp_is_sniper_round() || zp_is_assassin_round() || zp_is_plague_round() || zp_is_swarm_round()) { client_print(id,print_chat,"[ZP] Nu poti folosi aceasta comanda cand este acest mod.") return 1 } if( !CanCheck(id,1) ) return PLUGIN_CONTINUE cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LCOST)) g_havemine[id]++; client_print(id, print_chat, "%s %s",CHATTAG,STR_BOUGHT) emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return PLUGIN_HANDLED } ShowAmmo(id) { new ammo[51] formatex(ammo, 50, "%s %i/%i",STR_STATE, g_havemine[id],get_pcvar_num(g_LAMMO)) message_begin(MSG_ONE, g_msgStatusText, {0,0,0}, id) write_byte(0) write_string(ammo) message_end() } public showInfo(id) { client_print(id, print_chat, STR_REF) } public say_lasermine(id){ new said[32] read_argv(1,said,31); if( !get_pcvar_num( g_LENABLE ) ){ return PLUGIN_CONTINUE } if (equali(said,"/buy lasermine")||equali(said,"/lm")){ BuyLasermine(id) }else if (equali(said, "lasermine") || equali(said, "/lasermine")){ const SIZE = 1024 new msg[SIZE+1],len = 0; len += formatex(msg[len], SIZE - len, "<html><body>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p>You can be setting the mine on the wall.</p><br/>") len += formatex(msg[len], SIZE - len, "<p>That laser will give what touched it damage.</p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine Commands</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>Say /buy lasermine</b> or <b>Say /lm</b> //buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>buy_lasermine</b> //bind ^"F2^" buy_lasermine : using F2 buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>+setlaser</b> //bind mouse3 +setlaser : using mouse3 set lasermine on wall<br/>") len += formatex(msg[len], SIZE - len, "</body></html>") show_motd(id, msg, "Lasermine Entity help") return PLUGIN_CONTINUE } else if (containi(said, "laser") != -1) { showInfo(id) return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public standing(id) { if (!g_settinglaser[id]) return PLUGIN_CONTINUE set_pev(id, pev_maxspeed, 1.0) return PLUGIN_CONTINUE } public ltm_PostThink(id) { if (!g_settinglaser[id] && plsetting[id]){ resetspeed(id) } else if (g_settinglaser[id] && !plsetting[id]) { pev(id, pev_maxspeed,plspeed[id]) set_pev(id, pev_maxspeed, 1.0) } plsetting[id] = g_settinglaser[id] return FMRES_IGNORED } public ltm_PreThink(id) { if (!pev_user_alive(id) || g_settinglaser[id] == true || is_user_bot(id) || get_pcvar_num(g_LCMDMODE) == 1) return FMRES_IGNORED; if(pev(id, pev_button ) & IN_USE && !(pev(id, pev_oldbuttons ) & IN_USE )) CreateLaserMine_Progress(id) return FMRES_IGNORED; } resetspeed(id) { set_pev(id, pev_maxspeed, plspeed[id]) } public client_putinserver(id){ g_deployed[id] = 0; g_havemine[id] = 0; DeleteTask(id); return PLUGIN_CONTINUE } public client_disconnect(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE DeleteTask(id); RemoveAllTripmines(id); return PLUGIN_CONTINUE } public newround(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE pev(id, pev_maxspeed,plspeed[id]) DeleteTask(id); RemoveAllTripmines(id); delaycount(id); SetStartAmmo(id); return PLUGIN_CONTINUE } public DeathEvent(){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE new id = read_data(2) if(is_user_connected(id)) DeleteTask(id); return PLUGIN_CONTINUE } public RemoveAllTripmines( i_Owner ) { new iEnt = g_MaxPL + 1; new clsname[32]; while( ( iEnt = engfunc( EngFunc_FindEntityByString, iEnt, "classname", ENT_CLASS_NAME ) ) ) { if ( i_Owner ) { if( pev( iEnt, LASERMINE_OWNER ) != i_Owner ) continue; clsname[0] = '^0' pev( iEnt, pev_classname, clsname, sizeof(clsname)-1 ); if ( equali( clsname, ENT_CLASS_NAME ) ) { PlaySound( iEnt, STOP_SOUND ); RemoveEntity( iEnt ); } } else set_pev( iEnt, pev_flags, FL_KILLME ); } g_deployed[i_Owner]=0; } SetStartAmmo(id) { new stammo = get_pcvar_num(g_LSTAMMO); if(stammo <= 0) return PLUGIN_CONTINUE; g_havemine[id] = (g_havemine[id] <= stammo) ? stammo : g_havemine[id]; return PLUGIN_CONTINUE; } public CutDeploy_onDamage(id) { if(get_user_health(id) < 1) DeleteTask(id); } DeleteTask(id) { if (task_exists((TASK_PLANT + id))) { remove_task((TASK_PLANT + id)) } if (task_exists((TASK_RELEASE + id))) { remove_task((TASK_RELEASE + id)) } g_settinglaser[id] = false return PLUGIN_CONTINUE; } stock set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); set_pev(entity, pev_renderfx, fx); set_pev(entity, pev_rendercolor, RenderColor); set_pev(entity, pev_rendermode, render); set_pev(entity, pev_renderamt, float(amount)); return 1 } get_offset_value(id, type) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; return get_pdata_int(id, key); } return -1; } set_offset_value(id, type, value) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { message_begin(MSG_ONE_UNRELIABLE, g_msgMoney, {0,0,0}, id); write_long(value); write_byte(1); // Flash (difference between new and old money) message_end(); } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; set_pdata_int(id, key, value); } return PLUGIN_CONTINUE; }
-
- Fost moderator
- Posts: 9362
- Joined: 06 Jul 2013, 22:08
- Detinator Steam: Da
- Detinator server CS: Nu
- Reputatie: Fost eXtream Mod
Fost Scripter eXtreamCS
Nume anterior: scosmynnnn - Has thanked: 492 times
- Been thanked: 547 times
- | Afiseaza codul
#include <amxmodx> #include <fakemeta> #include <xs> #define PLUGIN "Tripmine" #define VERSION "2.3" #define AUTHOR "ExTreamCS" #define RemoveEntity(%1) engfunc(EngFunc_RemoveEntity,%1) #define TASK_PLANT 15100 #define TASK_RESET 15500 #define TASK_RELEASE 15900 #define LASERMINE_TEAM pev_iuser1//EV_INT_iuser1 #define LASERMINE_OWNER pev_iuser2 //EV_INT_iuser3 #define LASERMINE_STEP pev_iuser3 #define LASERMINE_HITING pev_iuser4 #define LASERMINE_COUNT pev_fuser1 #define LASERMINE_POWERUP pev_fuser2 #define LASERMINE_BEAMTHINK pev_fuser3 #define LASERMINE_BEAMENDPOINT pev_vuser1 #define MAX_MINES 10 #define MODE_LASERMINE 0 #define OFFSET_TEAM 114 #define OFFSET_MONEY 115 #define OFFSET_DEATH 444 #define cs_get_user_team(%1) CsTeams:get_offset_value(%1,OFFSET_TEAM) #define cs_get_user_deaths(%1) get_offset_value(%1,OFFSET_DEATH) #define cs_get_user_money(%1) get_offset_value(%1,OFFSET_MONEY) #define cs_set_user_money(%1,%2) set_offset_value(%1,OFFSET_MONEY,%2) enum CsTeams { CS_TEAM_UNASSIGNED = 0, CS_TEAM_T = 1, CS_TEAM_CT = 2, CS_TEAM_SPECTATOR = 3 }; enum tripmine_e { TRIPMINE_IDLE1 = 0, TRIPMINE_IDLE2, TRIPMINE_ARM1, TRIPMINE_ARM2, TRIPMINE_FIDGET, TRIPMINE_HOLSTER, TRIPMINE_DRAW, TRIPMINE_WORLD, TRIPMINE_GROUND, }; enum { POWERUP_THINK, BEAMBREAK_THINK, EXPLOSE_THINK }; enum { POWERUP_SOUND, ACTIVATE_SOUND, STOP_SOUND }; new const ENT_MODELS[] = "models/v_laser_new.mdl", ENT_SOUND1[] = "weapons/mine_deploy.wav", ENT_SOUND2[] = "weapons/mine_charge.wav", ENT_SOUND3[] = "weapons/mine_activate.wav", ENT_SOUND4[] = "debris/beamstart9.wav", ENT_SOUND5[] = "items/gunpickup2.wav", ENT_SOUND6[] = "debris/bustglass1.wav", ENT_SOUND7[] = "debris/bustglass2.wav", ENT_SPRITE1[] = "sprites/laserbeam.spr", ENT_SPRITE2[] = "sprites/zerogxplode.spr"; new const ENT_CLASS_NAME[] = "lasermine", ENT_CLASS_NAME3[] = "func_breakable"; new const CHATTAG[] = "[Lasermine]", STR_NOTACTIVE[] = "Laserele nu sunt activate.", STR_DONTHAVEMINE[] = "Nu ai nici un laser.", STR_MAXDEPLOY[] = "Numarul maxim de lasere a fost atins.", STR_MANYPPL[] = "Prea multe lasere in echipa ta...", STR_PLANTWALL[] = "Trebuie sa plantezi laserul pe zid!", STR_REF[] = "Refer to a lasermine rule with this server. say 'lasermine'", STR_CBT[] = "Esti Zombie!Nu poti cumpara si planta un laser.", STR_CANTBUY[] = "Nu poti cumpara pe acest server.", STR_HAVEMAX[] = "Ai numarul maxim de lasere.", STR_NOMONEY[] = "Nu ai destui bani sa cumperi un laser! ($", STR_NEEDED[] = "needed)", STR_DELAY[] = "Poti cumpara si planta lasere in", STR_SECONDS[] = "secunde.", STR_BOUGHT[] = "Tocmai ai cumparat un laser.", STR_STATE[] = "LaserMines Ammo:", STR_NOACCESS[] = "Nu ai acces la aceasta comanda."; new g_EntMine; new beam, boom new g_LENABLE,g_LFMONEY,g_LAMMO,g_LDMG, g_LTMAX,g_LCOST,g_LHEALTH,g_LMODE,g_LRADIUS,g_LRDMG,g_LFF,g_LCBT; new g_LDELAY,/*g_LTHINK,*/g_LVISIBLE, g_LSTAMMO,g_LACCESS,g_LGLOW,g_LDMGMODE,g_LCLMODE,g_LCBRIGHT,g_LDSEC,g_LCMDMODE,g_LBUYMODE; new g_dcount[33],g_nowtime,g_MaxPL new bool:g_settinglaser[33] new g_msgDeathMsg,g_msgScoreInfo,g_msgDamage,g_msgStatusText,g_msgMoney; new Float:plspeed[33] new plsetting[33] new g_havemine[33]; new g_deployed[33]; native zp_is_nemesis_round() native zp_is_survivor_round() native zp_is_swarm_round() native zp_is_plague_round() native zp_is_sniper_round() native zp_is_assassin_round() #pragma tabsize 0 public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("+setlaser","CreateLaserMine_Progress_b"); register_clcmd("-setlaser","StopCreateLaserMine"); register_clcmd("+dellaser","ReturnLaserMine_Progress"); register_clcmd("-dellaser","StopReturnLaserMine"); register_clcmd("say","say_lasermine"); register_clcmd("buy_lasermine","BuyLasermine"); g_LENABLE = register_cvar("amx_ltm","1"); g_LACCESS = register_cvar("amx_ltm_acs","0"); //0 all, 1 admin g_LMODE = register_cvar("amx_ltm_mode","0"); //0 lasermine, 1 tripmine g_LAMMO = register_cvar("amx_ltm_ammo","1"); g_LDMG = register_cvar("amx_ltm_dmg","10000"); //laser hit dmg g_LCOST = register_cvar("amx_ltm_cost","0"); g_LFMONEY = register_cvar("amx_ltm_fragmoney","0"); g_LHEALTH = register_cvar("amx_ltm_health","500"); g_LTMAX = register_cvar("amx_ltm_teammax","20"); g_LRADIUS = register_cvar("amx_ltm_radius","25.0"); g_LRDMG = register_cvar("amx_ltm_rdmg","1000"); //radius damage g_LFF = register_cvar("amx_ltm_ff","0"); g_LCBT = register_cvar("amx_ltm_cbt","ALL"); g_LBUYMODE = register_cvar("amx_ltm_buymode","1"); g_LDELAY = register_cvar("amx_ltm_delay","14"); g_LVISIBLE = register_cvar("amx_ltm_line","1"); g_LGLOW = register_cvar("amx_ltm_glow","1"); g_LCBRIGHT = register_cvar("amx_ltm_bright","255"); //laser line brightness. g_LCLMODE = register_cvar("amx_ltm_color","0"); //0 is team color,1 is green g_LDMGMODE = register_cvar("amx_ltm_ldmgmode","0"); //0 - frame dmg, 1 - once dmg, 2 - 1 second dmg g_LDSEC = register_cvar("amx_ltm_ldmgseconds","1"); //mode 2 only, damage / seconds. default 1 (sec) g_LSTAMMO = register_cvar("amx_ltm_startammo","2"); g_LCMDMODE = register_cvar("amx_ltm_cmdmode","1"); //0 is +USE key, 1 is bind, 2 is each. register_event("DeathMsg", "DeathEvent", "a"); register_event("CurWeapon", "standing", "be", "1=1"); register_event("ResetHUD", "delaycount", "a"); register_event("ResetHUD", "newround", "b"); register_event("Damage","CutDeploy_onDamage","b"); g_msgDeathMsg = get_user_msgid("DeathMsg"); g_msgScoreInfo = get_user_msgid("ScoreInfo"); g_msgDamage = get_user_msgid("Damage"); g_msgStatusText = get_user_msgid("StatusText"); g_msgMoney = get_user_msgid("Money"); register_forward(FM_Think, "ltm_Think" ); register_forward(FM_PlayerPostThink, "ltm_PostThink" ); register_forward(FM_PlayerPreThink, "ltm_PreThink"); } public plugin_precache() { precache_sound(ENT_SOUND1); precache_sound(ENT_SOUND2); precache_sound(ENT_SOUND3); precache_sound(ENT_SOUND4); precache_sound(ENT_SOUND5); precache_sound(ENT_SOUND6); precache_sound(ENT_SOUND7); precache_model(ENT_MODELS); beam = precache_model(ENT_SPRITE1); boom = precache_model(ENT_SPRITE2); } public plugin_modules() { require_module("fakemeta"); require_module("cstrike"); } public plugin_cfg() { g_EntMine = engfunc(EngFunc_AllocString,ENT_CLASS_NAME3); arrayset(g_havemine,0,sizeof(g_havemine)); arrayset(g_deployed,0,sizeof(g_deployed)); g_MaxPL = get_maxplayers(); new file[64]; get_localinfo("amxx_configsdir",file,63); if(file_exists(file)) server_cmd("exec %s", file), server_exec(); } public delaycount(id) { g_dcount[id] = floatround(get_gametime()); } bool:CheckTime(id) { g_nowtime = floatround(get_gametime()) - g_dcount[id]; if(g_nowtime >= get_pcvar_num(g_LDELAY)) return true; return false; } public CreateLaserMine_Progress_b(id) { if(get_pcvar_num(g_LCMDMODE) != 0) CreateLaserMine_Progress(id); return 1; } public CreateLaserMine_Progress(id) { if (!CreateCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "Spawn", (TASK_PLANT + id)); return PLUGIN_HANDLED; } public ReturnLaserMine_Progress(id) { if (!ReturnCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "ReturnMine", (TASK_RELEASE + id)); return PLUGIN_HANDLED; } public StopCreateLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public StopReturnLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public ReturnMine(id) { id -= TASK_RELEASE; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return; if(pev(tgt,LASERMINE_OWNER) != id) return; RemoveEntity(tgt); g_havemine[id] ++; g_deployed[id] --; emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return; } public Spawn( id ) { id -= TASK_PLANT new i_Ent = engfunc(EngFunc_CreateNamedEntity,g_EntMine); if(!i_Ent) { client_print(id,print_chat,"[Laesrmine Debug] Can't Create Entity"); return PLUGIN_HANDLED_MAIN; } set_pev(i_Ent,pev_classname,ENT_CLASS_NAME); engfunc(EngFunc_SetModel,i_Ent,ENT_MODELS); set_pev(i_Ent,pev_solid,SOLID_NOT); set_pev(i_Ent,pev_movetype,MOVETYPE_FLY); set_pev(i_Ent,pev_frame,0); set_pev(i_Ent,pev_body,3); set_pev(i_Ent,pev_sequence,TRIPMINE_WORLD); set_pev(i_Ent,pev_framerate,0); set_pev(i_Ent,pev_takedamage,DAMAGE_YES); set_pev(i_Ent,pev_dmg,100.0); set_user_health(i_Ent,get_pcvar_num(g_LHEALTH)); new Float:vOrigin[3]; new Float:vNewOrigin[3],Float:vNormal[3],Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vEntAngles[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); } xs_vec_mul_scalar( vNormal, 8.0, vNormal ); xs_vec_add( vTraceEnd, vNormal, vNewOrigin ); engfunc(EngFunc_SetSize, i_Ent, Float:{ -4.0, -4.0, -4.0 }, Float:{ 4.0, 4.0, 4.0 } ); engfunc(EngFunc_SetOrigin, i_Ent, vNewOrigin ); vector_to_angle(vNormal,vEntAngles ); set_pev(i_Ent,pev_angles,vEntAngles ); new Float:vBeamEnd[3], Float:vTracedBeamEnd[3]; xs_vec_mul_scalar(vNormal, 8192.0, vNormal ); xs_vec_add( vNewOrigin, vNormal, vBeamEnd ); engfunc( EngFunc_TraceLine, vNewOrigin, vBeamEnd, IGNORE_MONSTERS, -1, 0 ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); get_tr2( 0, TR_vecEndPos, vTracedBeamEnd ); set_pev(i_Ent, LASERMINE_OWNER, id ); set_pev(i_Ent,LASERMINE_BEAMENDPOINT,vTracedBeamEnd); set_pev(i_Ent,LASERMINE_TEAM,int:cs_get_user_team(id)); new Float:fCurrTime = get_gametime(); set_pev(i_Ent,LASERMINE_POWERUP, fCurrTime + 2.5 ); set_pev(i_Ent,LASERMINE_STEP,POWERUP_THINK); set_pev(i_Ent,pev_nextthink, fCurrTime + 0.2 ); PlaySound(i_Ent,POWERUP_SOUND ); g_deployed[id]++; g_havemine[id]--; DeleteTask(id); ShowAmmo(id); return 1; } stock TeamDeployedCount(id) { static i; static CsTeams:t;t = cs_get_user_team(id); static cnt;cnt=0; for(i = 1;i <= g_MaxPL;i++) { if(is_user_connected(i)) if(t == cs_get_user_team(i)) cnt += g_deployed; } return cnt; } bool:CheckCanTeam(id) { new arg[5],CsTeam:num; get_pcvar_string(g_LCBT,arg,3); if(equali(arg,"T")) { num = CsTeam:CS_TEAM_T; } else if(equali(arg,"CT")) { num = CsTeam:CS_TEAM_CT; } else if(equali(arg,"ALL")) { num = CsTeam:CS_TEAM_UNASSIGNED; } else { num = CsTeam:CS_TEAM_UNASSIGNED; } if(num != CsTeam:CS_TEAM_UNASSIGNED && num != CsTeam:cs_get_user_team(id)) return false; return true; } bool:CanCheck(id,mode) { if( !get_pcvar_num( g_LENABLE ) ) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOTACTIVE); return false; } if( get_pcvar_num(g_LACCESS) != 0) if(!(get_user_flags(id) & ADMIN_IMMUNITY)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOACCESS); return false; } if(!pev_user_alive(id)) return false; if (!CheckCanTeam(id)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CBT); return false; } if( mode == 0) { if(g_havemine[id] <= 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_DONTHAVEMINE); return false; } } if (mode == 1) { if (get_pcvar_num(g_LBUYMODE) == 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CANTBUY); return false; } if (g_havemine[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_HAVEMAX); return false; } if (cs_get_user_money(id) < get_pcvar_num(g_LCOST)) { client_print(id, print_chat, "%s %s%d %s",CHATTAG, STR_NOMONEY,get_pcvar_num(g_LCOST),STR_NEEDED); return false; } } if(!CheckTime(id)) { client_print(id,print_chat, "%s %s %d %s",CHATTAG,STR_DELAY,get_pcvar_num(g_LDELAY)-g_nowtime,STR_SECONDS); return false; } return true; } bool:ReturnCheck( id ) { if(!CanCheck(id,-1)) return false; if(g_havemine[id] + 1 > get_pcvar_num(g_LAMMO)) return false; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return false; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return false; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return false; if(pev(tgt,LASERMINE_OWNER) != id) return false; return true; } bool:CreateCheck( id ) { if (!CanCheck(id,0)) return false; if (g_deployed[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MAXDEPLOY); return false; } //client_print(id,print_chat,"[Lasermine] your team deployed %d",TeamDeployedCount(id)) if(TeamDeployedCount(id) >= get_pcvar_num(g_LTMAX)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MANYPPL); return false; } new Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vOrigin[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction,Float:vTraceNormal[3]; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vTraceNormal ); return true; } client_print(id, print_chat, "%s %s",CHATTAG,STR_PLANTWALL) DeleteTask(id); return false; } public ltm_Think( i_Ent ) { if ( !pev_valid( i_Ent ) ) return FMRES_IGNORED; new EntityName[32]; pev( i_Ent, pev_classname, EntityName, 31); if(!get_pcvar_num(g_LENABLE)) return FMRES_IGNORED; if ( !equal( EntityName, ENT_CLASS_NAME ) ) return FMRES_IGNORED; static Float:fCurrTime; fCurrTime = get_gametime(); switch( pev( i_Ent, LASERMINE_STEP ) ) { case POWERUP_THINK : { new Float:fPowerupTime; pev( i_Ent, LASERMINE_POWERUP, fPowerupTime ); if( fCurrTime > fPowerupTime ) { set_pev( i_Ent, pev_solid, SOLID_BBOX ); set_pev( i_Ent, LASERMINE_STEP, BEAMBREAK_THINK ); PlaySound( i_Ent, ACTIVATE_SOUND ); } if(get_pcvar_num(g_LGLOW)!=0) { if(get_pcvar_num(g_LCLMODE)==0) { switch (pev(i_Ent,LASERMINE_TEAM)) { case CS_TEAM_T: set_rendering(i_Ent,kRenderFxGlowShell,255,0,0,kRenderNormal,5); case CS_TEAM_CT:set_rendering(i_Ent,kRenderFxGlowShell,0,0,255,kRenderNormal,5); } }else { set_rendering(i_Ent,kRenderFxGlowShell,0,255,0,kRenderNormal,5); } } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.1 ); } case BEAMBREAK_THINK : { static Float:vEnd[3],Float:vOrigin[3]; pev( i_Ent, pev_origin, vOrigin ); pev( i_Ent, LASERMINE_BEAMENDPOINT, vEnd ); static iHit, Float:fFraction; engfunc( EngFunc_TraceLine, vOrigin, vEnd, DONT_IGNORE_MONSTERS, i_Ent, 0 ); get_tr2( 0, TR_flFraction, fFraction ); iHit = get_tr2( 0, TR_pHit ); if ( fFraction < 1.0 ) { if(pev_valid(iHit)) { pev( iHit, pev_classname, EntityName, 31 ); if( !equal( EntityName, ENT_CLASS_NAME ) ) { set_pev( i_Ent, pev_enemy, iHit ); if(get_pcvar_num(g_LMODE) == MODE_LASERMINE) CreateLaserDamage(i_Ent,iHit); else if(get_pcvar_num(g_LFF) || CsTeams:pev(i_Ent,LASERMINE_TEAM) != cs_get_user_team(iHit)) set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } } } if(get_pcvar_num(g_LDMGMODE)!=0) if(pev(i_Ent,LASERMINE_HITING) != iHit) set_pev(i_Ent,LASERMINE_HITING,iHit); if ( pev_valid( i_Ent )) { static Float:fHealth; pev( i_Ent, pev_health, fHealth ); if( fHealth <= 0.0 || (pev(i_Ent,pev_flags) & FL_KILLME)) { set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } static Float:fBeamthink; pev( i_Ent, LASERMINE_BEAMTHINK, fBeamthink ); if( fBeamthink < fCurrTime && get_pcvar_num(g_LVISIBLE)) { DrawLaser(i_Ent, vOrigin, vEnd ); set_pev( i_Ent, LASERMINE_BEAMTHINK, fCurrTime + 0.1 ); } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.01 ); } } case EXPLOSE_THINK : { set_pev( i_Ent, pev_nextthink, 0.0 ); PlaySound( i_Ent, STOP_SOUND ); g_deployed[pev(i_Ent,LASERMINE_OWNER)]--; CreateExplosion( i_Ent ); CreateDamage(i_Ent,get_pcvar_float(g_LRDMG),get_pcvar_float(g_LRADIUS)) RemoveEntity ( i_Ent ); } } return FMRES_IGNORED; } PlaySound( i_Ent, i_SoundType ) { switch ( i_SoundType ) { case POWERUP_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, 0, PITCH_NORM ); } case ACTIVATE_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, 1, 75 ); } case STOP_SOUND : { emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, SND_STOP, PITCH_NORM ); emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, SND_STOP, 75 ); } } } DrawLaser(i_Ent, const Float:v_Origin[3], const Float:v_EndOrigin[3] ) { new tcolor[3]; new teamid = pev(i_Ent, LASERMINE_TEAM); if(get_pcvar_num(g_LCLMODE) == 0) { switch(teamid){ case 1:{ tcolor[0] = 255; tcolor[1] = 0; tcolor[2] = 0; } case 2:{ tcolor[0] = 0; tcolor[1] = 0; tcolor[2] = 255; } } }else { tcolor[0] = 0; tcolor[1] = 255; tcolor[2] = 0; } message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_BEAMPOINTS); engfunc(EngFunc_WriteCoord,v_Origin[0]); engfunc(EngFunc_WriteCoord,v_Origin[1]); engfunc(EngFunc_WriteCoord,v_Origin[2]); engfunc(EngFunc_WriteCoord,v_EndOrigin[0]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[1]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[2]); //Random write_short(beam); write_byte(0); write_byte(0); write_byte(1); //Life write_byte(5); //Width write_byte(0); //wave write_byte(tcolor[0]); // r write_byte(tcolor[1]); // g write_byte(tcolor[2]); // b write_byte(get_pcvar_num(g_LCBRIGHT)); write_byte(255); message_end(); } /* CreateDamage(iCurrent,DmgMAX,Float:Radius) { new AtkID = pev(iCurrent,LASERMINE_OWNER)// entity_get_int(iCurrent,LASERMINE_OWNER) new TeamID= pev(iCurrent,LASERMINE_TEAM) //entity_get_int(iCurrent,LASERMINE_INT_TEAM) new Player = -1; new Float:distance,dmg; new Float:tOrigin[3]; new Float:vOrigin[3]; new iHitHP,iHitTeam; pev(iCurrent,pev_origin,vOrigin); while((Player = engfunc(EngFunc_FindEntityInSphere, Player, vOrigin, Radius)) != 0) { if(is_user_alive(Player)) { pev(Player,pev_origin,tOrigin) distance = get_distance_f(vOrigin, tOrigin) dmg = floatround(DmgMAX - ((DmgMAX / Radius) * distance)) iHitHP = pev_user_health(Player) - dmg iHitTeam = int:bio_get_user_team(Player) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(Player, iHitHP) message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, {0,0,0}, Player) write_byte(dmg) write_byte(dmg) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } } } Player = engfunc(EngFunc_FindEntityInSphere,Player,vOrigin,Radius) } return PLUGIN_CONTINUE } */ CreateDamage(iCurrent,Float:DmgMAX,Float:Radius) { new Float:vecSrc[3]; pev(iCurrent, pev_origin, vecSrc); new AtkID =pev(iCurrent,LASERMINE_OWNER); new TeamID=pev(iCurrent,LASERMINE_TEAM); new ent = -1; new Float:tmpdmg = DmgMAX; new Float:kickback = 0.0; new Float:Tabsmin[3], Float:Tabsmax[3]; new Float:vecSpot[3]; new Float:Aabsmin[3], Float:Aabsmax[3]; new Float:vecSee[3]; new trRes; new Float:flFraction; new Float:vecEndPos[3]; new Float:distance; new Float:origin[3], Float:vecPush[3]; new Float:invlen; new Float:velocity[3]; new iHitHP,iHitTeam; new Float:falloff; if (Radius > 0.0) { falloff = DmgMAX / Radius; } else { falloff = 1.0; } while((ent = engfunc(EngFunc_FindEntityInSphere, ent, vecSrc, Radius)) != 0) { if(!pev_valid(ent)) continue; if(!(pev(ent, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { continue; } if(!pev_user_alive(ent)) continue; kickback = 1.0; tmpdmg = DmgMAX; pev(ent, pev_absmin, Tabsmin); pev(ent, pev_absmax, Tabsmax); xs_vec_add(Tabsmin,Tabsmax,Tabsmin); xs_vec_mul_scalar(Tabsmin,0.5,vecSpot); pev(iCurrent, pev_absmin, Aabsmin); pev(iCurrent, pev_absmax, Aabsmax); xs_vec_add(Aabsmin,Aabsmax,Aabsmin); xs_vec_mul_scalar(Aabsmin,0.5,vecSee); engfunc(EngFunc_TraceLine, vecSee, vecSpot, 0, iCurrent, trRes); get_tr2(trRes, TR_flFraction, flFraction); if (flFraction >= 0.9 || get_tr2(trRes, TR_pHit) == ent) { get_tr2(trRes, TR_vecEndPos, vecEndPos); distance = get_distance_f(vecSrc, vecEndPos) * falloff; tmpdmg -= distance; if(tmpdmg < 0.0) tmpdmg = 0.0; if(kickback != 0.0) { xs_vec_sub(vecSpot,vecSee,origin); invlen = 1.0/get_distance_f(vecSpot, vecSee); xs_vec_mul_scalar(origin,invlen,vecPush); pev(ent, pev_velocity, velocity) xs_vec_mul_scalar(vecPush,tmpdmg,vecPush); xs_vec_mul_scalar(vecPush,kickback,vecPush); xs_vec_add(velocity,vecPush,velocity); if(tmpdmg < 60.0) { xs_vec_mul_scalar(velocity,12.0,velocity); } else { xs_vec_mul_scalar(velocity,4.0,velocity); } if(velocity[0] != 0.0 || velocity[1] != 0.0 || velocity[2] != 0.0) { // There's some movement todo :) set_pev(ent, pev_velocity, velocity) } } iHitHP = pev_user_health(ent) - floatround(tmpdmg) iHitTeam = int:cs_get_user_team(ent) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(ent, iHitHP) engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},ent); write_byte(floatround(tmpdmg)) write_byte(floatround(tmpdmg)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vecSrc[0]) engfunc(EngFunc_WriteCoord,vecSrc[1]) engfunc(EngFunc_WriteCoord,vecSrc[2]) message_end() } } } } return } bool:pev_user_alive(ent) { new deadflag = pev(ent,pev_deadflag); if(deadflag != DEAD_NO) return false; return true; } CreateExplosion(iCurrent) { new Float:vOrigin[3]; pev(iCurrent,pev_origin,vOrigin); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(99); //99 = KillBeam write_short(iCurrent); message_end(); engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vOrigin, 0); write_byte(TE_EXPLOSION); engfunc(EngFunc_WriteCoord,vOrigin[0]); engfunc(EngFunc_WriteCoord,vOrigin[1]); engfunc(EngFunc_WriteCoord,vOrigin[2]); write_short(boom); write_byte(30); write_byte(15); write_byte(0); message_end(); } CreateLaserDamage(iCurrent,isHit) { if(isHit < 0 ) return PLUGIN_CONTINUE switch(get_pcvar_num(g_LDMGMODE)) { case 1: { if(pev(iCurrent,LASERMINE_HITING) == isHit) return PLUGIN_CONTINUE } case 2: { if(pev(iCurrent,LASERMINE_HITING) == isHit) { static Float:cnt static now,htime;now = floatround(get_gametime()) pev(iCurrent,LASERMINE_COUNT,cnt) htime = floatround(cnt) if(now - htime < get_pcvar_num(g_LDSEC)) { return PLUGIN_CONTINUE; }else{ set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } }else { set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } } } new Float:vOrigin[3],Float:vEnd[3] pev(iCurrent,pev_origin,vOrigin) pev(iCurrent,pev_vuser1,vEnd) new teamid = pev(iCurrent, LASERMINE_TEAM) new szClassName[32] new Alive,God new iHitTeam,iHitHP,id new hitscore szClassName[0] = '^0' pev(isHit,pev_classname,szClassName,32) if((pev(isHit, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { Alive = pev_user_alive(isHit) God = get_user_godmode(isHit) if(!Alive || God) return PLUGIN_CONTINUE iHitTeam = int:cs_get_user_team(isHit) iHitHP = pev_user_health(isHit) - get_pcvar_num(g_LDMG) id = pev(iCurrent,LASERMINE_OWNER)//, szNetName[32] if(iHitHP <= 0) { if(iHitTeam != teamid) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = 1 cs_set_user_money(id,cs_get_user_money(id) + get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) }else { if(get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = -1 cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) } } }else if(iHitTeam != teamid || get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) set_user_health(isHit,iHitHP) set_pev(iCurrent,LASERMINE_HITING,isHit); engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},isHit); write_byte(get_pcvar_num(g_LDMG)) write_byte(get_pcvar_num(g_LDMG)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } }else if(equal(szClassName, ENT_CLASS_NAME3)) { new hl; hl = pev_user_health(isHit); set_user_health(isHit,hl-get_pcvar_num(g_LDMG)); } return PLUGIN_CONTINUE } stock pev_user_health(id) { new Float:health pev(id,pev_health,health) return floatround(health) } stock set_user_health(id,health) { health > 0 ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id); } stock get_user_godmode(index) { new Float:val pev(index, pev_takedamage, val) return (val == DAMAGE_NO) } stock set_user_frags(index, frags) { set_pev(index, pev_frags, float(frags)) return 1 } stock pev_user_frags(index) { new Float:frags; pev(index,pev_frags,frags); return floatround(frags); } set_score(id,target,hitscore,HP){ new idfrags = pev_user_frags(id) + hitscore set_user_frags(id,idfrags) new tarfrags = pev_user_frags(target) + 1 set_user_frags(target,tarfrags) new idteam = int:cs_get_user_team(id) new iddeaths = cs_get_user_deaths(id) message_begin(MSG_ALL, g_msgDeathMsg, {0, 0, 0} ,0) write_byte(id) write_byte(target) write_byte(0) write_string(ENT_CLASS_NAME) message_end() message_begin(MSG_ALL, g_msgScoreInfo) write_byte(id) write_short(idfrags) write_short(iddeaths) write_short(0) write_short(idteam) message_end() set_msg_block(g_msgDeathMsg, BLOCK_ONCE) set_user_health(target, HP) } public BuyLasermine(id) { /*if(zp_is_nemesis_round() || zp_is_survivor_round() || zp_is_sniper_round() || zp_is_assassin_round() || zp_is_plague_round() || zp_is_swarm_round()) { client_print(id,print_chat,"[ZP] Nu poti folosi aceasta comanda cand este acest mod.") return 1 }*/ if( !CanCheck(id,1) ) return PLUGIN_CONTINUE cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LCOST)) g_havemine[id]++; client_print(id, print_chat, "%s %s",CHATTAG,STR_BOUGHT) emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return PLUGIN_HANDLED } ShowAmmo(id) { new ammo[51] formatex(ammo, 50, "%s %i/%i",STR_STATE, g_havemine[id],get_pcvar_num(g_LAMMO)) message_begin(MSG_ONE, g_msgStatusText, {0,0,0}, id) write_byte(0) write_string(ammo) message_end() } public showInfo(id) { client_print(id, print_chat, STR_REF) } public say_lasermine(id){ new said[32] read_argv(1,said,31); if( !get_pcvar_num( g_LENABLE ) ){ return PLUGIN_CONTINUE } if (equali(said,"/buy lasermine")||equali(said,"/lm")){ if(zp_is_nemesis_round() || zp_is_survivor_round() || zp_is_sniper_round() || zp_is_assassin_round() || zp_is_plague_round() || zp_is_swarm_round()) { client_print(id,print_chat,"[ZP] Nu poti folosi aceasta comanda cand este acest mod.") return 1 } else BuyLasermine(id) }else if (equali(said, "lasermine") || equali(said, "/lasermine")){ const SIZE = 1024 new msg[SIZE+1],len = 0; len += formatex(msg[len], SIZE - len, "<html><body>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p>You can be setting the mine on the wall.</p><br/>") len += formatex(msg[len], SIZE - len, "<p>That laser will give what touched it damage.</p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine Commands</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>Say /buy lasermine</b> or <b>Say /lm</b> //buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>buy_lasermine</b> //bind ^"F2^" buy_lasermine : using F2 buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>+setlaser</b> //bind mouse3 +setlaser : using mouse3 set lasermine on wall<br/>") len += formatex(msg[len], SIZE - len, "</body></html>") show_motd(id, msg, "Lasermine Entity help") return PLUGIN_CONTINUE } else if (containi(said, "laser") != -1) { showInfo(id) return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public standing(id) { if (!g_settinglaser[id]) return PLUGIN_CONTINUE set_pev(id, pev_maxspeed, 1.0) return PLUGIN_CONTINUE } public ltm_PostThink(id) { if (!g_settinglaser[id] && plsetting[id]){ resetspeed(id) } else if (g_settinglaser[id] && !plsetting[id]) { pev(id, pev_maxspeed,plspeed[id]) set_pev(id, pev_maxspeed, 1.0) } plsetting[id] = g_settinglaser[id] return FMRES_IGNORED } public ltm_PreThink(id) { if (!pev_user_alive(id) || g_settinglaser[id] == true || is_user_bot(id) || get_pcvar_num(g_LCMDMODE) == 1) return FMRES_IGNORED; if(pev(id, pev_button ) & IN_USE && !(pev(id, pev_oldbuttons ) & IN_USE )) CreateLaserMine_Progress(id) return FMRES_IGNORED; } resetspeed(id) { set_pev(id, pev_maxspeed, plspeed[id]) } public client_putinserver(id){ g_deployed[id] = 0; g_havemine[id] = 0; DeleteTask(id); return PLUGIN_CONTINUE } public client_disconnect(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE DeleteTask(id); RemoveAllTripmines(id); return PLUGIN_CONTINUE } public newround(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE pev(id, pev_maxspeed,plspeed[id]) DeleteTask(id); RemoveAllTripmines(id); delaycount(id); SetStartAmmo(id); return PLUGIN_CONTINUE } public DeathEvent(){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE new id = read_data(2) if(is_user_connected(id)) DeleteTask(id); return PLUGIN_CONTINUE } public RemoveAllTripmines( i_Owner ) { new iEnt = g_MaxPL + 1; new clsname[32]; while( ( iEnt = engfunc( EngFunc_FindEntityByString, iEnt, "classname", ENT_CLASS_NAME ) ) ) { if ( i_Owner ) { if( pev( iEnt, LASERMINE_OWNER ) != i_Owner ) continue; clsname[0] = '^0' pev( iEnt, pev_classname, clsname, sizeof(clsname)-1 ); if ( equali( clsname, ENT_CLASS_NAME ) ) { PlaySound( iEnt, STOP_SOUND ); RemoveEntity( iEnt ); } } else set_pev( iEnt, pev_flags, FL_KILLME ); } g_deployed[i_Owner]=0; } SetStartAmmo(id) { new stammo = get_pcvar_num(g_LSTAMMO); if(stammo <= 0) return PLUGIN_CONTINUE; g_havemine[id] = (g_havemine[id] <= stammo) ? stammo : g_havemine[id]; return PLUGIN_CONTINUE; } public CutDeploy_onDamage(id) { if(get_user_health(id) < 1) DeleteTask(id); } DeleteTask(id) { if (task_exists((TASK_PLANT + id))) { remove_task((TASK_PLANT + id)) } if (task_exists((TASK_RELEASE + id))) { remove_task((TASK_RELEASE + id)) } g_settinglaser[id] = false return PLUGIN_CONTINUE; } stock set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); set_pev(entity, pev_renderfx, fx); set_pev(entity, pev_rendercolor, RenderColor); set_pev(entity, pev_rendermode, render); set_pev(entity, pev_renderamt, float(amount)); return 1 } get_offset_value(id, type) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; return get_pdata_int(id, key); } return -1; } set_offset_value(id, type, value) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { message_begin(MSG_ONE_UNRELIABLE, g_msgMoney, {0,0,0}, id); write_long(value); write_byte(1); // Flash (difference between new and old money) message_end(); } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; set_pdata_int(id, key, value); } return PLUGIN_CONTINUE; }
- w3zoo_RedX
- Membru, skill +2
- Posts: 737
- Joined: 21 Dec 2013, 22:16
- Detinator Steam: Da
- CS Status: Scripter CS.
- Detinator server CS: PM.
- SteamID: PM.
- Location: Bucuresti sector 2
- Has thanked: 45 times
- Been thanked: 45 times
- Contact:
- | Afiseaza codul
#include <amxmodx> #include <fakemeta> #include <xs> #define PLUGIN "Tripmine" #define VERSION "2.3" #define AUTHOR "ExTreamCS" #define RemoveEntity(%1) engfunc(EngFunc_RemoveEntity,%1) #define TASK_PLANT 15100 #define TASK_RESET 15500 #define TASK_RELEASE 15900 #define LASERMINE_TEAM pev_iuser1//EV_INT_iuser1 #define LASERMINE_OWNER pev_iuser2 //EV_INT_iuser3 #define LASERMINE_STEP pev_iuser3 #define LASERMINE_HITING pev_iuser4 #define LASERMINE_COUNT pev_fuser1 #define LASERMINE_POWERUP pev_fuser2 #define LASERMINE_BEAMTHINK pev_fuser3 #define LASERMINE_BEAMENDPOINT pev_vuser1 #define MAX_MINES 10 #define MODE_LASERMINE 0 #define OFFSET_TEAM 114 #define OFFSET_MONEY 115 #define OFFSET_DEATH 444 #define cs_get_user_team(%1) CsTeams:get_offset_value(%1,OFFSET_TEAM) #define cs_get_user_deaths(%1) get_offset_value(%1,OFFSET_DEATH) #define cs_get_user_money(%1) get_offset_value(%1,OFFSET_MONEY) #define cs_set_user_money(%1,%2) set_offset_value(%1,OFFSET_MONEY,%2) enum CsTeams { CS_TEAM_UNASSIGNED = 0, CS_TEAM_T = 1, CS_TEAM_CT = 2, CS_TEAM_SPECTATOR = 3 }; enum tripmine_e { TRIPMINE_IDLE1 = 0, TRIPMINE_IDLE2, TRIPMINE_ARM1, TRIPMINE_ARM2, TRIPMINE_FIDGET, TRIPMINE_HOLSTER, TRIPMINE_DRAW, TRIPMINE_WORLD, TRIPMINE_GROUND, }; enum { POWERUP_THINK, BEAMBREAK_THINK, EXPLOSE_THINK }; enum { POWERUP_SOUND, ACTIVATE_SOUND, STOP_SOUND }; new const ENT_MODELS[] = "models/v_laser_new.mdl", ENT_SOUND1[] = "weapons/mine_deploy.wav", ENT_SOUND2[] = "weapons/mine_charge.wav", ENT_SOUND3[] = "weapons/mine_activate.wav", ENT_SOUND4[] = "debris/beamstart9.wav", ENT_SOUND5[] = "items/gunpickup2.wav", ENT_SOUND6[] = "debris/bustglass1.wav", ENT_SOUND7[] = "debris/bustglass2.wav", ENT_SPRITE1[] = "sprites/laserbeam.spr", ENT_SPRITE2[] = "sprites/zerogxplode.spr"; new const ENT_CLASS_NAME[] = "lasermine", ENT_CLASS_NAME3[] = "func_breakable"; new const CHATTAG[] = "[Lasermine]", STR_NOTACTIVE[] = "Laserele nu sunt activate.", STR_NEMROUND[] = "etc.", STR_SURVROUND[] = "etc..", STR_ASSROUND[] = "etc..", STR_SNIPERROUND[] = "etc..", STR_PLAGUEROUND[] = "etc..", STR_ARMAROUND[] = "etc.", STR_DONTHAVEMINE[] = "Nu ai nici un laser.", STR_MAXDEPLOY[] = "Numarul maxim de lasere a fost atins.", STR_MANYPPL[] = "Prea multe lasere in echipa ta...", STR_PLANTWALL[] = "Trebuie sa plantezi laserul pe zid!", STR_REF[] = "Refer to a lasermine rule with this server. say 'lasermine'", STR_CBT[] = "Esti Zombie!Nu poti cumpara si planta un laser.", STR_CANTBUY[] = "Nu poti cumpara pe acest server.", STR_HAVEMAX[] = "Ai numarul maxim de lasere.", STR_NOMONEY[] = "Nu ai destui bani sa cumperi un laser! ($", STR_NEEDED[] = "needed)", STR_DELAY[] = "Poti cumpara si planta lasere in", STR_SECONDS[] = "secunde.", STR_BOUGHT[] = "Tocmai ai cumparat un laser.", STR_STATE[] = "LaserMines Ammo:", STR_NOACCESS[] = "Nu ai acces la aceasta comanda."; new g_EntMine; new beam, boom new g_LENABLE,g_LFMONEY,g_LAMMO,g_LDMG, g_LTMAX,g_LCOST,g_LHEALTH,g_LMODE,g_LRADIUS,g_LRDMG,g_LFF,g_LCBT,g_NEMROUND, g_SURVROUND, g_ASSROUND, g_SNIPERROUND, g_ARMAROUND, g_PLAGUEROUND; new g_LDELAY,/*g_LTHINK,*/g_LVISIBLE, g_LSTAMMO,g_LACCESS,g_LGLOW,g_LDMGMODE,g_LCLMODE,g_LCBRIGHT,g_LDSEC,g_LCMDMODE,g_LBUYMODE; new g_dcount[33],g_nowtime,g_MaxPL new bool:g_settinglaser[33] new g_msgDeathMsg,g_msgScoreInfo,g_msgDamage,g_msgStatusText,g_msgMoney; new Float:plspeed[33] new plsetting[33] new g_havemine[33]; new g_deployed[33]; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("+setlaser","CreateLaserMine_Progress_b"); register_clcmd("-setlaser","StopCreateLaserMine"); register_clcmd("+dellaser","ReturnLaserMine_Progress"); register_clcmd("-dellaser","StopReturnLaserMine"); register_clcmd("say","say_lasermine"); register_clcmd("buy_lasermine","BuyLasermine"); g_LENABLE = register_cvar("amx_ltm","1"); g_LACCESS = register_cvar("amx_ltm_acs","0"); //0 all, 1 admin g_LMODE = register_cvar("amx_ltm_mode","0"); //0 lasermine, 1 tripmine g_LAMMO = register_cvar("amx_ltm_ammo","1"); g_LDMG = register_cvar("amx_ltm_dmg","10000"); //laser hit dmg g_LCOST = register_cvar("amx_ltm_cost","0"); g_LFMONEY = register_cvar("amx_ltm_fragmoney","0"); g_LHEALTH = register_cvar("amx_ltm_health","500"); g_LTMAX = register_cvar("amx_ltm_teammax","20"); g_LRADIUS = register_cvar("amx_ltm_radius","25.0"); g_LRDMG = register_cvar("amx_ltm_rdmg","1000"); //radius damage g_LFF = register_cvar("amx_ltm_ff","0"); g_LCBT = register_cvar("amx_ltm_cbt","ALL"); g_LBUYMODE = register_cvar("amx_ltm_buymode","1"); g_LDELAY = register_cvar("amx_ltm_delay","14"); g_LVISIBLE = register_cvar("amx_ltm_line","1"); g_LGLOW = register_cvar("amx_ltm_glow","1"); g_LCBRIGHT = register_cvar("amx_ltm_bright","255"); //laser line brightness. g_LCLMODE = register_cvar("amx_ltm_color","0"); //0 is team color,1 is green g_LDMGMODE = register_cvar("amx_ltm_ldmgmode","0"); //0 - frame dmg, 1 - once dmg, 2 - 1 second dmg g_LDSEC = register_cvar("amx_ltm_ldmgseconds","1"); //mode 2 only, damage / seconds. default 1 (sec) g_LSTAMMO = register_cvar("amx_ltm_startammo","2"); g_LCMDMODE = register_cvar("amx_ltm_cmdmode","1"); //0 is +USE key, 1 is bind, 2 is each. g_NEMROUND = register_cvar("zp_ltm_nemround","1"); g_SURVROUND = register_cvar("zp_ltm_survround","1"); g_ASSROUND = register_cvar("zp_ltm_assassinround","1"); g_SNIPERROUND = register_cvar("zp_ltm_sniperround","1"); g_PLAGUEROUND = register_cvar("zp_ltm_plagueround","1"); g_ARMAROUND = register_cvar("zp_ltm_armaround","1"); register_event("DeathMsg", "DeathEvent", "a"); register_event("CurWeapon", "standing", "be", "1=1"); register_event("ResetHUD", "delaycount", "a"); register_event("ResetHUD", "newround", "b"); register_event("Damage","CutDeploy_onDamage","b"); g_msgDeathMsg = get_user_msgid("DeathMsg"); g_msgScoreInfo = get_user_msgid("ScoreInfo"); g_msgDamage = get_user_msgid("Damage"); g_msgStatusText = get_user_msgid("StatusText"); g_msgMoney = get_user_msgid("Money"); register_forward(FM_Think, "ltm_Think" ); register_forward(FM_PlayerPostThink, "ltm_PostThink" ); register_forward(FM_PlayerPreThink, "ltm_PreThink"); } public plugin_precache() { precache_sound(ENT_SOUND1); precache_sound(ENT_SOUND2); precache_sound(ENT_SOUND3); precache_sound(ENT_SOUND4); precache_sound(ENT_SOUND5); precache_sound(ENT_SOUND6); precache_sound(ENT_SOUND7); precache_model(ENT_MODELS); beam = precache_model(ENT_SPRITE1); boom = precache_model(ENT_SPRITE2); return PLUGIN_CONTINUE; } public plugin_modules() { require_module("fakemeta"); require_module("cstrike"); } public plugin_cfg() { g_EntMine = engfunc(EngFunc_AllocString,ENT_CLASS_NAME3); arrayset(g_havemine,0,sizeof(g_havemine)); arrayset(g_deployed,0,sizeof(g_deployed)); g_MaxPL = get_maxplayers(); new file[64]; get_localinfo("amxx_configsdir",file,63); if(file_exists(file)) server_cmd("exec %s", file), server_exec(); } public delaycount(id) { g_dcount[id] = floatround(get_gametime()); } bool:CheckTime(id) { g_nowtime = floatround(get_gametime()) - g_dcount[id]; if(g_nowtime >= get_pcvar_num(g_LDELAY)) return true; return false; } public CreateLaserMine_Progress_b(id) { if(get_pcvar_num(g_LCMDMODE) != 0) CreateLaserMine_Progress(id); return PLUGIN_HANDLED; } public CreateLaserMine_Progress(id) { if (!CreateCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "Spawn", (TASK_PLANT + id)); return PLUGIN_HANDLED; } public ReturnLaserMine_Progress(id) { if (!ReturnCheck(id)) return PLUGIN_HANDLED; g_settinglaser[id] = true; message_begin( MSG_ONE, 108, {0,0,0}, id ); write_byte(1); write_byte(0); message_end(); set_task(1.2, "ReturnMine", (TASK_RELEASE + id)); return PLUGIN_HANDLED; } public StopCreateLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public StopReturnLaserMine(id) { DeleteTask(id); message_begin(MSG_ONE, 108, {0,0,0}, id); write_byte(0); write_byte(0); message_end(); return PLUGIN_HANDLED; } public ReturnMine(id) { id -= TASK_RELEASE; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return; if(pev(tgt,LASERMINE_OWNER) != id) return; RemoveEntity(tgt); g_havemine[id] ++; g_deployed[id] --; emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return; } public Spawn( id ) { id -= TASK_PLANT new i_Ent = engfunc(EngFunc_CreateNamedEntity,g_EntMine); if(!i_Ent) { client_print(id,print_chat,"[Laesrmine Debug] Can't Create Entity"); return PLUGIN_HANDLED_MAIN; } set_pev(i_Ent,pev_classname,ENT_CLASS_NAME); engfunc(EngFunc_SetModel,i_Ent,ENT_MODELS); set_pev(i_Ent,pev_solid,SOLID_NOT); set_pev(i_Ent,pev_movetype,MOVETYPE_FLY); set_pev(i_Ent,pev_frame,0); set_pev(i_Ent,pev_body,3); set_pev(i_Ent,pev_sequence,TRIPMINE_WORLD); set_pev(i_Ent,pev_framerate,0); set_pev(i_Ent,pev_takedamage,DAMAGE_YES); set_pev(i_Ent,pev_dmg,100.0); set_user_health(i_Ent,get_pcvar_num(g_LHEALTH)); new Float:vOrigin[3]; new Float:vNewOrigin[3],Float:vNormal[3],Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vEntAngles[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); } xs_vec_mul_scalar( vNormal, 8.0, vNormal ); xs_vec_add( vTraceEnd, vNormal, vNewOrigin ); engfunc(EngFunc_SetSize, i_Ent, Float:{ -4.0, -4.0, -4.0 }, Float:{ 4.0, 4.0, 4.0 } ); engfunc(EngFunc_SetOrigin, i_Ent, vNewOrigin ); vector_to_angle(vNormal,vEntAngles ); set_pev(i_Ent,pev_angles,vEntAngles ); new Float:vBeamEnd[3], Float:vTracedBeamEnd[3]; xs_vec_mul_scalar(vNormal, 8192.0, vNormal ); xs_vec_add( vNewOrigin, vNormal, vBeamEnd ); engfunc( EngFunc_TraceLine, vNewOrigin, vBeamEnd, IGNORE_MONSTERS, -1, 0 ); get_tr2( 0, TR_vecPlaneNormal, vNormal ); get_tr2( 0, TR_vecEndPos, vTracedBeamEnd ); set_pev(i_Ent, LASERMINE_OWNER, id ); set_pev(i_Ent,LASERMINE_BEAMENDPOINT,vTracedBeamEnd); set_pev(i_Ent,LASERMINE_TEAM,int:cs_get_user_team(id)); new Float:fCurrTime = get_gametime(); set_pev(i_Ent,LASERMINE_POWERUP, fCurrTime + 2.5 ); set_pev(i_Ent,LASERMINE_STEP,POWERUP_THINK); set_pev(i_Ent,pev_nextthink, fCurrTime + 0.2 ); PlaySound(i_Ent,POWERUP_SOUND ); g_deployed[id]++; g_havemine[id]--; DeleteTask(id); ShowAmmo(id); return 1; } stock TeamDeployedCount(id) { static i; static CsTeams:t;t = cs_get_user_team(id); static cnt;cnt=0; for(i = 1;i <= g_MaxPL;i++) { if(is_user_connected(i)) if(t == cs_get_user_team(i)) cnt += g_deployed; } return cnt; } bool:CheckCanTeam(id) { new arg[5],CsTeam:num; get_pcvar_string(g_LCBT,arg,3); if(equali(arg,"T")) { num = CsTeam:CS_TEAM_T; } else if(equali(arg,"CT")) { num = CsTeam:CS_TEAM_CT; } else if(equali(arg,"ALL")) { num = CsTeam:CS_TEAM_UNASSIGNED; } else { num = CsTeam:CS_TEAM_UNASSIGNED; } if(num != CsTeam:CS_TEAM_UNASSIGNED && num != CsTeam:cs_get_user_team(id)) return false; return true; } bool:CanCheck(id,mode) { if( !get_pcvar_num( g_LENABLE ) ) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOTACTIVE); return false; } if( get_pcvar_num(g_LACCESS) != 0) if(!(get_user_flags(id) & ADMIN_IMMUNITY)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_NOACCESS); return false; } if(!pev_user_alive(id)) return false; if (!CheckCanTeam(id)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CBT); return false; } if( mode == 0) { if(g_havemine[id] <= 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_DONTHAVEMINE); return false; } } if (mode == 1) { if (get_pcvar_num(g_LBUYMODE) == 0) { client_print(id, print_chat, "%s %s",CHATTAG,STR_CANTBUY); return false; } if (g_havemine[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_HAVEMAX); return false; } if (cs_get_user_money(id) < get_pcvar_num(g_LCOST)) { client_print(id, print_chat, "%s %s%d %s",CHATTAG, STR_NOMONEY,get_pcvar_num(g_LCOST),STR_NEEDED); return false; } } if(!CheckTime(id)) { client_print(id,print_chat, "%s %s %d %s",CHATTAG,STR_DELAY,get_pcvar_num(g_LDELAY)-g_nowtime,STR_SECONDS); return false; } return true; } bool:ReturnCheck( id ) { if(!CanCheck(id,-1)) return false; if(g_havemine[id] + 1 > get_pcvar_num(g_LAMMO)) return false; new tgt,body,Float:vo[3],Float:to[3]; get_user_aiming(id,tgt,body); if(!pev_valid(tgt)) return false; pev(id,pev_origin,vo); pev(tgt,pev_origin,to); if(get_distance_f(vo,to) > 70.0) return false; new EntityName[32]; pev(tgt, pev_classname, EntityName, 31); if(!equal(EntityName, ENT_CLASS_NAME)) return false; if(pev(tgt,LASERMINE_OWNER) != id) return false; return true; } bool:CreateCheck( id ) { if (!CanCheck(id,0)) return false; if(!zp_has_round_started() && get_pcvar_num(g_NOROUND)) { client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_NOROUND") return false; } if(zp_is_nemesis_round() && get_pcvar_num(g_NEMROUND)) { client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_NEMROUND") return false; } if(zp_is_survivor_round() && get_pcvar_num(g_SURVROUND)) { client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_SURVROUND") return false; } if(zp_is_assassin_round() && get_pcvar_num(g_ASSROUND)) { client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_ASSROUND") return false; } if(zp_is_sniper_round() && get_pcvar_num(g_SNIPERROUND)) { client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_SNIPERROUND") return false; } if(zp_is_plague_round() && get_pcvar_num(g_PLAGUEROUND)) { client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_PLAGUEROUND") return false; } if(zp_is_lnj_round() && get_pcvar_num(g_ARMAROUND)) { client_print(id, print_chat, "%L %L", id, "CHATTAG",id, "STR_ARMAROUND") return false; } if (g_deployed[id] >= get_pcvar_num(g_LAMMO)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MAXDEPLOY); return false; } //client_print(id,print_chat,"[Lasermine] your team deployed %d",TeamDeployedCount(id)) if(TeamDeployedCount(id) >= get_pcvar_num(g_LTMAX)) { client_print(id, print_chat, "%s %s",CHATTAG,STR_MANYPPL); return false; } new Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vOrigin[3]; pev( id, pev_origin, vOrigin ); velocity_by_aim( id, 128, vTraceDirection ); xs_vec_add( vTraceDirection, vOrigin, vTraceEnd ); engfunc( EngFunc_TraceLine, vOrigin, vTraceEnd, DONT_IGNORE_MONSTERS, id, 0 ); new Float:fFraction,Float:vTraceNormal[3]; get_tr2( 0, TR_flFraction, fFraction ); if ( fFraction < 1.0 ) { get_tr2( 0, TR_vecEndPos, vTraceEnd ); get_tr2( 0, TR_vecPlaneNormal, vTraceNormal ); return true; } client_print(id, print_chat, "%s %s",CHATTAG,STR_PLANTWALL) DeleteTask(id); return false; } public ltm_Think( i_Ent ) { if ( !pev_valid( i_Ent ) ) return FMRES_IGNORED; new EntityName[32]; pev( i_Ent, pev_classname, EntityName, 31); if(!get_pcvar_num(g_LENABLE)) return FMRES_IGNORED; if ( !equal( EntityName, ENT_CLASS_NAME ) ) return FMRES_IGNORED; static Float:fCurrTime; fCurrTime = get_gametime(); switch( pev( i_Ent, LASERMINE_STEP ) ) { case POWERUP_THINK : { new Float:fPowerupTime; pev( i_Ent, LASERMINE_POWERUP, fPowerupTime ); if( fCurrTime > fPowerupTime ) { set_pev( i_Ent, pev_solid, SOLID_BBOX ); set_pev( i_Ent, LASERMINE_STEP, BEAMBREAK_THINK ); PlaySound( i_Ent, ACTIVATE_SOUND ); } if(get_pcvar_num(g_LGLOW)!=0) { if(get_pcvar_num(g_LCLMODE)==0) { switch (pev(i_Ent,LASERMINE_TEAM)) { case CS_TEAM_T: set_rendering(i_Ent,kRenderFxGlowShell,255,0,0,kRenderNormal,5); case CS_TEAM_CT:set_rendering(i_Ent,kRenderFxGlowShell,0,0,255,kRenderNormal,5); } }else { set_rendering(i_Ent,kRenderFxGlowShell,0,255,0,kRenderNormal,5); } } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.1 ); } case BEAMBREAK_THINK : { static Float:vEnd[3],Float:vOrigin[3]; pev( i_Ent, pev_origin, vOrigin ); pev( i_Ent, LASERMINE_BEAMENDPOINT, vEnd ); static iHit, Float:fFraction; engfunc( EngFunc_TraceLine, vOrigin, vEnd, DONT_IGNORE_MONSTERS, i_Ent, 0 ); get_tr2( 0, TR_flFraction, fFraction ); iHit = get_tr2( 0, TR_pHit ); if ( fFraction < 1.0 ) { if(pev_valid(iHit)) { pev( iHit, pev_classname, EntityName, 31 ); if( !equal( EntityName, ENT_CLASS_NAME ) ) { set_pev( i_Ent, pev_enemy, iHit ); if(get_pcvar_num(g_LMODE) == MODE_LASERMINE) CreateLaserDamage(i_Ent,iHit); else if(get_pcvar_num(g_LFF) || CsTeams:pev(i_Ent,LASERMINE_TEAM) != cs_get_user_team(iHit)) set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } } } if(get_pcvar_num(g_LDMGMODE)!=0) if(pev(i_Ent,LASERMINE_HITING) != iHit) set_pev(i_Ent,LASERMINE_HITING,iHit); if ( pev_valid( i_Ent )) { static Float:fHealth; pev( i_Ent, pev_health, fHealth ); if( fHealth <= 0.0 || (pev(i_Ent,pev_flags) & FL_KILLME)) { set_pev( i_Ent, LASERMINE_STEP, EXPLOSE_THINK ); set_pev( i_Ent, pev_nextthink, fCurrTime + random_float( 0.1, 0.3 ) ); } static Float:fBeamthink; pev( i_Ent, LASERMINE_BEAMTHINK, fBeamthink ); if( fBeamthink < fCurrTime && get_pcvar_num(g_LVISIBLE)) { DrawLaser(i_Ent, vOrigin, vEnd ); set_pev( i_Ent, LASERMINE_BEAMTHINK, fCurrTime + 0.1 ); } set_pev( i_Ent, pev_nextthink, fCurrTime + 0.01 ); } } case EXPLOSE_THINK : { set_pev( i_Ent, pev_nextthink, 0.0 ); PlaySound( i_Ent, STOP_SOUND ); g_deployed[pev(i_Ent,LASERMINE_OWNER)]--; CreateExplosion( i_Ent ); CreateDamage(i_Ent,get_pcvar_float(g_LRDMG),get_pcvar_float(g_LRADIUS)) RemoveEntity ( i_Ent ); } } return FMRES_IGNORED; } PlaySound( i_Ent, i_SoundType ) { switch ( i_SoundType ) { case POWERUP_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM ); emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, 0, PITCH_NORM ); } case ACTIVATE_SOUND : { emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, 1, 75 ); } case STOP_SOUND : { emit_sound( i_Ent, CHAN_BODY , ENT_SOUND2, 0.2, ATTN_NORM, SND_STOP, PITCH_NORM ); emit_sound( i_Ent, CHAN_VOICE, ENT_SOUND3, 0.5, ATTN_NORM, SND_STOP, 75 ); } } } DrawLaser(i_Ent, const Float:v_Origin[3], const Float:v_EndOrigin[3] ) { new tcolor[3]; new teamid = pev(i_Ent, LASERMINE_TEAM); if(get_pcvar_num(g_LCLMODE) == 0) { switch(teamid){ case 1:{ tcolor[0] = 255; tcolor[1] = 0; tcolor[2] = 0; } case 2:{ tcolor[0] = 0; tcolor[1] = 0; tcolor[2] = 255; } } }else { tcolor[0] = 0; tcolor[1] = 255; tcolor[2] = 0; } message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_BEAMPOINTS); engfunc(EngFunc_WriteCoord,v_Origin[0]); engfunc(EngFunc_WriteCoord,v_Origin[1]); engfunc(EngFunc_WriteCoord,v_Origin[2]); engfunc(EngFunc_WriteCoord,v_EndOrigin[0]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[1]); //Random engfunc(EngFunc_WriteCoord,v_EndOrigin[2]); //Random write_short(beam); write_byte(0); write_byte(0); write_byte(1); //Life write_byte(5); //Width write_byte(0); //wave write_byte(tcolor[0]); // r write_byte(tcolor[1]); // g write_byte(tcolor[2]); // b write_byte(get_pcvar_num(g_LCBRIGHT)); write_byte(255); message_end(); } /* CreateDamage(iCurrent,DmgMAX,Float:Radius) { new AtkID = pev(iCurrent,LASERMINE_OWNER)// entity_get_int(iCurrent,LASERMINE_OWNER) new TeamID= pev(iCurrent,LASERMINE_TEAM) //entity_get_int(iCurrent,LASERMINE_INT_TEAM) new Player = -1; new Float:distance,dmg; new Float:tOrigin[3]; new Float:vOrigin[3]; new iHitHP,iHitTeam; pev(iCurrent,pev_origin,vOrigin); while((Player = engfunc(EngFunc_FindEntityInSphere, Player, vOrigin, Radius)) != 0) { if(is_user_alive(Player)) { pev(Player,pev_origin,tOrigin) distance = get_distance_f(vOrigin, tOrigin) dmg = floatround(DmgMAX - ((DmgMAX / Radius) * distance)) iHitHP = pev_user_health(Player) - dmg iHitTeam = int:bio_get_user_team(Player) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,Player,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(Player, iHitHP) message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, {0,0,0}, Player) write_byte(dmg) write_byte(dmg) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } } } Player = engfunc(EngFunc_FindEntityInSphere,Player,vOrigin,Radius) } return PLUGIN_CONTINUE } */ CreateDamage(iCurrent,Float:DmgMAX,Float:Radius) { new Float:vecSrc[3]; pev(iCurrent, pev_origin, vecSrc); new AtkID =pev(iCurrent,LASERMINE_OWNER); new TeamID=pev(iCurrent,LASERMINE_TEAM); new ent = -1; new Float:tmpdmg = DmgMAX; new Float:kickback = 0.0; new Float:Tabsmin[3], Float:Tabsmax[3]; new Float:vecSpot[3]; new Float:Aabsmin[3], Float:Aabsmax[3]; new Float:vecSee[3]; new trRes; new Float:flFraction; new Float:vecEndPos[3]; new Float:distance; new Float:origin[3], Float:vecPush[3]; new Float:invlen; new Float:velocity[3]; new iHitHP,iHitTeam; new Float:falloff; if (Radius > 0.0) { falloff = DmgMAX / Radius; } else { falloff = 1.0; } while((ent = engfunc(EngFunc_FindEntityInSphere, ent, vecSrc, Radius)) != 0) { if(!pev_valid(ent)) continue; if(!(pev(ent, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { continue; } if(!pev_user_alive(ent)) continue; kickback = 1.0; tmpdmg = DmgMAX; pev(ent, pev_absmin, Tabsmin); pev(ent, pev_absmax, Tabsmax); xs_vec_add(Tabsmin,Tabsmax,Tabsmin); xs_vec_mul_scalar(Tabsmin,0.5,vecSpot); pev(iCurrent, pev_absmin, Aabsmin); pev(iCurrent, pev_absmax, Aabsmax); xs_vec_add(Aabsmin,Aabsmax,Aabsmin); xs_vec_mul_scalar(Aabsmin,0.5,vecSee); engfunc(EngFunc_TraceLine, vecSee, vecSpot, 0, iCurrent, trRes); get_tr2(trRes, TR_flFraction, flFraction); if (flFraction >= 0.9 || get_tr2(trRes, TR_pHit) == ent) { get_tr2(trRes, TR_vecEndPos, vecEndPos); distance = get_distance_f(vecSrc, vecEndPos) * falloff; tmpdmg -= distance; if(tmpdmg < 0.0) tmpdmg = 0.0; if(kickback != 0.0) { xs_vec_sub(vecSpot,vecSee,origin); invlen = 1.0/get_distance_f(vecSpot, vecSee); xs_vec_mul_scalar(origin,invlen,vecPush); pev(ent, pev_velocity, velocity) xs_vec_mul_scalar(vecPush,tmpdmg,vecPush); xs_vec_mul_scalar(vecPush,kickback,vecPush); xs_vec_add(velocity,vecPush,velocity); if(tmpdmg < 60.0) { xs_vec_mul_scalar(velocity,12.0,velocity); } else { xs_vec_mul_scalar(velocity,4.0,velocity); } if(velocity[0] != 0.0 || velocity[1] != 0.0 || velocity[2] != 0.0) { // There's some movement todo :) set_pev(ent, pev_velocity, velocity) } } iHitHP = pev_user_health(ent) - floatround(tmpdmg) iHitTeam = int:cs_get_user_team(ent) if(iHitHP <= 0) { if(iHitTeam != TeamID) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) + get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,1,iHitHP) }else { if(get_pcvar_num(g_LFF)) { cs_set_user_money(AtkID,cs_get_user_money(AtkID) - get_pcvar_num(g_LFMONEY)) set_score(AtkID,ent,-1,iHitHP) } } }else { if(iHitTeam != TeamID || get_pcvar_num(g_LFF)) { set_user_health(ent, iHitHP) engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},ent); write_byte(floatround(tmpdmg)) write_byte(floatround(tmpdmg)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vecSrc[0]) engfunc(EngFunc_WriteCoord,vecSrc[1]) engfunc(EngFunc_WriteCoord,vecSrc[2]) message_end() } } } } return } bool:pev_user_alive(ent) { new deadflag = pev(ent,pev_deadflag); if(deadflag != DEAD_NO) return false; return true; } CreateExplosion(iCurrent) { new Float:vOrigin[3]; pev(iCurrent,pev_origin,vOrigin); message_begin(MSG_BROADCAST, SVC_TEMPENTITY); write_byte(99); //99 = KillBeam write_short(iCurrent); message_end(); engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, vOrigin, 0); write_byte(TE_EXPLOSION); engfunc(EngFunc_WriteCoord,vOrigin[0]); engfunc(EngFunc_WriteCoord,vOrigin[1]); engfunc(EngFunc_WriteCoord,vOrigin[2]); write_short(boom); write_byte(30); write_byte(15); write_byte(0); message_end(); } CreateLaserDamage(iCurrent,isHit) { if(isHit < 0 ) return PLUGIN_CONTINUE switch(get_pcvar_num(g_LDMGMODE)) { case 1: { if(pev(iCurrent,LASERMINE_HITING) == isHit) return PLUGIN_CONTINUE } case 2: { if(pev(iCurrent,LASERMINE_HITING) == isHit) { static Float:cnt static now,htime;now = floatround(get_gametime()) pev(iCurrent,LASERMINE_COUNT,cnt) htime = floatround(cnt) if(now - htime < get_pcvar_num(g_LDSEC)) { return PLUGIN_CONTINUE; }else{ set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } }else { set_pev(iCurrent,LASERMINE_COUNT,get_gametime()) } } } new Float:vOrigin[3],Float:vEnd[3] pev(iCurrent,pev_origin,vOrigin) pev(iCurrent,pev_vuser1,vEnd) new teamid = pev(iCurrent, LASERMINE_TEAM) new szClassName[32] new Alive,God new iHitTeam,iHitHP,id new hitscore szClassName[0] = '^0' pev(isHit,pev_classname,szClassName,32) if((pev(isHit, pev_flags) & (FL_CLIENT | FL_FAKECLIENT | FL_MONSTER))) { Alive = pev_user_alive(isHit) God = get_user_godmode(isHit) if(!Alive || God) return PLUGIN_CONTINUE iHitTeam = int:cs_get_user_team(isHit) iHitHP = pev_user_health(isHit) - get_pcvar_num(g_LDMG) id = pev(iCurrent,LASERMINE_OWNER)//, szNetName[32] if(iHitHP <= 0) { if(iHitTeam != teamid) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = 1 cs_set_user_money(id,cs_get_user_money(id) + get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) }else { if(get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) hitscore = -1 cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LFMONEY)) set_score(id,isHit,hitscore,iHitHP) } } }else if(iHitTeam != teamid || get_pcvar_num(g_LFF)) { emit_sound(isHit, CHAN_WEAPON, ENT_SOUND4, 1.0, ATTN_NORM, 0, PITCH_NORM ) set_user_health(isHit,iHitHP) set_pev(iCurrent,LASERMINE_HITING,isHit); engfunc(EngFunc_MessageBegin,MSG_ONE_UNRELIABLE,g_msgDamage,{0.0,0.0,0.0},isHit); write_byte(get_pcvar_num(g_LDMG)) write_byte(get_pcvar_num(g_LDMG)) write_long(DMG_BULLET) engfunc(EngFunc_WriteCoord,vOrigin[0]) engfunc(EngFunc_WriteCoord,vOrigin[1]) engfunc(EngFunc_WriteCoord,vOrigin[2]) message_end() } }else if(equal(szClassName, ENT_CLASS_NAME3)) { new hl; hl = pev_user_health(isHit); set_user_health(isHit,hl-get_pcvar_num(g_LDMG)); } return PLUGIN_CONTINUE } stock pev_user_health(id) { new Float:health pev(id,pev_health,health) return floatround(health) } stock set_user_health(id,health) { health > 0 ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id); } stock get_user_godmode(index) { new Float:val pev(index, pev_takedamage, val) return (val == DAMAGE_NO) } stock set_user_frags(index, frags) { set_pev(index, pev_frags, float(frags)) return 1 } stock pev_user_frags(index) { new Float:frags; pev(index,pev_frags,frags); return floatround(frags); } set_score(id,target,hitscore,HP){ new idfrags = pev_user_frags(id) + hitscore set_user_frags(id,idfrags) new tarfrags = pev_user_frags(target) + 1 set_user_frags(target,tarfrags) new idteam = int:cs_get_user_team(id) new iddeaths = cs_get_user_deaths(id) message_begin(MSG_ALL, g_msgDeathMsg, {0, 0, 0} ,0) write_byte(id) write_byte(target) write_byte(0) write_string(ENT_CLASS_NAME) message_end() message_begin(MSG_ALL, g_msgScoreInfo) write_byte(id) write_short(idfrags) write_short(iddeaths) write_short(0) write_short(idteam) message_end() set_msg_block(g_msgDeathMsg, BLOCK_ONCE) set_user_health(target, HP) } public BuyLasermine(id) { if( !CanCheck(id,1) ) return PLUGIN_CONTINUE cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LCOST)) g_havemine[id]++; client_print(id, print_chat, "%s %s",CHATTAG,STR_BOUGHT) emit_sound(id, CHAN_ITEM, ENT_SOUND5, VOL_NORM, ATTN_NORM, 0, PITCH_NORM) ShowAmmo(id) return PLUGIN_HANDLED } ShowAmmo(id) { new ammo[51] formatex(ammo, 50, "%s %i/%i",STR_STATE, g_havemine[id],get_pcvar_num(g_LAMMO)) message_begin(MSG_ONE, g_msgStatusText, {0,0,0}, id) write_byte(0) write_string(ammo) message_end() } public showInfo(id) { client_print(id, print_chat, STR_REF) } public say_lasermine(id){ new said[32] read_argv(1,said,31); if( !get_pcvar_num( g_LENABLE ) ){ return PLUGIN_CONTINUE } if (equali(said,"/buy lasermine")||equali(said,"/lm")){ BuyLasermine(id) }else if (equali(said, "lasermine") || equali(said, "/lasermine")){ const SIZE = 1024 new msg[SIZE+1],len = 0; len += formatex(msg[len], SIZE - len, "<html><body>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p>You can be setting the mine on the wall.</p><br/>") len += formatex(msg[len], SIZE - len, "<p>That laser will give what touched it damage.</p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>LaserMine Commands</b></p><br/><br/>") len += formatex(msg[len], SIZE - len, "<p><b>Say /buy lasermine</b> or <b>Say /lm</b> //buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>buy_lasermine</b> //bind ^"F2^" buy_lasermine : using F2 buying lasermine<br/>") len += formatex(msg[len], SIZE - len, "<b>+setlaser</b> //bind mouse3 +setlaser : using mouse3 set lasermine on wall<br/>") len += formatex(msg[len], SIZE - len, "</body></html>") show_motd(id, msg, "Lasermine Entity help") return PLUGIN_CONTINUE } else if (containi(said, "laser") != -1) { showInfo(id) return PLUGIN_CONTINUE } return PLUGIN_CONTINUE } public standing(id) { if (!g_settinglaser[id]) return PLUGIN_CONTINUE set_pev(id, pev_maxspeed, 1.0) return PLUGIN_CONTINUE } public ltm_PostThink(id) { if (!g_settinglaser[id] && plsetting[id]){ resetspeed(id) } else if (g_settinglaser[id] && !plsetting[id]) { pev(id, pev_maxspeed,plspeed[id]) set_pev(id, pev_maxspeed, 1.0) } plsetting[id] = g_settinglaser[id] return FMRES_IGNORED } public ltm_PreThink(id) { if (!pev_user_alive(id) || g_settinglaser[id] == true || is_user_bot(id) || get_pcvar_num(g_LCMDMODE) == 1) return FMRES_IGNORED; if(pev(id, pev_button ) & IN_USE && !(pev(id, pev_oldbuttons ) & IN_USE )) CreateLaserMine_Progress(id) return FMRES_IGNORED; } resetspeed(id) { set_pev(id, pev_maxspeed, plspeed[id]) } public client_putinserver(id){ g_deployed[id] = 0; g_havemine[id] = 0; DeleteTask(id); return PLUGIN_CONTINUE } public client_disconnect(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE DeleteTask(id); RemoveAllTripmines(id); return PLUGIN_CONTINUE } public newround(id){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE pev(id, pev_maxspeed,plspeed[id]) DeleteTask(id); RemoveAllTripmines(id); delaycount(id); SetStartAmmo(id); return PLUGIN_CONTINUE } public DeathEvent(){ if(!get_pcvar_num( g_LENABLE )) return PLUGIN_CONTINUE new id = read_data(2) if(is_user_connected(id)) DeleteTask(id); return PLUGIN_CONTINUE } public RemoveAllTripmines( i_Owner ) { new iEnt = g_MaxPL + 1; new clsname[32]; while( ( iEnt = engfunc( EngFunc_FindEntityByString, iEnt, "classname", ENT_CLASS_NAME ) ) ) { if ( i_Owner ) { if( pev( iEnt, LASERMINE_OWNER ) != i_Owner ) continue; clsname[0] = '^0' pev( iEnt, pev_classname, clsname, sizeof(clsname)-1 ); if ( equali( clsname, ENT_CLASS_NAME ) ) { PlaySound( iEnt, STOP_SOUND ); RemoveEntity( iEnt ); } } else set_pev( iEnt, pev_flags, FL_KILLME ); } g_deployed[i_Owner]=0; } SetStartAmmo(id) { new stammo = get_pcvar_num(g_LSTAMMO); if(stammo <= 0) return PLUGIN_CONTINUE; g_havemine[id] = (g_havemine[id] <= stammo) ? stammo : g_havemine[id]; return PLUGIN_CONTINUE; } public CutDeploy_onDamage(id) { if(get_user_health(id) < 1) DeleteTask(id); } DeleteTask(id) { if (task_exists((TASK_PLANT + id))) { remove_task((TASK_PLANT + id)) } if (task_exists((TASK_RELEASE + id))) { remove_task((TASK_RELEASE + id)) } g_settinglaser[id] = false return PLUGIN_CONTINUE; } stock set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16) { static Float:RenderColor[3]; RenderColor[0] = float(r); RenderColor[1] = float(g); RenderColor[2] = float(b); set_pev(entity, pev_renderfx, fx); set_pev(entity, pev_rendercolor, RenderColor); set_pev(entity, pev_rendermode, render); set_pev(entity, pev_renderamt, float(amount)); return 1 } get_offset_value(id, type) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; return get_pdata_int(id, key); } return -1; } set_offset_value(id, type, value) { new key = -1; switch(type) { case OFFSET_TEAM: key = OFFSET_TEAM; case OFFSET_MONEY: { message_begin(MSG_ONE_UNRELIABLE, g_msgMoney, {0,0,0}, id); write_long(value); write_byte(1); // Flash (difference between new and old money) message_end(); } case OFFSET_DEATH: key = OFFSET_DEATH; } if(key != -1) { if(is_amd64_server()) key += 25; set_pdata_int(id, key, value); } return PLUGIN_CONTINUE; }
Return to “Modificari pluginuri”
Jump to
- eXtream - Forum
- ↳ Steam
- ↳ Forum
- ↳ WebDesign
- ↳ Incepatori
- ↳ Cos de reciclare
- ↳ Discutii generale
- ↳ Anunturi
- ↳ Security zone
- ↳ Filme si seriale
- ↳ Reclamatii
- ↳ Entertainment
- ↳ Distractie
- ↳ Clubul eXtreamCS - Intra si tu ! [noi oportunitati]
- eXtream - Echipa
- ↳ Productia eXtream
- ↳ Harti eXtream
- ↳ CS.eXtreamCS.com - Server oficial eXtreamCS
- ↳ Zona administrativă
- ↳ Cereri acces
- ↳ Cereri unban
- ↳ Reclamații
- ↳ Admin zone
- ↳ CS2.eXtreamCS.com - Server official eXtreamCS
- ↳ XMAS.eXtreamCS.com
- ↳ Cereri admin
- ↳ Cereri unban
- ↳ Reclamatii / Sugestii
- ↳ eXtreamCS #PubMasters
- eXtream - Counter-Strike 2
- ↳ Counter-Strike 2
- eXtream - Counter-Strike 1.6
- ↳ Diverse
- ↳ Filme gaming
- ↳ Meciuri
- ↳ Tutoriale
- ↳ Tutoriale
- ↳ Cereri
- ↳ Discutii generale
- ↳ Probleme la servere dedicate de Counter-Strike
- ↳ Cereri admin / slot
- ↳ Probleme in jocul Counter-Strike
- ↳ Pluginuri
- ↳ Pluginuri eXtream
- ↳ Cereri
- ↳ AdminMod
- ↳ AmxModX
- ↳ Resurse
- ↳ Moduri
- ↳ Addon-uri
- ↳ Kit-uri
- ↳ Harti
- ↳ Diverse
- ↳ Cereri
- ↳ Servere
- ↳ Programarea CS-ului
- ↳ Scripting
- ↳ Modificari pluginuri
- ↳ CStrike
- ↳ Cereri
- eXtream - Counter Strike Global Offensive
- ↳ Diverse
- ↳ Meciuri
- ↳ Tutoriale
- ↳ Probleme la servere dedicate de Counter-Strike: Global Offensive
- ↳ Probleme in jocul Counter-Strike: Global Offensive
- ↳ Pluginuri
- ↳ Cereri
- ↳ Resurse
- ↳ Addons-uri
- ↳ Hărți
- ↳ Diverse
- ↳ Servere
- eXtream - Counter-Strike Source
- ↳ Tutoriale
- ↳ Pluginuri
- ↳ Servere
- ↳ Resurse
- ↳ Harti
- ↳ Moduri
- ↳ Diverse
- ↳ Classic » CS
- ↳ Anunțuri administrative
- ↳ Cereri admin/slot
- ↳ Cereri unban
- ↳ Reclamații
- ↳ Banlist
- ↳ Admins Only
- ↳ Discord