AlliedModders

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

taheri6 01-05-2008 16:53

Invalid player id
 
Hello,

Forgive this noob question, but I get errors such as this:

Invalid player id 32
Run time error 10: native error (native "get_user_aiming")

Invalid player id 121
Run time error 10: native error (native "client_print")

Does that just meant the player is no longer connected, or does the playerID always need to be below the max amount of players?

Sn!ff3r 01-05-2008 17:40

Re: Invalid player id
 
Quote:

Does that just meant the player is no longer connected,
Player with given id isnt be on server

Quote:

or does the playerID always need to be below the max amount of players?
probably yes

remember, playerID is always from 1 to 32.

zwfgdlc 01-06-2008 02:39

Re: Invalid player id
 
Code:

if(is_user_connected(id))
get_user_aiming()
or
client_print()


taheri6 01-06-2008 04:12

Re: Invalid player id
 
I edited the plugin and now before any client_print and hud message, or sound emit I always do
PHP Code:

if( is_user_connected(id) && !is_user_bot(id))
{
    
action;


I was also considering changing to
PHP Code:


#define MAX_PLAYERS 33;

if( ( 0id MAX_PLAYERS) && is_user_connected(id) && !is_user_bot(id))
{
    
action;


But am not sure if that would be an overkill or extra overhead if this has to be done quite a bit.


All times are GMT -4. The time now is 11:12.

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