Raised This Month: $51 Target: $400
 12% 

Can you help me?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FLOY
Senior Member
Join Date: Dec 2013
Location: I love to www.steam.lv
Old 05-31-2016 , 09:07   Can you help me?
Reply With Quote #1

Hello, could you remake lasermine plugin
VIP can put 3 laser
Players Conventional only one laser.
Can you add
============================================= ======Can help me ? ======
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#include <cstrike>
//#include <fakemeta_util>
#define PLUGIN "Laser/TripMine Entity"
#define VERSION "2.0"
#define AUTHOR "SandStriker"

#define RemoveEntity(%1)    engfunc(EngFunc_RemoveEntity,%1)
#define ACCESSLEVEL        ADMIN_LEVEL_H
#define TASK_PLANT        15100
#define TASK_RESET        15500

#define LASERMINE_INT_TEAM    pev_iuser1 //EV_INT_iuser1
#define LASERMINE_STEP        pev_iuser2
#define LASERMINE_OWNER        pev_iuser3 //EV_INT_iuser3
#define LASERMINE_POWERUP    pev_fuser1
#define LASERMINE_BEAMTHINK    pev_fuser2

#define LASERMINE_BEAMENDPOINT    pev_vuser1
//#define MAX_MINES        10
#define MODE_LASERMINE        0

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_tripmine.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[]    = "weapons/mine_activate.wav",
    
ENT_SPRITE1[]         = "sprites/laserbeam.spr",
    
ENT_SPRITE2[]         = "sprites/zerogxplode.spr";

new const
    
ENT_CLASS_NAME[]    = "lasermine",
    
//ENT_CLASS_NAME2[]    = "info_target",
    
ENT_CLASS_NAME3[]    = "func_breakable";

new const
    
CHATTAG[]         = "[LaserMines]",
    
//STR_MINEDETNATED[]     = "Your mine has detonated.",
    //STR_MINEDETNATED2[]    = "detonated your mine.",
    
STR_NOTACTIVE[]     = "Lasermines are not currently active.",
    
STR_DONTHAVEMINE[]    = "You don't have lasermine.",
    
STR_CANTDEPLOY[]    = "Your team can't deploying lasermine!",
    
STR_MAXDEPLOY[]        = "Maximum mines have been deployed.",
    
STR_MANYPPL[]        = "Too many ppl on your team...",
    
STR_PLANTWALL[]        = "You must plant the lasermine on a wall!",
    
STR_REF[]        = "Refer to a lasermine rule with this server. say 'lasermine'",
    
STR_CBT[]        = "Your team can't buying lasermine!",
    
STR_HAVEMAX[]        = "You have a maximum lasermine.",
    
STR_NOMONEY[]        = "You don't have enough money to buy a lasermine! ($",
    
STR_NEEDED[]        = "needed)",
    
STR_DELAY[]        = "You can buying and deploying lasermine in after",
    
STR_SECONDS[]        = "seconds.",
    
STR_BOUGHT[]        = "You have successfully bought a lasermine.",
    
STR_STATE[]        = "LaserMines Ammo:";

new 
g_EntMine;
new 
beamboom
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_LDELAY,/*g_LTHINK,*/g_LVISIBLE;

new 
g_dcount,g_nowtime,g_MaxPL
new bool:g_settinglaser[33]
new 
g_msgDeathMsg,g_msgScoreInfo,g_msgDamage,g_msgStatusText;
new 
Float:plspeed[33]
new 
plsetting[33]
new 
g_havemine[33];
new 
g_deployed[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
register_clcmd("+setlaser","CreateLaserMine_Progress");
       
register_clcmd("-setlaser","StopCreateLaserMine");
    
register_clcmd("say","say_lasermine");
    
register_clcmd("buy_lasermine","BuyLasermine");
    
g_LENABLE register_cvar("amx_ltm","1")

    
g_LMODE register_cvar("amx_ltm_mode","0")
    
g_LAMMO register_cvar("amx_ltm_ammo","2")
    
g_LDMG register_cvar("amx_ltm_dmg","10000")
    
g_LCOST register_cvar("amx_ltm_cost","2500")
    
g_LFMONEY register_cvar("amx_ltm_fragmoney","300")
    
g_LHEALTH register_cvar("amx_ltm_health","500")
    
g_LTMAX register_cvar("amx_ltm_teammax","10")
    
g_LRADIUS register_cvar("amx_ltm_radius","200.0")
    
g_LRDMG register_cvar("amx_ltm_rdmg","1000")
    
g_LFF register_cvar("amx_ltm_ff","0")
    
g_LCBT register_cvar("amx_ltm_cbt","ALL")
    
g_LDELAY register_cvar("amx_ltm_delay","15")
    
//g_LTHINK = register_cvar("amx_ltm_think","0.01")
    
g_LVISIBLE register_cvar("amx_ltm_line","1")
    
    
register_event("DeathMsg""DeathEvent""a")
     
register_event("CurWeapon""standing""be""1=1")
    
register_event("ResetHUD""delaycount""a")
    
register_event("ResetHUD""newround""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")

    
// -- Forward.
    
register_forwardFM_Think"ltm_Think" );
    
