AlliedModders

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

KamiN 06-20-2012 18:50

Invalid player 8
 
Code:

public showStatus(id)
{
    if(get_pcvar_num(cvar_playerinfo)) {
        if(is_user_alive(id)) {
            static name[33], pid
            pid = read_data(2)
           
            get_user_name(pid, name, 32)
           
            switch(cs_get_user_team(pid)) {
                case CS_TEAM_T: {
                    set_hudmessage(100, 255, 0, -1.0, 0.80, 0, 0.01, 3.0, 0.01, 0.01, -1)
                    ShowSyncHudMsg(id, hudmessage4, "Kaliniai: %s [%d HP]", name, get_user_health(pid))
                   
                }
                case CS_TEAM_CT: {
                    set_hudmessage(0, 255, 100, -1.0, 0.80, 0, 0.01, 3.0, 0.01, 0.01, -1)
                    ShowSyncHudMsg(id, hudmessage4, "Priziuretojai: %s [%d HP]", name, get_user_health(pid))               
                }
            }
        }
    }
}


Code:

L 06/20/2012 - 15:22:05: [CSTRIKE] Invalid player 8
L 06/20/2012 - 15:22:05: [AMXX] Displaying debug trace (plugin "jailbreak_manager_en.amxx")
L 06/20/2012 - 15:22:05: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 06/20/2012 - 15:22:05: [AMXX]    [0] cjailbreak_manager_en.sma::showStatus (line 255)

this is 255 line
Code:

            switch(cs_get_user_team(pid)) {

What's wrong? :O

Liverwiz 06-20-2012 21:48

Re: Invalid player 8
 
how do you call showStatus?

hornet 06-20-2012 22:27

Re: Invalid player 8
 
I'm going to assume that your trying to use StatusValue. Your not running any checks on your target player. Check if they're alive, also you should you use the 3rd piece of data for health since its sent anyway.

Neeeeeeeeeel.- 06-21-2012 02:16

Re: Invalid player 8
 
PHP Code:

public showStatus(id)
{
    if(
get_pcvar_num(cvar_playerinfo)) {
        if(
is_user_alive(id)) {
           
            static 
name[33], pid 
            pid 
read_data(2)
            if( !
is_user_alivepid ) )
                 return 
PLUGIN_HANDLED
            
get_user_name(pidname32)
            
            switch(
cs_get_user_team(pid)) {
                case 
CS_TEAM_T: {
                    
set_hudmessage(1002550, -1.00.8000.013.00.010.01, -1)
                    
ShowSyncHudMsg(idhudmessage4"Kaliniai: %s [%d HP]"nameget_user_health(pid))
                    
                }
                case 
CS_TEAM_CT: {
                    
set_hudmessage(0255100, -1.00.8000.013.00.010.01, -1)
                    
ShowSyncHudMsg(idhudmessage4"Priziuretojai: %s [%d HP]"nameget_user_health(pid))                
                }
            }
        }
    }
    return 
PLUGIN_HANDLED;


Edit: I didn't read hornet's post :/


All times are GMT -4. The time now is 06:10.

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