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

cs_get_user_team error (HELP)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Id0x.
Junior Member
Join Date: Dec 2020
Old 01-04-2021 , 06:06   cs_get_user_team error (HELP)
Reply With Quote #1

Code:
L 01/04/2021 - 06:38:38: [CSTRIKE] Invalid player 8 (not in-game)
L 01/04/2021 - 06:38:38: [AMXX] Displaying debug trace (plugin "best_player.amxx", version "1.0")
L 01/04/2021 - 06:38:38: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 01/04/2021 - 06:38:38: [AMXX]    [0] phpFFGgcW.sma::hamTakeDamage (line 33)
Code:
L 01/04/2021 - 06:38:55: [CSTRIKE] Invalid player 8 (not in-game)
L 01/04/2021 - 06:38:55: [AMXX] Displaying debug trace (plugin "best_player.amxx", version "1.0")
L 01/04/2021 - 06:38:55: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 01/04/2021 - 06:38:55: [AMXX]    [0] phpFFGgcW.sma::EventDeathMsg (line 45)
PHP Code:
public hamTakeDamage(victiminflictorattackerFloat:damageDamageBits)
{
    if( 
<= attacker <= 32)
    {
        if(
cs_get_user_team(victim) != cs_get_user_team(attacker))
            
g_iDmg[attacker] += floatround(damage)
        else 
g_iDmg[attacker] -= floatround(damage)
    }

PHP Code:
public EventDeathMsg()  
{  
    new 
killer read_data(1)  
    new 
victim read_data(2)  
    new 
is_hs read_data(3)  
      
    if(
killer != victim && killer && cs_get_user_team(killer) != cs_get_user_team(victim))  
    {  
        
g_iKills[killer]++;  
          
        if(
is_hs)  
            
g_iHS[killer]++;  
    }  
    else 
g_iKills[killer]--;  

Line 33 :
PHP Code:
if(cs_get_user_team(victim) != cs_get_user_team(attacker)) 
Line 45 :
PHP Code:
if(killer != victim && killer && cs_get_user_team(killer) != cs_get_user_team(victim)) 

Last edited by Id0x.; 01-04-2021 at 06:07.
Id0x. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-04-2021 , 06:34   Re: cs_get_user_team error (HELP)
Reply With Quote #2

check if user ("attacker") is connected.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-04-2021 at 06:34.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-04-2021 , 07:35   Re: cs_get_user_team error (HELP)
Reply With Quote #3

Always check if the player is connected before using "cs_get_user_team".
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-04-2021 , 22:13   Re: cs_get_user_team error (HELP)
Reply With Quote #4

I wouldn't say you'd always need to check if a player is connected before calling cs_get_user_team().

In scenarios where the player could be disconnected at the time it is called would be appropriate. A good example would be for the killer in a take damage or death event since this could result from a grenade throw and they disconnect immediately after, subsequently killing someone. But in a take damage event, the victim cannot be disconnected so calling it would be a waste.
__________________
Bugsy 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 14:54.


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