register_forwardFM_PlayerPostThink"ltm_PostThink" );
}

public 
plugin_precache() 
{
    
precache_sound(ENT_SOUND1);
    
precache_sound(ENT_SOUND2);
    
precache_sound(ENT_SOUND3);
    
precache_sound(ENT_SOUND4);
    
precache_sound(ENT_SOUND5);
    
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")
    
//require_module("fun")
}

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();
}

public 
delaycount()
{
    
g_dcount floatround(get_gametime())
}

bool:CheckTime()
{
    
g_nowtime floatround(get_gametime()) - g_dcount
    
if(g_nowtime >= get_pcvar_num(g_LDELAY))
        return 
true
    
return false
}

public 
CreateLaserMine_Progress(id){ 


    if (!
CreateCheck(id))
        return 
PLUGIN_HANDLED;
    
g_settinglaser[id] = true

    message_begin
MSG_ONE108, {0,0,0}, id );
    
write_byte(1);
    
write_byte(0);
    
message_end();


    new 
PID[1];
    
PID[0] = id;
    
set_task(1.2"Spawn", (TASK_PLANT id), PID1);

    return 
PLUGIN_HANDLED;
}

public 
StopCreateLaserMine(id)
{
    if (
task_exists((TASK_PLANT id)))
    {
        
remove_task((TASK_PLANT id));
    }
    
g_settinglaser[id] = false

    message_begin
(MSG_ONE108, {0,0,0}, id)
    
write_byte(0);
    
write_byte(0);
    
message_end();

    return 
PLUGIN_HANDLED;
}

public 
Spawnids[] )
{
    new 
id ids[0];
    
// motor
    
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_pev(i_Ent,pev_healthfloat(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];
    
pevidpev_originvOrigin );
    
velocity_by_aimid128vTraceDirection );
    
xs_vec_addvTraceDirectionvOriginvTraceEnd );
    
    
engfuncEngFunc_TraceLinevOriginvTraceEndDONT_IGNORE_MONSTERSid);
    
    new 
Float:fFraction;
    
get_tr20TR_flFractionfFraction );
    

    
// -- We hit something!
    
if ( fFraction 1.0 )
    {
        
// -- Save results to be used later.
        
get_tr20TR_vecEndPosvTraceEnd );
        
get_tr20TR_vecPlaneNormalvNormal );
    }


    
xs_vec_mul_scalarvNormal8.0vNormal );
    
xs_vec_addvTraceEndvNormalvNewOrigin );

    
engfunc(EngFunc_SetSizei_EntFloat:{ -8.0, -8.0, -8.0 }, Float:{ 8.08.08.0 } );
    
engfunc(EngFunc_SetOrigini_EntvNewOrigin );

    
// -- Rotate tripmine.
    
vector_to_angle(vNormal,vEntAngles );
    
set_pev(i_Ent,pev_angles,vEntAngles );

    
// -- Calculate laser end origin.
    
new Float:vBeamEnd[3], Float:vTracedBeamEnd[3];
        
    
xs_vec_mul_scalar(vNormal8192.0vNormal );
    
xs_vec_addvNewOriginvNormalvBeamEnd );

    
engfuncEngFunc_TraceLinevNewOriginvBeamEndIGNORE_MONSTERS, -1);

    
get_tr20TR_vecPlaneNormalvNormal );
    
