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

[Help-Ayuda]LaserMine


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
megamanzx
Member
Join Date: Feb 2012
Old 10-04-2013 , 11:25   [Help-Ayuda]LaserMine
Reply With Quote #1

any can help me in the plugin of laser mine

i need:

damage ammount = ammo packs
if zombie killed = update frags
make laser mine hud HP permanently it appear only 1 sec

This line
PHP Code:
    set_hudmessage02551550.10.400.00.10.00.0, -);
    
ShowSyncHudMsgiPlayerg_iMsgSyncszHud ); 
CODE LM
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < engine >

native zp_get_user_zombieiPlayer );
native zp_get_user_ammo_packsiPlayer );
native zp_set_user_ammo_packsiPlayeriPacks );
native zp_is_lnj_round( );

#define MAX_ENTITIES        600
#define MAX_PLAYERS        32
#define MINE_ON            1
#define MINE_OFF            0
#define TASK_CREATE        84765
#define TASK_REMOVE        86766
#define MINE_COST            6
#define MINE_CLASSNAME        "zp_trip_mine"
#define MINE_MODEL_EXPLODE    "sprites/zerogxplode.spr"
#define MINE_MODEL_VIEW        "models/zombie_plague/lasermine.mdl"
#define MINE_SOUND_ACTIVATE    "weapons/mine_activate.wav"
#define MINE_SOUND_CHARGE        "weapons/mine_charge.wav"
#define MINE_SOUND_DEPLOY        "weapons/mine_deploy.wav"
#define MINE_HEALTH        650.0
#define entity_get_owner(%0)        entity_get_int( %0, EV_INT_iuser2 )
#define entity_get_status(%0)        entity_get_int( %0, EV_INT_iuser1 )
#define entity_get_classname(%0,%1)    entity_get_string( %0, EV_SZ_classname, %1, charsmax( %1 ) )

new g_iTripMines33 ];
new 
g_iPlantedMines33 ]; 
new 
g_iPlanting33 ];
new 
g_iRemoving33 ];
new 
g_hExplode;

new 
g_iMsgSync;

public 
plugin_init( )
{
    
register_plugin"[ZP] Trip Mines""1.0""Hattrick" );

    
// Language Files
    
register_dictionary("laser_mine.txt" );
    
    
register_clcmd"say /lm""Command_Buy" );
    
register_clcmd"say lm""Command_Buy" );
    
    
register_clcmd"CreateLaser""Command_Plant" );
    
register_clcmd"TakeLaser""Command_Take" );
    
    
register_logevent"Event_RoundStart"2"1=Round_Start" );
    
    
register_thinkMINE_CLASSNAME"Forward_Think" );
    
    
g_iMsgSync CreateHudSyncObj( );
}

public 
plugin_precache( )
{
    
engfuncEngFunc_PrecacheModelMINE_MODEL_VIEW );
    
    
engfuncEngFunc_PrecacheSoundMINE_SOUND_ACTIVATE );
    
engfuncEngFunc_PrecacheSoundMINE_SOUND_CHARGE );
    
engfuncEngFunc_PrecacheSoundMINE_SOUND_DEPLOY );
    
    
g_hExplode engfuncEngFunc_PrecacheModelMINE_MODEL_EXPLODE );
}

public 
client_disconnectiPlayer )
{
    
g_iTripMinesiPlayer ] = 0;
    
g_iPlantingiPlayer ] = false;
    
g_iRemovingiPlayer ] = false;
    
    if( 
g_iPlantedMinesiPlayer ] )
    {
        
Func_RemoveMinesByOwneriPlayer );
        
        
g_iPlantedMinesiPlayer ] = 0;
    }
    
    
remove_taskiPlayer TASK_REMOVE );
    
remove_taskiPlayer TASK_CREATE );
}

public 
Command_BuyiPlayer )
{
    if( !
is_user_aliveiPlayer ) )
    {
        
client_printiPlayerprint_chat"[ZP] You should be alive" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
zp_get_user_zombieiPlayer ) )
    {
        
client_printiPlayerprint_chat"[ZP] You should be human" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
zp_get_user_ammo_packsiPlayer ) < MINE_COST )
    {
        
client_printiPlayerprint_chat"[ZP] You need %i ammo packs"MINE_COST );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
zp_is_lnj_round( ) )
    {
        
client_printiPlayerprint_chat"[ZP] You can't buy a tripmine into an armageddon round" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    
zp_set_user_ammo_packsiPlayerzp_get_user_ammo_packsiPlayer ) - MINE_COST );
    
    
g_iTripMinesiPlayer ]++;
    
    
client_printiPlayerprint_chat"[ZP] You bought a trip mine. Press 'p' to plant it or 'v' to take it" );
    
    
client_cmdiPlayer"bind p CreateLaser" );
    
