Run time error 4: "Array index out of bounds"
#1

Hello , i open my server log and i se this:
PHP код:
[15:52:08] [debugRun time error 4"Array index out of bounds"
[15:52:08] [debug]  Attempted to read/write array element at index 65535 in array of size 50
[15:52:08] [debugAMX backtrace:
[
15:52:08] [debug#0 000be7e4 in public cmd_id (playerid=7, params[]=@003926a0 "3") at E:\V1-1.1.1\pawno\include\PPC_PlayerCommands.inc:5759
[15:52:08] [debug#1 native CallLocalFunction () from samp03svr
[15:52:08] [debug#2 00008c90 in public OnPlayerCommandText (playerid=7, cmdtext[]=@00392688 "/id 3") at E:\V1-1.1.1\pawno\include\izcmd.inc:112 
The command its this:
PHP код:
CMD:id(playeridparams[])
{
    new 
idstring[144];
    if(
sscanf(params"u"id))
        return 
SendClientMessage(playeridCOLOR_RED,"Use: /id [Nume/ID]");
    
format(stringsizeof(string), "Name:%s(%i) | Scor:%i | Class:%s | Admin:%i | VIP:%i"pName(id), id,APlayerData[id][PlayerScore], GetPlayerClassEx(id), APlayerData[id][PlayerLevel], APlayerData[id][VPlayerLevel]);
    
SendClientMessage(playeridGreystring);
    return 
1;

I need to check the invalid playerid id or something?
Reply
#2

This problem is already solved

https://sampforum.blast.hk/showthread.php?tid=628680
Reply
#3

Yes you need to check for INVALID_PLAYER_ID
PHP код:
CMD:id(playeridparams[]) 

    new 
idstring[144]; 
    if(
sscanf(params"u"id)) 
        return 
SendClientMessage(playeridCOLOR_RED,"Use: /id [Nume/ID]"); 
    if(
id != INVALID_PLAYER_ID)
    {
        
format(stringsizeof(string), "Name:%s(%i) | Scor:%i | Class:%s | Admin:%i | VIP:%i"pName(id), id,APlayerData[id][PlayerScore], GetPlayerClassEx(id), APlayerData[id][PlayerLevel], APlayerData[id][VPlayerLevel]); 
        
SendClientMessage(playeridGreystring); 
    }
    else 
        return 
SendClientMessage(playeridCOLOR_RED"Error: Invalid PlayerID/PlayerName.");
    return 
1

Reply
#4

This problem is already solved

https://sampforum.blast.hk/showthread.php?tid=628680
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)