get_tr20TR_vecEndPosvTracedBeamEnd );

    
// -- Save results to be used later.
    
set_pev(i_EntLASERMINE_OWNERid );
    
set_pev(i_Ent,LASERMINE_BEAMENDPOINT,vTracedBeamEnd);
    
set_pev(i_Ent,LASERMINE_INT_TEAM,int:cs_get_user_team(id));

    new 
Float:fCurrTime get_gametime();

    
set_pev(i_Ent,LASERMINE_POWERUPfCurrTime 2.5 );
   
    
set_pev(i_Ent,LASERMINE_STEP,POWERUP_THINK);
    
set_pev(i_Ent,pev_nextthinkfCurrTime 0.2 );

    
PlaySound(i_Ent,POWERUP_SOUND );
    
g_deployed[id]++;
    
g_havemine[id]--;
    
g_settinglaser[id] = false
    ShowAmmo
(id);
    return 
1;
}

stock TeamDeployedCount(id)
{
    
//new tid[32];
    
    
static i;
    static 
CsTeams:t;cs_get_user_team(id);
    static 
cnt;cnt=0;

    for(
1;<= g_MaxPL;i++)
    {
        if(
is_user_connected(i))
            if(
== cs_get_user_team(i))
                
cnt += g_deployed[i];
    }

    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:CreateCheckid )
{
    if( !
get_pcvar_numg_LENABLE ) )
    {
        
client_print(idprint_chat"%s %s",CHATTAG,STR_NOTACTIVE)
        return 
false
    
}
    if(
g_settinglaser[id] || task_exists((TASK_PLANT id))) return false
    
if(!is_user_alive(id)) return false
    
if(!CheckTime()){
        
client_print(id,print_chat"%s %s %d %s",CHATTAG,STR_DELAY,get_pcvar_num(g_LDELAY)-g_nowtime,STR_SECONDS)
        return 
false
    
}
    if(
g_havemine[id] <= 0){
        
client_print(idprint_chat"%s %s",CHATTAG,STR_DONTHAVEMINE)
        return 
false
    
}
    
    if (!
CheckCanTeam(id))
    {
        
client_print(idprint_chat"%s %s",CHATTAG,STR_CANTDEPLOY)    
        return 
false
    
}
    if (
g_deployed[id] >= get_pcvar_num(g_LAMMO))  //unhandled error
    
{
        
client_print(idprint_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(idprint_chat"%s %s",CHATTAG,STR_MANYPPL)
        return 
false
    
}
    new 
Float:vTraceDirection[3], Float:vTraceEnd[3],Float:vOrigin[3];
    
    
pevidpev_originvOrigin );
    
velocity_by_aimid128vTraceDirection );
    
xs_vec_addvTraceDirectionvOriginvTraceEnd );
    
    
engfuncEngFunc_TraceLinevOriginvTraceEndDONT_IGNORE_MONSTERSid);
    
    new 
Float:fFraction,Float:vTraceNormal[3];
    
get_tr20TR_flFractionfFraction );
    
    
// -- We hit something!
    
if ( fFraction 1.0 )
    {
        
// -- Save results to be used later.
        
get_tr20TR_vecEndPosvTraceEnd );
        
get_tr20TR_vecPlaneNormalvTraceNormal );

        
//get_tr2( 0, TR_pHit );

        
return true;
    }
    
client_print(idprint_chat"%s %s",CHATTAG,STR_PLANTWALL)
    
g_settinglaser[id] = false
    
// -- Did not touched something. (not solid)
    
return false;
}

public 
ltm_Thinki_Ent )
{
    if ( !
pev_validi_Ent ) )
        return 
FMRES_IGNORED;
    new 
EntityName[sizeof(ENT_CLASS_NAME)+1];
    static const 
size sizeof(ENT_CLASS_NAME);
    
pevi_Entpev_classnameEntityNamesize);
    if(!
get_pcvar_num(g_LENABLE)) return FMRES_IGNORED;
    
// -- Entity is not a tripmine, ignoring the next...
    
if ( !equalEntityNameENT_CLASS_NAME ) )
        return 
FMRES_IGNORED;

    static 
Float:fCurrTime;
    
