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

Player Tags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
serjaka
Senior Member
Join Date: Oct 2011
Old 12-07-2013 , 16:35   Player Tags
Reply With Quote #1

Hello Guys , i have 1 problem with player tags! Some one can help me with this mistake? thx! :*
SCREEN:



PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < ColorChat >


#define ADMIN_ACCESS            ADMIN_BAN
#pragma semicolon 1

enum CsTeams 
{
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T 1,
    
CS_TEAM_CT 2,
    
CS_TEAM_SPECTATOR 3
};

static const 
PLUGIN[ ] = "Player Tags";
static const 
VERSION[ ] = "1.0";

new 
szFile128 ];

new 
PlayerTag33 ][ 32 ];
new 
boolPlayerHasTag33 ];


public 
plugin_init( )
{
    
register_pluginPLUGINVERSION"Askhanar" );
    
register_concmd"amx_reloadtags""ClCmdReloadTags", -1"" );
    
    
register_clcmd("say","hook_say");
    
register_clcmd("say_team","hook_say_team");
    
    
register_forwardFM_ClientUserInfoChanged"fwClientUserInfoChanged" );
}

public 
plugin_precache( ) 
{
    
    
get_configsdirszFilesizeof szFile ) -);
    
formatexszFilesizeof szFile ) -1"%s/PlayerTags.ini"szFile );
    
    if( !
file_existsszFile ) ) 
    {
        
write_fileszFile";Aici treceti tag-urile jucatorilor !", -);
        
write_fileszFile";ex: ^"Nume Player^" ^"Ip Player^" ^"Tag Player^" ", -);
        
write_fileszFile";Numele sa fie exact( ex: Askhanar va fi Askhanar nu askhanar ! ) ", -);
    }

}

public 
client_putinserverid )
{
    if( 
is_user_botid ) || is_user_hltvid ) ) return 1;
    
    
PlayerHasTagid ] = false;
    
    
LoadPlayerTagid );
    
    return 
0;
}
public 
fwClientUserInfoChangedidbuffer )
{
    if ( !
is_user_connectedid ) )
        return 
FMRES_IGNORED;
    
    static 
newname32 ];
    static 
name32 ];
    
    
get_user_nameidnamesizeof name ) -);
    
engfuncEngFunc_InfoKeyValuebuffer"name"newnamesizeof newname ) -);
    
    if ( 
equalnewnamename ) )
        return 
FMRES_IGNORED;
        
        
    
set_task0.1"LoadPlayerTag"id );
    
    return 
FMRES_SUPERCEDE;
}

public 
ClCmdReloadTagsid )
{
    if( !( 
get_user_flagsid ) & ADMIN_ACCESS ) )
    {
        
client_cmdid"echo Nu ai acces la aceasta comanda !");
        return 
1;
    }
    
    new 
iPlayers32 ];
    new 
iPlayersNum;

    
get_playersiPlayersiPlayersNum"c" );        
    for( new 
iPlayersNum i++ )
    {
        
PlayerHasTagiPlayers] ] = false;
        
LoadPlayerTagiPlayers] );
    }
    
    
client_cmdid"echo Tag-urile jucatorilor au fost incarcate cu succes !");
    return 
1;
}

public 
hook_sayid )
{
    
    if( 
is_user_botid ) ) return 0;
    
    static 
chat192 ];
    
read_argschatsizeofchat ) - );
    
remove_quoteschat );
    
    if( 
equalichat,"" ) ) return 0;
    
    new 
name32 ];
    
get_user_nameidnamesizeof name ) -);
    
    if( 
PlayerHasTagid ] )
    {
        switch( 
get_user_teamid ) )
        {
            case 
CS_TEAM_T
            {
                if (
is_user_aliveid ))
            
                    
ColorChat0RED,"^x03%s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                else
                    
ColorChat0RED,"^x01*DEAD* ^x03%s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
            }
            case 
CS_TEAM_CT:
            {
                if (
is_user_aliveid ))

                    
ColorChat0BLUE,"^x03%s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                else
                    
