AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Player out of Range (https://forums.alliedmods.net/showthread.php?t=299061)

InteX01 07-01-2017 08:57

Player out of Range
 
PHP Code:

public vip_brzina(id)
{
    
set_user_maxspeed(idget_user_maxspeed(id) + 20)
}

public 
svip_brzina(id)
{
    
set_user_maxspeed(idget_user_maxspeed(id) + 35)


L 07/01/2017 - 12:36:40: [AMXX] Displaying debug trace (plugin "jb_mod.amxx&quot
L 07/01/2017 - 12:36:40: [AMXX] Run time error 10: native error (native "get_user_maxspeed&quot
L 07/01/2017 - 12:36:40: [AMXX] [0] jb_mod.sma::svip_brzina (line 4710)
L 07/01/2017 - 12:36:40: [FUN] Player out of range (0)

L 07/01/2017 - 12:36:40: [AMXX] Displaying debug trace (plugin "jb_mod.amxx&quot
L 07/01/2017 - 12:36:40: [AMXX] Run time error 10: native error (native "get_user_maxspeed&quot
L 07/01/2017 - 12:36:40: [AMXX] [0] jb_mod.sma::svip_brzina (line 4710)
L 07/01/2017 - 12:36:40: [FUN] Player out of range (0)


Why this happens ?
Sorry about this "&quot" things at the end.. Copied from teamspeak.

HamletEagle 07-01-2017 09:03

Re: Player out of Range
 
is_user_alive

InteX01 07-01-2017 09:14

Re: Player out of Range
 
Didnt know it can make errors like this

HamletEagle 07-01-2017 09:24

Re: Player out of Range
 
Lack of it can cause the errors.

Bugsy 07-01-2017 11:32

Re: Player out of Range
 
Quote:

Originally Posted by InteX01 (Post 2532817)
Didnt know it can make errors like this

It's not obvious based on the name of the native, but is_user_alive() has a check for a valid player id range.
Code:

static cell AMX_NATIVE_CALL is_user_alive(AMX *amx, cell *params) /* 1 param */
{
        int index = params[1];
       
        if (index < 1 || index > gpGlobals->maxClients)
        {
                return 0;
        }
        ...

You should have checking in place before calling vip_brzina(id) and svip_brzina(id)


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

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