Raised This Month: $ Target: $400
 0% 

Player out of range (0) [ERROR]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 01-04-2013 , 15:03   Player out of range (0) [ERROR]
Reply With Quote #1

Code:
L 01/04/2013 - 21:42:22: Start of error session.
L 01/04/2013 - 21:42:22: Info (map "ze_area51_lg") (file "addons/amxmodx/logs/error_20130104.log")
L 01/04/2013 - 21:42:22: [FUN] Player out of range (0)
L 01/04/2013 - 21:42:22: [AMXX] Run time error 10 (plugin "weaponmen.amxx") (native "give_item") - debug not enabled!
L 01/04/2013 - 21:42:22: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 01/04/2013 - 22:03:22: Start of error session.
L 01/04/2013 - 22:03:22: Info (map "ze_jurassickpark3_lg") (file "addons/amxmodx/logs/error_20130104.log")
L 01/04/2013 - 22:03:22: [FUN] Player out of range (0)
L 01/04/2013 - 22:03:22: [AMXX] Displaying debug trace (plugin "weaponmen.amxx")
L 01/04/2013 - 22:03:22: [AMXX] Run time error 10: native error (native "give_item")
L 01/04/2013 - 22:03:22: [AMXX]    [0] gunmenu.sma::roundstart (line 39)
PHP Code:
register_event"HLTV""roundstart""a""1=0""2=0" );

// stuff

public roundstart()
{
    static 
iPlayers32 ], iNumi;
    
get_playersiPlayersiNum );
    
    for( 
0iNumi++ )
    {
        if(( 
is_user_aliveiPlayers] ) ) )
        {
            
menu_displayiPlayers], g_Menu);
            
strip_user_weapons(iPlayers[i]);
            
give_itemiPlayers[i], "weapon_knife" ); // line 39
        
}
    }

Why is Player out of range (0) ?

Edit:

I have already searched for the problem but checking if is_user_connected didn't work.

Last edited by bLacK-bLooD; 01-04-2013 at 15:18.
bLacK-bLooD is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-04-2013 , 15:48   Re: Player out of range (0) [ERROR]
Reply With Quote #2

if (x < 1 || x > gpGlobals->maxClients) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \

so your id is incorrect... but is_user_alive check if ID is correct. so I should you to create new variable to store id

PHP Code:

public roundstart()
{
    static 
iPlayers32 ], iNumi;
    
get_playersiPlayersiNum );
    new 
player_id;
    for( 
0iNumi++ )
    {
        
player_id=iPlayers];
        if(( 
is_user_aliveplayer_id ) ) )
        {
            
menu_displayplayer_idg_Menu);
            
strip_user_weapons(player_id);
            
give_itemplayer_id"weapon_knife" ); // line 39
        
}
    }

__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 01-04-2013 , 15:54   Re: Player out of range (0) [ERROR]
Reply With Quote #3

Got it, thanks. It's working now but for some reason because of this plugin some chat messages duplicate (it shows the same message twice) and i don't have any idea why.
bLacK-bLooD is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-04-2013 , 15:57   Re: Player out of range (0) [ERROR]
Reply With Quote #4

post sma
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 01-04-2013 , 16:00   Re: Player out of range (0) [ERROR]
Reply With Quote #5

Now i changed the map and everything is fine, no duplicate messages.

Do you mind if i add you on skype for further chatting?
bLacK-bLooD is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-04-2013 , 16:02   Re: Player out of range (0) [ERROR]
Reply With Quote #6

yes ok. this is offtopic.
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-04-2013 , 22:02   Re: Player out of range (0) [ERROR]
Reply With Quote #7

Quote:
Originally Posted by AngeIII View Post
so I should you to create new variable to store id
Not required and will not fix any errors. It is just an optimization. FYI.
__________________
fysiks is offline
twix_p
Member
Join Date: Jul 2011
Old 01-04-2013 , 23:01   Re: Player out of range (0) [ERROR]
Reply With Quote #8

PHP Code:
#include < hamsandwich >
public plugin_init()
    
RegisterHamHam_Spawn"player""OnSpawn");

public 
OnSpawniPlayer )
{
    if ( 
is_user_aliveiPlayer ) )
    {
            
menu_displayiPlayerg_Menu);
/* 
             You can strip weapons when he choice a gun from menu, if he do.

            strip_user_weapons(iPlayer);
            give_item( iPlayer "weapon_knife" ); */
    
}

twix_p is offline
LeeanAndNeka
Senior Member
Join Date: Feb 2012
Location: Argentina ♥
Old 01-05-2013 , 02:40   Re: Player out of range (0) [ERROR]
Reply With Quote #9

PHP Code:
#include < amxmodx >

#define is_valid_player(%1) (1 <= %1 <= g_maxplayers)

new g_maxplayers

public plugin_init() {

    
g_maxplayers get_players()
}

public 
roundstart()
{
    static 
iPlayers32 ], iNumi;
    
get_playersiPlayersiNum );
    
    for( 
0iNumi++ )
    {
        if( 
is_valid_playeriPlayers] ) )
        {
            
menu_displayiPlayers], g_Menu);
            
strip_user_weapons(iPlayers[i]);
            
give_itemiPlayers[i], "weapon_knife" )
        }
    }

LeeanAndNeka is offline
Send a message via MSN to LeeanAndNeka Send a message via Skype™ to LeeanAndNeka
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 01-05-2013 , 03:17   Re: Player out of range (0) [ERROR]
Reply With Quote #10

Quote:
Originally Posted by twix_p View Post
PHP Code:
#include < hamsandwich >
public plugin_init()
    
RegisterHamHam_Spawn"player""OnSpawn");

public 
OnSpawniPlayer )
{
    if ( 
is_user_aliveiPlayer ) )
    {
            
menu_displayiPlayerg_Menu);
/* 
             You can strip weapons when he choice a gun from menu, if he do.

            strip_user_weapons(iPlayer);
            give_item( iPlayer "weapon_knife" ); */
    
}

Thank you, this is easier i think. I also took in consideration your advice and stripped weapons when the player chose them from the menu.
bLacK-bLooD 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 13:45.


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