ColorChat0BLUE,"^x01*DEAD* ^x03%s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
            }
            case 
CS_TEAM_SPECTATOR:
            {
                
ColorChat0GREY,"^x04%s^x03 %s^x01 :  %s"name ,chat);
            }
        }
    }
    else if( !
PlayerHasTagid ] )
    {
        switch( 
get_user_teamid ) )
        {
            case 
CS_TEAM_T
            {
                if (
is_user_aliveid ))

                    
ColorChat0RED,"^x03%s %s^x01 :  %s"name ,chat);
                else
                    
ColorChat0RED,"^x01*DEAD* ^x03%s %s^x01 :  %s"name ,chat);
            }
            case 
CS_TEAM_CT:
            {
                if (
is_user_aliveid ))

                    
ColorChat0BLUE,"^x03%s %s^x01: %s"name ,chat);
                else
                    
ColorChat0BLUE,"^x01*DEAD* ^x03%s %s^x01: %s"name ,chat);
        
            }
            case 
CS_TEAM_SPECTATOR:
            {
                
ColorChat0GREY,"^x03%s^x01 :  %s"name ,chat);
            }
        }
    }
    
    return 
1;
}
public 
hook_say_teamid )
{
    
    if( 
is_user_botid ) ) return 0;
    
    static 
chat192 ];
    
read_argschatsizeofchat ) - );
    
remove_quoteschat );
    
    if( 
equalichat"" ) ) return 0;
    
    new 
name32 ];
    
get_user_nameidnamesizeof name ) -);
    
    if( 
PlayerHasTagid ] )
    {
        new 
iPlayers32 ], iPlayer;
        new 
iPlayersNum;
    
        
get_playersiPlayersiPlayersNum"c" );        
        for( new 
iPlayersNum i++ )
        {
            
iPlayer iPlayers];
            
            if( 
get_user_teamid ) == get_user_teamiPlayer ) )
            {
                switch( 
get_user_teamiPlayer ) )
                {
                    case 
CS_TEAM_T
                    {
                        if (
is_user_aliveid ))
                
                            
ColorChatiPlayerRED"^x01(Terrorist)^x03 %s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                        else
                            
ColorChatiPlayerRED"^x01*DEAD*(Terrorist)^x03 %s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                
                    }
                    case 
CS_TEAM_CT:
                    {
                        if (
is_user_aliveid ))

                            
ColorChatiPlayerBLUE"^x01(Counter-Terrorist)^x03 %s^x04%s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                        else
                            
ColorChatiPlayerBLUE"^x01*DEAD*(Counter-Terrorist)^x03 %s^x04%s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                    }
                    case 
CS_TEAM_SPECTATOR:
                    {
                        
ColorChatiPlayerGREY"^x01(Spectator)^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                    }
                }
            }
        }
    }
    else if( !
PlayerHasTagid ] )
    {
        new 
iPlayers32 ], iPlayer;
        new 
iPlayersNum;
    
        
get_playersiPlayersiPlayersNum"c" );        
        for( new 
iPlayersNum i++ )
        {
            
iPlayer iPlayers];
            if( 
get_user_teamid ) == get_user_teamiPlayer ) )
            {
                switch( 
get_user_teamid ) )
                {
                    case 
CS_TEAM_T
                    {
                        if (
is_user_aliveid ))

                            
ColorChatiPlayerRED"^x01(Terrorist)^x03 %s %s^x01 :  %s"name ,chat);
                        else
                            
ColorChatiPlayerRED"^x01*DEAD*(Terrorist)^x03 %s %s^x01 :  %s"name ,chat);
                    }
                    case 
CS_TEAM_CT:
                    {
                        if (
is_user_aliveid ))
                            
ColorChatiPlayerBLUE"^x01(Counter-Terrorist)^x03 %s %s^x01 :  %s"name ,chat);
                        else
                            
ColorChatiPlayerBLUE"^x01*DEAD*(Counter-Terrorist)^x03 %s %s^x01 :  %s"name ,chat);
                    }
                    case 
