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

Repair HP show Tripmine


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
marijuana666
Junior Member
Join Date: Dec 2010
Location: Romania, Turda
Old 02-14-2014 , 17:10   Repair HP show Tripmine
Reply With Quote #1

Hello!

My plugin tripmine show wrong hp (bug probably)! HP OVERLAPPED at "Second mine's health:"

DEMO Wrong HP
I want change to:
DEMO Right HP

PHP Code:
#pragma semicolon 1

#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        800.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;

public 
plugin_init( )
{
    
register_plugin"[ZP] Trip Mines""1.0""Hattrick" );
    
    
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" );
}

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;
    
    
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 ]++;
    
    
set_peviEntitypev_iuser3g_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( 
entity_get_owneriEntity ) )
            {
                if( 
peviEntitypev_iuser3) == )
                {
                    
set_hudmessage(02001000.10.3700.00.122.01.0, -1),
                    
show_hudmessageentity_get_owneriEntity ), "First mine's health: %0.0f"flHealth 1000.0 );
                }
                else
                {
                    
set_hudmessage(02001000.10.400.00.122.01.0, -1),
                    
show_hudmessageentity_get_owneriEntity ), "Second mine's health: %0.0f"flHealth 1000.0 );
                }
            }
            
            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 ); 
__________________
marijuana666 is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 02-15-2014 , 02:02   Re: Repair HP show Tripmine
Reply With Quote #2

People usually dont prefer do download demos and see them, if u want people to help you fast, use screenshots.
__________________
You will find everything u need :-
Catastrophe is offline
marijuana666
Junior Member
Join Date: Dec 2010
Location: Romania, Turda
Old 02-15-2014 , 04:33   Re: Repair HP show Tripmine
Reply With Quote #3

Quote:
Originally Posted by Catastrophe View Post
People usually dont prefer do download demos and see them, if u want people to help you fast, use screenshots.
Ok, I hope you understand the screenshots!
In demos, it is clear what I mean.

Plugin problem:
I have 2 tripmine and plant them, so here is ok


Then, take first tripmine or explode first tripmine


Now, if a plant first tripmine, (here is a problem, plugin showed overlapped)
Mention that there are 2 trip here:
__________________
marijuana666 is offline
marijuana666
Junior Member
Join Date: Dec 2010
Location: Romania, Turda
Old 02-16-2014 , 05:27   Re: Repair HP show Tripmine
Reply With Quote #4

UP !!!
__________________
marijuana666 is offline
plazma
Senior Member
Join Date: Oct 2013
Old 02-17-2014 , 06:51   Re: Repair HP show Tripmine
Reply With Quote #5

bump
__________________
Free Palestine ♥
plazma is offline
marijuana666
Junior Member
Join Date: Dec 2010
Location: Romania, Turda
Old 02-17-2014 , 09:45   Re: Repair HP show Tripmine
Reply With Quote #6

No one KNOW??

Please help!
__________________
marijuana666 is offline
Firuz
Member
Join Date: Dec 2014
Location: Tajikistan
Old 12-29-2014 , 19:02   Re: Repair HP show Tripmine
Reply With Quote #7

Help please this post need help.
__________________
Firuz
Firuz is offline
Send a message via Skype™ to Firuz
Reply


Thread Tools
Display Modes

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 19:42.


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