client_cmdiPlayer"bind v TakeLaser" );
    
    return 
PLUGIN_CONTINUE;
}

public 
Command_PlantiPlayer )
{
    if( !
is_user_aliveiPlayer ) )
    {
        
client_printiPlayerprint_chat"[ZP] You should be alive" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
zp_get_user_zombieiPlayer ) )
    {
        
client_printiPlayerprint_chat"[ZP] You should be human" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( !
g_iTripMinesiPlayer ] )
    {
        
client_printiPlayerprint_chat"[ZP] You don't have a trip mine to plant" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
g_iPlantedMinesiPlayer ] > )
    {
        
client_printiPlayerprint_chat"[ZP] You can plant only 2 mines" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
zp_is_lnj_round( ) )
    {
        
client_printiPlayerprint_chat"[ZP] You can't buy a tripmine into an armageddon round" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
g_iPlantingiPlayer ] || g_iRemovingiPlayer ] )
        return 
PLUGIN_CONTINUE;
    
    if( 
CanPlantiPlayer ) ) {
        
g_iPlantingiPlayer ] = true;
        
        
message_beginMSG_ONE_UNRELIABLE108_iPlayer );
        
write_byte);
        
write_byte);
        
message_end( );
        
        
set_task1.2"Func_Plant"iPlayer TASK_CREATE );
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
Command_TakeiPlayer )
{
    if( !
is_user_aliveiPlayer ) )
    {
        
client_printiPlayerprint_chat"[ZP] You should be alive" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
zp_get_user_zombieiPlayer ) )
    {
        
client_printiPlayerprint_chat"[ZP] You should be human" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( !
g_iPlantedMinesiPlayer ] )
    {
        
client_printiPlayerprint_chat"[ZP] You don't have a planted mine" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
g_iPlantingiPlayer ] || g_iRemovingiPlayer ] )
        return 
PLUGIN_CONTINUE;
    
    if( 
CanTakeiPlayer ) ) {
        
g_iRemovingiPlayer ] = true;
        
        
message_beginMSG_ONE_UNRELIABLE108_iPlayer );
        
write_byte);
        
write_byte);
        
message_end( );
        
        
set_task1.2"Func_Take"iPlayer TASK_REMOVE );
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
Event_RoundStart( ) {
    static 
iEntityszClassName32 ], iPlayer;
    for( 
iEntity 0iEntity MAX_ENTITIES 1iEntity++ ) {
        if( !
is_valid_entiEntity ) )
            continue;
        
        
szClassName] = '^0';
        
entity_get_classnameiEntityszClassName );
        
        if( 
equalszClassNameMINE_CLASSNAME ) )
            
remove_entityiEntity );
    }
    
    for( 
iPlayer 1iPlayer 33iPlayer++ ) {
        
g_iTripMinesiPlayer ] = 0;
        
g_iPlantedMinesiPlayer ] = 0;
    }
}

public 
Func_TakeiPlayer ) {
    
iPlayer -= TASK_REMOVE;
    
    
g_iRemovingiPlayer ] = false;
    
    static 
iEntityszClassName32 ], FloatflOwnerOrigin], FloatflEntityOrigin];
    for( 
iEntity 0iEntity MAX_ENTITIES 1iEntity++ ) {
        if( !
is_valid_entiEntity ) )
            continue;
        
        
szClassName] = '^0';
        
entity_get_classnameiEntityszClassName );
        
        if( 
equalszClassNameMINE_CLASSNAME ) ) {
            if( 
entity_get_owneriEntity ) == iPlayer ) {
                
entity_get_vectoriPlayerEV_VEC_originflOwnerOrigin );
                
entity_get_vectoriEntityEV_VEC_originflEntityOrigin );
                
                if( 
get_distance_fflOwnerOriginflEntityOrigin ) < 55.0 ) {
                    
g_iPlantedMinesiPlayer ]--;
                    
g_iTripMinesiPlayer ]++;
                    
                    
remove_entityiEntity );
                    
                    break;
                }
            }
        }
    }
}

public 
boolCanTakeiPlayer ) {
    static 
iEntityszClassName32 ], FloatflOwnerOrigin], FloatflEntityOrigin];
    for( 
iEntity 0iEntity MAX_ENTITIES 1iEntity++ ) {
        if( !
is_valid_entiEntity ) )
            continue;
        
        