CS_TEAM_SPECTATOR:
                    {
                        
ColorChatiPlayerGREY"^x01(Spectator)^x03 %s^x01 :  %s"name ,chat);
                    }
                }
            }
        }
    }
    return 
1;
}
public 
LoadPlayerTagid )
{
    
PlayerHasTagid ] = false;
    
    if( !
file_existsszFile ) ) 
    {
        
write_fileszFile";Aici treceti tag-urile jucatorilor !", -);
        
write_fileszFile";ex: ^"Nume Player^" ^"Ip Player^" ^"Tag Player^" ", -);
        
write_fileszFile";Numele sa fie exact( ex: Askhanar va fi Askhanar nu askhanar ! ) ", -);
    }
    
    new 
fopenszFile"rt" );
    
    if( !
) return 0;
    
    new 
data512 ], buffer][ 32 ] ;
    
    while( !
feof) ) 
    {
        
fgetsfdatasizeof data ) -);
        
        if( !
data] || data] == ';' || ( data] == '/' && data] == '/' ) ) 
            continue;
        
        
parse(data,\
        
buffer], sizeof buffer[ ] ) - 1,\
        
buffer], sizeof buffer[ ] ) - 1,\
        
buffer], sizeof buffer[ ] ) - 1
        
);
        
        new 
name32 ], ip32 ];
        
get_user_nameidnamesizeof name ) -);
        
get_user_ipidipsizeof ip ) -1);

        if( 
equalnamebuffer] ) || equalipbuffer] ) )
        {
            
PlayerHasTagid ] = true;
            
copyPlayerTagid ], sizeof PlayerTag[ ] ) -1buffer] );
            break;
        }
    }
    
    return 
0;


Last edited by serjaka; 12-07-2013 at 16:36.
serjaka is offline
serjaka
Senior Member
Join Date: Oct 2011
Old 12-08-2013 , 04:21   Re: Player Tags
Reply With Quote #2

I think problem is here:
PHP Code:
public hook_sayid )
{
    
    if( 
is_user_botid ) ) return 0;
    
    static 
chat192 ];
    
read_argschatsizeofchat ) - );
    
remove_quoteschat );
    
    if( 
equalichat,"" ) ) return 0;
    
    new 
name32 ];
    
get_user_nameidnamesizeof name ) -);
    
    if( 
PlayerHasTagid ] )
    {
        switch( 
get_user_teamid ) )
        {
            case 
CS_TEAM_T
            {
                if (
is_user_aliveid ))
            
                    
ColorChat0RED,"^x03%s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                else
                    
ColorChat0RED,"^x01*DEAD* ^x03%s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
            }
            case 
CS_TEAM_CT:
            {
                if (
is_user_aliveid ))

                    
ColorChat0BLUE,"^x03%s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                else
                    
ColorChat0BLUE,"^x01*DEAD* ^x03%s^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
            }
            case 
CS_TEAM_SPECTATOR:
            {
                
ColorChat0GREY,"^x04%s^x03 %s^x01 :  %s"name ,chat);
            }
        }
    }
    else if( !
PlayerHasTagid ] )
    {
        switch( 
get_user_teamid ) )
        {
            case 
CS_TEAM_T
            {
                if (
is_user_aliveid ))

                    
ColorChat0RED,"^x03%s %s^x01 :  %s"name ,chat);
                else
                    
ColorChat0RED,"^x01*DEAD* ^x03%s %s^x01 :  %s"name ,chat);
            }
            case 
CS_TEAM_CT:
            {
                if (
is_user_aliveid ))

                    
ColorChat0BLUE,"^x03%s %s^x01: %s"name ,chat);
                else
                    
ColorChat0BLUE,"^x01*DEAD* ^x03%s %s^x01: %s"name ,chat);
        
            }
            case 
CS_TEAM_SPECTATOR:
            {
                
ColorChat0GREY,"^x03%s^x01 :  %s"name ,chat);
            }
        }
    }
    
    return 
1;

serjaka is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 12-08-2013 , 11:35   Re: Player Tags
Reply With Quote #3

Yeah. There are 4 "%s"s;