fCurrTime get_gametime();

    switch( 
pevi_EntLASERMINE_STEP ) )
    {
        case 
POWERUP_THINK :
        {
            new 
Float:fPowerupTime;
            
pevi_EntLASERMINE_POWERUPfPowerupTime );

            if( 
fCurrTime fPowerupTime )
            {
                
set_pevi_Entpev_solidSOLID_BBOX );
                
set_pevi_EntLASERMINE_STEPBEAMBREAK_THINK );

                
PlaySoundi_EntACTIVATE_SOUND );
            }

            
set_pevi_Entpev_nextthinkfCurrTime 0.1 );
        }
        case 
BEAMBREAK_THINK :
        {
            static 
Float:vEnd[3],Float:vOrigin[3];
            
pevi_Entpev_originvOrigin );
            
pevi_EntLASERMINE_BEAMENDPOINTvEnd );

            static 
iHitFloat:fFraction;
            
engfuncEngFunc_TraceLinevOriginvEndDONT_IGNORE_MONSTERSi_Ent);

            
get_tr20TR_flFractionfFraction );
            
iHit get_tr20TR_pHit );

            
// -- Something has passed the laser.
            
if ( fFraction 1.0 )
            {
                
// -- Ignoring others tripmines entity.
                
peviHitpev_classnameEntityNamesize );

                if( !
equalEntityNameENT_CLASS_NAME ) )
                {
                    
set_pevi_Entpev_enemyiHit );
                    if(
get_pcvar_num(g_LMODE) == MODE_LASERMINE)
                        
CreateLaserDamage(i_Ent,iHit);
                    else
                        
set_pevi_EntLASERMINE_STEPEXPLOSE_THINK );
                        
                    
set_pevi_Entpev_nextthinkfCurrTime random_float0.10.3 ) );
                }
            }
                
            
// -- Tripmine is still there.
            
if ( pev_validi_Ent ) )
            {
                static 
Float:fHealth;
                
pevi_Entpev_healthfHealth );

                if( 
fHealth )
                {
                    
set_pevi_EntLASERMINE_STEPEXPLOSE_THINK );
                    
set_pevi_Entpev_nextthinkfCurrTime random_float0.10.3 ) );
                }
                    
                static 
Float:fBeamthink;
                
pevi_EntLASERMINE_BEAMTHINKfBeamthink );
                    
                if( 
fBeamthink fCurrTime && get_pcvar_num(g_LVISIBLE) && pev(i_EntLASERMINE_STEP) != EXPLOSE_THINK)
                {
                    
DrawLaser(i_EntvOriginvEnd );
                    
set_pevi_EntLASERMINE_BEAMTHINKfCurrTime 0.1 );
                }

                
set_pevi_Entpev_nextthinkfCurrTime 0.01 );
            }
        }
        case 
EXPLOSE_THINK :
        {
            
// -- Stopping entity to think
            
set_pevi_Entpev_nextthink0.0 );
            
PlaySoundi_EntSTOP_SOUND );
            
g_deployed[pev(i_Ent,LASERMINE_OWNER)]--;
            
CreateExplosioni_Ent );
            
CreateDamage(i_Ent,get_pcvar_num(g_LRDMG),get_pcvar_float(g_LRADIUS))
            
RemoveEntity   i_Ent );
        }
    }

    return 
FMRES_IGNORED;
}

PlaySoundi_Enti_SoundType )
{
    switch ( 
i_SoundType )
    {
        case 
POWERUP_SOUND :
        {
            
emit_soundi_EntCHAN_VOICEENT_SOUND1VOL_NORMATTN_NORM0PITCH_NORM );
            
emit_soundi_EntCHAN_BODY ENT_SOUND20.2ATTN_NORM0PITCH_NORM );
        }
        case 
ACTIVATE_SOUND :
        {
            
emit_soundi_EntCHAN_VOICEENT_SOUND30.5ATTN_NORM175 );
        }
        case 
STOP_SOUND :
        {
            
emit_soundi_EntCHAN_BODY ENT_SOUND20.2ATTN_NORMSND_STOPPITCH_NORM );
            
emit_soundi_EntCHAN_VOICEENT_SOUND30.5ATTN_NORMSND_STOP75 );
        }
    }
}