szClassName] = '^0';
        
entity_get_classnameiEntityszClassName );
        
        if( 
equalszClassNameMINE_CLASSNAME ) ) {
            if( 
entity_get_owneriEntity ) == iPlayer ) {
                
entity_get_vectoriPlayerEV_VEC_originflOwnerOrigin );
                
entity_get_vectoriEntityEV_VEC_originflEntityOrigin );
                
                if( 
get_distance_fflOwnerOriginflEntityOrigin ) < 55.0 )
                    return 
true;
            }
        }
    }
    
    return 
false;
}

public 
boolCanPlantiPlayer ) {
    static 
FloatflOrigin];
    
entity_get_vectoriPlayerEV_VEC_originflOrigin );
    
    static 
FloatflTraceDirection], FloatflTraceEnd], FloatflTraceResult], FloatflNormal];
    
velocity_by_aimiPlayer64flTraceDirection );
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
    static 
FloatflFractioniTr;
    
iTr 0;
    
engfuncEngFunc_TraceLineflOriginflTraceEnd0iPlayeriTr );
    
get_tr2iTrTR_vecEndPosflTraceResult );
    
get_tr2iTrTR_vecPlaneNormalflNormal );
    
get_tr2iTrTR_flFractionflFraction );
    
    if( 
flFraction >= 1.0 ) {
        
client_printiPlayerprint_chat"[ZP] You must plant the tripmine on a wall" );
        
        return 
false;
    }
    
    return 
true;
}

public 
Func_PlantiPlayer ) {
    
iPlayer -= TASK_CREATE;
    
    
g_iPlantingiPlayer ] = false
         
    static 
FloatflOrigin];
    
entity_get_vectoriPlayerEV_VEC_originflOrigin );
    
    static 
FloatflTraceDirection], FloatflTraceEnd], FloatflTraceResult], FloatflNormal];
    
velocity_by_aimiPlayer128flTraceDirection );
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
    static 
FloatflFractioniTr;
    
iTr 0;
    
engfuncEngFunc_TraceLineflOriginflTraceEnd0iPlayeriTr );
    
get_tr2iTrTR_vecEndPosflTraceResult );
    
get_tr2iTrTR_vecPlaneNormalflNormal );
    
get_tr2iTrTR_flFractionflFraction );
    
    static 
iEntity;
    
iEntity create_entity"info_target" );
    
    if( !
iEntity )
        return;
    
    static 
szHud1102 ];
    static 
szName64 ];
        
    static 
FloatflHealth;
    
flHealth entity_get_floatiEntityEV_FL_health );
    
    
formatexszNamecharsmaxszName ), "Lasermine #%i HP: %d^n"g_iTripMinesflHealth 1000.0 );
        
    
addszHudcharsmaxszHud ), szName );
        
    
set_hudmessage02551550.10.400.00.10.00.0, -);
    
ShowSyncHudMsgiPlayerg_iMsgSyncszHud );
    
    
entity_set_stringiEntityEV_SZ_classnameMINE_CLASSNAME );
    
entity_set_modeliEntityMINE_MODEL_VIEW );
    
entity_set_sizeiEntityFloat: { -4.0, -4.0, -4.0 }, Float: { 4.04.04.0 } );
    
    
entity_set_intiEntityEV_INT_iuser2iPlayer );
    
    
g_iPlantedMinesiPlayer ]++;
    
    
entity_set_floatiEntityEV_FL_frame0.0 );
    
entity_set_floatiEntityEV_FL_framerate0.0 );
    
entity_set_intiEntityEV_INT_movetypeMOVETYPE_FLY );
    
entity_set_intiEntityEV_INT_solidSOLID_NOT );
    
entity_set_intiEntityEV_INT_body);
    
entity_set_intiEntityEV_INT_sequence);
    
entity_set_floatiEntityEV_FL_takedamageDAMAGE_NO );
    
entity_set_intiEntityEV_INT_iuser1MINE_OFF );
    
    static 
FloatflNewOrigin], FloatflEntAngles];
    
flNewOrigin] = flTraceResult] + ( flNormal] * 8.0 );
    
flNewOrigin] = flTraceResult] + ( flNormal] * 8.0 );
    
flNewOrigin] = flTraceResult] + ( flNormal] * 8.0 );
    
    
entity_set_originiEntityflNewOrigin );
    
    
vector_to_angleflNormalflEntAngles );
    
entity_set_vectoriEntityEV_VEC_anglesflEntAngles );
    
flEntAngles] *= -1.0;
    