ColorChat( 0, RED,"^x01*DEAD* ^x03%s^x04 %s^x03 %s^x01 : %s", PlayerTag[ id ], name ,chat);

But only 3 parameters.
akcaliberg is offline
serjaka
Senior Member
Join Date: Oct 2011
Old 12-08-2013 , 11:58   Re: Player Tags
Reply With Quote #4

thx :* works perfect
serjaka is offline
serjaka
Senior Member
Join Date: Oct 2011
Old 12-08-2013 , 13:58   Re: Player Tags
Reply With Quote #5

guys how can i make when a player is dead and alive player speaks Format will be *ALIVE* PlayerName : trualala but when both players are alive forma PlayerName : trulala ! Thx !
PHP Code:
public hook_sayid )
{
    
    if( 
is_user_botid ) ) return 0;
    
    static 
chat192 ];
    
read_argschatsizeofchat ) - );
    
remove_quoteschat );
    
    if( 
equalichat,"" ) ) return 0;
    
    new 
name32 ];
    
get_user_nameidnamesizeof name ) -);
    
    if( 
PlayerHasTagid ] )
    {
        switch( 
get_user_teamid ) )
        {
            case 
CS_TEAM_T
            {
                if (
is_user_aliveid ))
            
                    
ColorChat0RED,"^x04%s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                else
                    
ColorChat0RED,"^x01*DEAD*^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
            }
            case 
CS_TEAM_CT:
            {
                if (
is_user_aliveid ))

                    
ColorChat0BLUE,"^x04%s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
                else
                    
ColorChat0BLUE,"^x01*DEAD*^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
            }
            case 
CS_TEAM_SPECTATOR:
            {
                
ColorChat0GREY,"^x04%s^x03 %s^x01 :  %s"name ,chat);
            }
        }
    } 
serjaka is offline
bat
Veteran Member
Join Date: Jul 2012
Old 12-08-2013 , 14:11   Re: Player Tags
Reply With Quote #6

PHP Code:
if(is_user_alive(id))
{
      
ColorChat0BLUE,"^x01 *ALIVE*^x04%s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);
     else
       
ColorChat0BLUE,"^x01*DEAD*^x04 %s^x03 %s^x01 :  %s"PlayerTagid ], name ,chat);

bat is offline
Send a message via Skype™ to bat
serjaka
Senior Member
Join Date: Oct 2011
Old 12-08-2013 , 14:16   Re: Player Tags
Reply With Quote #7

when alive player will speak with alive player will appear *ALIVE* PlayerName : message but i need when player is DEAD and speak with ALIVE , on ALIVE player will be FORMAT: *ALIVE* PlayerName : mesage
GENIUS!!!!!!!!!!!
serjaka is offline
bat
Veteran Member
Join Date: Jul 2012
Old 12-08-2013 , 15:27   Re: Player Tags
Reply With Quote #8

Quote:
Originally Posted by serjaka View Post
when alive player will speak with alive player will appear *ALIVE* PlayerName : message but i need when player is DEAD and speak with ALIVE , on ALIVE player will be FORMAT: *ALIVE* PlayerName : mesage
GENIUS!!!!!!!!!!!
Maybe it is impossible, or i don't understand you.
bat is offline
Send a message via Skype™ to bat
serjaka
Senior Member
Join Date: Oct 2011
Old 12-08-2013 , 15:31   Re: Player Tags
Reply With Quote #9

i am dead and i see ALIVE player in chat , but when i am alive too i dont see this prefix *ALIVE* its normal chat , undestand?


Last edited by serjaka; 12-08-2013 at 15:31.
serjaka is offline
plazma
Senior Member
Join Date: Oct 2013
Old 12-08-2013 , 19:34   Re: Player Tags
Reply With Quote #10

Hi, I fix it work fine, but i have mod ZPA and i put tripmine by hattrick and why not work my chat i say /lm or say lm not wrok, to disable this "Tag Chat" and TripMine for fine where is the bug on this "Tag Chat" pls?

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

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

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 ]++;
    
    
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 ); 

Last edited by plazma; 12-08-2013 at 22:24.
plazma 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 16:05.


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