AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Native error (https://forums.alliedmods.net/showthread.php?t=154421)

bibu 04-07-2011 15:57

Native error
 
Quote:

L 04/07/2011 - 20:04:15: [CSTRIKE] Invalid player 2
L 04/07/2011 - 20:04:15: [AMXX] Displaying debug trace (plugin "admin_three_chat_colors.amxx")
L 04/07/2011 - 20:04:15: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 04/07/2011 - 20:04:15: [AMXX] [0] admin_three_chat_colors.sma::hook_say (line 169)
The beginning of the code (init) till line 169:

PHP Code:

register_clcmd("say""hook_say");

public 
hook_say(id)
{
    
#if defined ALLOW_ALLCHAT
    
if(~IsUserAdmin(id))
    {
        new 
someStr[192];
        
read_argv(1someStr191);
        
        if(
IsValidMessage(someStr))
        {
            new 
name[32];
            
get_user_name(idname31);
            
            new 
Message[192];
            
            if(
cs_get_user_team(id) == CS_TEAM_SPECTATOR)
            {
..... 


Arkshine 04-07-2011 16:06

Re: Native error
 
It means just player was not connected when cs_get_user_team was executed.

So, add a check to make player is connected. is_user_connected.

bibu 04-07-2011 16:13

Re: Native error
 
Is that really needed in hook_say?

Shall I check before #if defined ALLOW_CHAT if player is connected, otherwise if not, return PLUGIN_HANDLED_MAIN right?


All times are GMT -4. The time now is 20:08.

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