flEntAngles] *= -1.0;
    
flEntAngles] *= -1.0;
    
entity_set_vectoriEntityEV_VEC_v_angleflEntAngles );
    
    
g_iTripMinesiPlayer ]--;
    
    
emit_soundiEntityCHAN_WEAPONMINE_SOUND_DEPLOYVOL_NORMATTN_NORM0PITCH_NORM );
    
emit_soundiEntityCHAN_VOICEMINE_SOUND_CHARGEVOL_NORMATTN_NORM0PITCH_NORM );
    
    
entity_set_floatiEntityEV_FL_nextthinkget_gametime( ) + 0.6 ); 
}

public 
Func_RemoveMinesByOwneriPlayer ) {
    static 
iEntityszClassName32 ];
    for( 
iEntity 0iEntity MAX_ENTITIES 1iEntity++ ) {
        if( !
is_valid_entiEntity ) )
            continue;
        
        
szClassName] = '^0';
        
entity_get_classnameiEntityszClassName );
        
        if( 
equalszClassNameMINE_CLASSNAME ) )
            if( 
entity_get_intiEntityEV_INT_iuser2 ) == iPlayer )
                
remove_entityiEntity );
    }
}

Func_ExplodeiEntity ) {
    
g_iPlantedMinesentity_get_owneriEntity ) ]--;
    
    static 
FloatflOrigin], FloatflZombieOrigin], FloatflHealthFloatflVelocity];
    
entity_get_vectoriEntityEV_VEC_originflOrigin );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_EXPLOSION );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
write_shortg_hExplode );
    
write_byte55 );
    
write_byte15 );
    
write_byte);
    
message_end( );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_EXPLOSION );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
write_shortg_hExplode );
    
write_byte65 );
    
write_byte15 );
    
write_byte);
    
message_end( );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_EXPLOSION );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
write_shortg_hExplode );
    
write_byte85 );
    
write_byte15 );
    
write_byte);
    
message_end( );
    
    static 
iZombie;
    for( 
iZombie 1iZombie MAX_PLAYERS 1iZombie++ ) {
        if( 
is_user_connectediZombie ) ) {
            if( 
is_user_aliveiZombie ) ) {
                
entity_get_vectoriZombieEV_VEC_originflZombieOrigin );
                
                if( 
get_distance_fflOriginflZombieOrigin ) < 360.0 ) {
                    
flHealth entity_get_floatiZombieEV_FL_health );
                    
entity_get_vectoriZombieEV_VEC_velocityflVelocity );
                    
                    
flVelocity] += 456.0;
                    
flVelocity] += 320.0;
                    
flVelocity] += 299.0;
                    
                    
entity_set_vectoriZombieEV_VEC_velocityflVelocity );
                    
                    if( 
zp_get_user_zombieiZombie ) )
                        
fm_set_user_healthiZombiefloatmaxflHealth random_float1600.02800.0 ), 0.0 ) );
                }
            }
        }
    }
    
    
remove_entityiEntity );
}

public 
Forward_ThinkiEntity ) {
    static 
FloatflGameTimeiStatus;
    
flGameTime get_gametime( );
    
iStatus entity_get_statusiEntity );
    
    switch( 
iStatus ) {
        case 
MINE_OFF: {
            
entity_set_intiEntityEV_INT_iuser1MINE_ON );
            
entity_set_floatiEntityEV_FL_takedamageDAMAGE_YES );
            
entity_set_intiEntityEV_INT_solidSOLID_BBOX );
            
entity_set_floatiEntityEV_FL_healthMINE_HEALTH 1000.0 );
            
            
emit_soundiEntityCHAN_VOICEMINE_SOUND_ACTIVATEVOL_NORMATTN_NORM0PITCH_NORM );
        }
        
        case 
MINE_ON: {
            static 
FloatflHealth;
            
flHealth entity_get_floatiEntityEV_FL_health );
            
            if( 
flHealth <= 1000.0 ) {
                
Func_ExplodeiEntity );
                
                return 
FMRES_IGNORED;
            }
        }
    }
    
    if( 
is_valid_entiEntity ) )
        
entity_set_floatiEntityEV_FL_nextthinkflGameTime 0.1 );
    
    return 
FMRES_IGNORED;
}

public 
fm_set_user_healthiPlayerFloatflHealth )
    
flHealth set_peviPlayerpev_healthflHealth ) : dllfuncDLLFunc_ClientKilliPlayer ); 
any can help me please??

Last edited by megamanzx; 10-04-2013 at 11:25.
megamanzx is offline
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 00:04.


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