DrawLaser(i_Ent, const Float:v_Origin[3], const Float:v_EndOrigin[3] )
{
    new 
tcolor[3];
    new 
teamid pev(i_EntLASERMINE_INT_TEAM);
    switch(
teamid){
        case 
1:{
            
tcolor[0] = 255
            tcolor
[1] = 0
            tcolor
[2] = 0
        
}
        case 
2:{
            
tcolor[0] = 0
            tcolor
[1] = 0
            tcolor
[2] = 255
        
}
    }
    
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(11//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(255)
    
write_byte(255)
    
message_end() 
}

CreateDamage(iCurrent,DmgMAX,Float:Radius)
{
    new 
AtkID pev(iCurrent,LASERMINE_OWNER)// entity_get_int(iCurrent,LASERMINE_OWNER)
    
new TeamIDpev(iCurrent,LASERMINE_INT_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);
    
Player engfunc(EngFunc_FindEntityInSphere,Player,vOrigin,Radius);
    while(
Player != 0)
    {
        if(
is_user_alive(Player))
        {
            
pev(Player,pev_origin,tOrigin)
            
distance get_distance_f(vOrigintOrigin)
            
dmg floatround(DmgMAX - ((DmgMAX Radius) * distance))
            
iHitHP pev_user_health(Player) - dmg
            iHitTeam 
int:cs_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_pev(Player,pev_health,iHitHP)
                    
set_user_health(PlayeriHitHP)
                    
message_begin(MSG_ONE_UNRELIABLEg_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
}

CreateExplosion(iCurrent)
{
    
    new 
Float:vOrigin[3]
    
pev(iCurrent,pev_origin,vOrigin)
    
//entity_get_vector(iCurrent, EV_VEC_origin, vOrigin)

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(99//99 = KillBeam
    
write_short(iCurrent)
    
message_end()

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(3)
    
engfunc(EngFunc_WriteCoord,vOrigin[0])
    
engfunc(EngFunc_WriteCoord,vOrigin[1])
    
engfunc(EngFunc_WriteCoord,vOrigin[2])
    
write_short(boom)
    
write_byte(50)
    
write_byte(15)
    
write_byte(0)
    
message_end()
    
/*
    if (iHit == -1)
    {
        client_print(id, print_chat, "%s %s",CHATTAG,STR_MINEDETNATED)
    } else 
    {
        szNetName[0] = '^0'
        engfunc(EngFunc_AllocString,iHit,szNetName)
        //entity_get_string(iHit, EV_SZ_netname, szNetName, 32)
        client_print(id, print_chat, "%s %s %s",CHATTAG,szNetName,STR_MINEDETNATED2)
    }
    */
}

CreateLaserDamage(iCurrent,isHit)
{
    new 
Float:vOrigin[3],Float:vEnd[3]
    
pev(iCurrent,pev_origin,vOrigin)
    
pev(iCurrent,pev_vuser1,vEnd)

    
//new isHit = fm_trace_line(iCurrent, vOrigin, vEnd, vTrace)
    
new teamid pev(iCurrentLASERMINE_INT_TEAM)

    new 
szClassName[32]
    new 
Alive,God
    
new iHitTeam,iHitHP,id
    
new hitscore

    
if(isHit ) return PLUGIN_CONTINUE
    
    szClassName
[0] = '^0'
    
pev(isHit,pev_classname,szClassName,32)
    
    if(
equal(szClassName"player"))
    {
        
Alive is_user_alive(isHit)
        
God get_user_godmode(isHit)
        if(!
Alive || God) return PLUGIN_CONTINUE
             
        iHitTeam 
int:cs_get_user_team(isHit)
        
//iHitHP = entity_get_float(isHit,EV_FL_health) - float(LASER_HIT_DMG)
        
iHitHP pev_user_health(isHit) - get_pcvar_num(g_LDMG)
        
id pev(iCurrent,LASERMINE_OWNER)//, szNetName[32]
        
if( get_pcvar_num(g_LMODE) == MODE_LASERMINE)
        {
            if(
iHitHP <= 0)
            {
                if(
iHitTeam != teamid)
                {
                    
hitscore 1
                    cs_set_user_money
(id,cs_get_user_money(id) + get_pcvar_num(g_LFMONEY))
                    
//set_user_health(iHit, 0)    
                    //entity_set_float(iHit, EV_FL_health,0.0)
                    
emit_sound(isHitCHAN_WEAPONENT_SOUND41.0ATTN_NORM0PITCH_NORM )
                    
set_score(id,isHit,hitscore,iHitHP)
                    
//entity_get_string(iHit, EV_SZ_netname, szNetName, 32)
                    //client_print(id, print_chat, "[LaserMines] %s killed your mine.",szNetName)
                
}else
                {
                    if(
get_pcvar_num(g_LFF))
                    {
                        
hitscore = -1                                    
                        cs_set_user_money
(id,cs_get_user_money(id) - get_pcvar_num(g_LFMONEY))
                        
emit_sound(isHitCHAN_WEAPONENT_SOUND41.0ATTN_NORM0PITCH_NORM )
                        
set_score(id,isHit,hitscore,iHitHP)
                        
//set_user_health(iHit, 0)
                        //entity_set_float(iHit, EV_FL_health, 0.0)
                        //entity_get_string(iHit, EV_SZ_netname, szNetName, 32)
                        //client_print(id, print_chat, "[LaserMines] %s killed your mine.",szNetName)
                    
}
                }
            }else if(
iHitTeam != teamid || get_pcvar_num(g_LFF))
            {
                
//entity_set_float(isHit,EV_FL_health,iHitHP)
                //set_user_health(isHit, iHitHP)
                
set_user_health(isHit,iHitHP)
                
message_begin(MSG_ONE_UNRELIABLEg_msgDamage, {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
        {
            
CreateExplosion(iCurrent)
            
CreateDamage(iCurrent,get_pcvar_num(g_LRDMG),get_pcvar_float(g_LRADIUS))
            
RemoveEntity(iCurrent);
        }
    }else if(
equal(szClassNameENT_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 set_pev(idpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillid);
}

stock get_user_godmode(index)
{
    new 
Float:val
    pev
(indexpev_takedamageval)

    return (
val == DAMAGE_NO)
}

stock set_user_frags(indexfrags)
{
    
set_pev(indexpev_fragsfloat(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// get_user_frags(id) + hitscore    
    
set_user_frags(id,idfrags)
    
//set_user_frags(id, idfrags)
    //entity_set_float(id, EV_FL_frags, float(idfrags))
    
    
new tarfrags pev_user_frags(target) + //get_user_frags(target) + 1
    
set_user_frags(target,tarfrags)
    
//set_user_frags(target,tarfrags)
    //entity_set_float(target, EV_FL_frags, float(tarfrags))
    
    
new idteam int:cs_get_user_team(id)
    new 
iddeaths cs_get_user_deaths(id)


    
message_begin(MSG_ALLg_msgDeathMsg, {000} ,0)
    
write_byte(id)
    
write_byte(target)
    
write_byte(0)
    
write_string(ENT_CLASS_NAME)
    
message_end()

    
message_begin(MSG_ALLg_msgScoreInfo)
    
write_byte(id)
    
write_short(idfrags)
    
write_short(iddeaths)
    
write_short(0)
    
write_short(idteam)
    
message_end()

    
set_msg_block(g_msgDeathMsgBLOCK_ONCE)

    
//entity_set_float(target, EV_FL_health,float(HP))
    
set_user_health(targetHP)
    
//set_pev(target,pev_health,HP)

}

public 
BuyLasermine(id)
{    
    if( !
get_pcvar_numg_LENABLE )  ){
        
client_print(idprint_chat"%s %s",CHATTAG,STR_NOTACTIVE)
        return 
PLUGIN_CONTINUE
    
}
    if (!
CheckCanTeam(id))
    {
        
client_print(idprint_chat"%s %s",CHATTAG,STR_CBT)    
        return 
PLUGIN_HANDLED
    
}
    if (
cs_get_user_money(id) < get_pcvar_num(g_LCOST)) {
        
client_print(idprint_chat"%s %s%d %s",CHATTAGSTR_NOMONEY,get_pcvar_num(g_LCOST),STR_NEEDED)    
        return 
PLUGIN_HANDLED
    
}
    if (
g_havemine[id] >= get_pcvar_num(g_LAMMO)){
        
client_print(idprint_chat"%s %s",CHATTAG,STR_HAVEMAX)    
        return 
PLUGIN_HANDLED
    
}
    if(!
CheckTime())
    {
        
client_print(id,print_chat"%s %s %d %s",CHATTAG,STR_DELAY,get_pcvar_num(g_LDELAY)-g_nowtime,STR_SECONDS)
        return 
PLUGIN_HANDLED
    
}
    
cs_set_user_money(id,cs_get_user_money(id) - get_pcvar_num(g_LCOST))
    
g_havemine[id]++;
    
emit_sound(idCHAN_ITEMENT_SOUND5VOL_NORMATTN_NORM0PITCH_NORM)
    
client_print(idprint_chat"%s %s",CHATTAG,STR_BOUGHT)
    
ShowAmmo(id)
    return 
PLUGIN_HANDLED
}

ShowAmmo(id)

    new 
ammo[51
    
formatex(ammo50"%s %i/%i",STR_STATEg_havemine[id],get_pcvar_num(g_LAMMO))

    
message_begin(MSG_ONEg_msgStatusText, {0,0,0}, id
    
write_byte(0
    
write_string(ammo
    
message_end() 


public 
showInfo(id)
{
    
client_print(idprint_chatSTR_REF)
}

public 
say_lasermine(id){
    new 
said[32]
    
read_argv(1,said,31);
    if( !
get_pcvar_numg_LENABLE )  ){
//        client_print(id, print_chat, "%s Lasermines are not currently active.",CHATTAG)
        
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(idmsg"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
(idpev_maxspeed1.0)
//    ShowAmmo(id)

    
return PLUGIN_CONTINUE
}

public 
ltm_PostThink(id) {
    if (!
g_settinglaser[id] && plsetting[id]){
        
resetspeed(id)
    }
    else if (
g_settinglaser[id] && !plsetting[id]) {
        
pev(idpev_maxspeed,plspeed[id])
        
set_pev(idpev_maxspeed1.0)
    }
    
plsetting[id] = g_settinglaser[id]
    return 
FMRES_IGNORED
}

resetspeed(who) {
    
set_pev(whopev_maxspeedplspeed[who])
}

public 
client_putinserver(id){
    
g_deployed[id] = 0;
    
g_havemine[id] = 0;
    
g_settinglaser[id] = false;
    return 
PLUGIN_CONTINUE
}

public 
client_disconnect(id){
    if(!
get_pcvar_numg_LENABLE ))
        return 
PLUGIN_CONTINUE
    g_settinglaser
[id] = false
    RemoveAllTripmines
(id);
    return 
PLUGIN_CONTINUE
}


public 
newround(id){
    if(!
get_pcvar_numg_LENABLE ))
        return 
PLUGIN_CONTINUE
    pev
(idpev_maxspeed,plspeed[id])
    
g_settinglaser[id] = false
    RemoveAllTripmines
(id);
    return 
PLUGIN_CONTINUE
}

public 
DeathEvent(){
    if(!
get_pcvar_numg_LENABLE ))
        return 
PLUGIN_CONTINUE

    
new id read_data(2)
    if (
task_exists(TASK_PLANT+id))
        
remove_task(TASK_PLANT+id)
    
g_settinglaser[id] = false
    
return PLUGIN_CONTINUE
}

RemoveAllTripminesi_Owner )
{
    new 
iEnt g_MaxPL 1;
    new 
clsname[32];
    while( ( 
iEnt engfuncEngFunc_FindEntityByStringiEnt"classname"ENT_CLASS_NAME ) ) )
    {
        if ( 
i_Owner )
        {
            if( 
peviEntLASERMINE_OWNER ) != i_Owner )
                continue;
            
clsname[0] = '^0'
            
peviEntpev_classnameclsnamesizeof(clsname)-);
                
            if ( 
equaliclsnameENT_CLASS_NAME ) )
            {
                
PlaySoundiEntSTOP_SOUND );
                
RemoveEntityiEnt );
            }
        }
        else
            
set_peviEntpev_flagsFL_KILLME );
    }
    
g_deployed[i_Owner]=0;

__________________
homepage:steam.lv
topsites:top.steam.lv

Last edited by FLOY; 05-31-2016 at 09:12.
FLOY is offline
Send a message via Skype™ to FLOY
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode