AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Invalid player 2-3 (https://forums.alliedmods.net/showthread.php?t=329222)

eNNkds 12-13-2020 14:40

Invalid player 2-3
 
Hi i have debug a plugin and it's make invalid player 2 / 3 this is the part of script line 23
line 23 is if( cs_get_user_team( Team ) == 1 )
Code:

public DeathMsg( )
{
        new Victim = read_data( 2 )
        new Team = cs_get_user_team( Victim )
        if( !bb_is_build_phase( ) && !bb_is_prep_phase( ) )
        {
                if( Team != 0 ){
                        if( cs_get_user_team( Team ) == 1 )
                                DeleteBlock( 1, Victim, Team )
                else DeleteBlock( 2, Victim, 0 )
                }
        }
}

Code:

[CSTRIKE] Invalid player 2
[AMXX] Displaying debug trace (plugin "testing")
[AMXX] Run time error 10: native error (native "cs_get_user_team")

maybe it need check if user connected/disconected?

thEsp 12-13-2020 14:48

Re: Invalid player 2-3
 
Quote:

Returns the client's team and optionally the model id.


You have to check whatever you need directly with the stored variable Team.

OciXCrom 12-13-2020 15:37

Re: Invalid player 2-3
 
Check if the client is connected before using the function.

DJEarthQuake 12-13-2020 15:46

Re: Invalid player 2-3
 
You had Team where Victim should have gone. Since Team = cs_get_user_team( Victim ), use it.
Code:
public DeathMsg( ) {     new Victim = read_data( 2 )     new Team = cs_get_user_team( Victim )     if( !bb_is_build_phase( ) && !bb_is_prep_phase( ) && Team != 0 )     {         if( Team == 1 )             DeleteBlock( 1, Victim, Team )         else             DeleteBlock( 2, Victim, 0 )     } }

OciXCrom 12-13-2020 16:01

Re: Invalid player 2-3
 
new CsTeams:Team

eNNkds 12-13-2020 16:12

Re: Invalid player 2-3
 
Now i get it. it's working for the moment no logs thank you!

eNNkds 12-23-2020 14:29

Re: Invalid player 2-3
 
some times have delete it wrong.

its for basebuilder mod 6.5
T can't build.
need adjust when ct kill a t , some time delete for ct without die

need to check if T attacker and Ct is victim = deleteblock or if CT victim and revive at T team =deleteblock

lexzor 12-23-2020 21:37

Re: Invalid player 2-3
 
PHP Code:

public DeathMsg( )
{
    new 
Victim read_data)
    new 
CsTeams:Team cs_get_user_teamVictim )

    if( !
bb_is_build_phase( ) && !bb_is_prep_phase( ) && Team != )

    {
        if( !
is_user_alive(Victim) ) return PLUGIN_HANDLED
        
if( Team == CS_TEAM_T )
            
DeleteBlock1VictimTeam )
        else
            
DeleteBlock2Victim)
    }




All times are GMT -4. The time now is 23:30.

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