Strange Crashdetect Warning [HELP]!
#1

hello guys i was testing my lscnr server with my admins and something just camed up on the console which says
Код:
[21:08:59] [debug] Run time error 4: "Array index out of bounds"
[21:08:59] [debug]  Accessing element at index 65535 past array upper bound 499
[21:08:59] [debug] AMX backtrace:
[21:08:59] [debug] #0 000232d0 in public cmd_rob () from lscnr_mysql.amx
[21:08:59] [debug] #1 native CallLocalFunction () [00471e90] from samp-server.exe
[21:08:59] [debug] #2 0000bfd4 in public OnPlayerCommandText () from lscnr_mysql.amx
how could i have that problem on public cmd_rob () even i dont have that callback. as i notice it might be on
/rob ( ID ) so here's the command please take a look if there is any problem that Crashdetect would tell me that warning

/Rob Command
pawn Код:
CMD:rob(playerid,params[])
{
    new string[128];
    new ID;
    //
    if(sscanf(params, "u", ID)) return SendClientMessage(playerid,COLOR_RED_ERROR,"USAGE: /rob ( ID )");
    if(IsSpawned[playerid] != 1) return  SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You must be alive and spawned in order to be able to use this command.");
    if(IsFrozen[playerid] == 1) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You have been frozen by a Server Administrator. You cannot use this command.");
    if(OnDuty[ID] == 1) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You cannot use this command on this player because they are in Administrator mode.");
    if(IsKidnapped[playerid] == 1) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You are kidnapped. You cannot use this command.");
    if(GetPlayerInterior(playerid) > 0) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You cannot rob someone inside an Interior");
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"{FF0000}[ERROR]: {FFFFFF}The player ID (%d) is not connected to the server. You cannot rob them",ID);
        return SendClientMessage(playerid,-1,string);
    }
    if(IsPlayerCloseToPlayer(playerid,ID,3.5) == 0)
    {
        format(string,sizeof(string),"{FF0000}[ERROR]: {FFFFFF}%s(%d) is too far away. You cannot reach him to rob him.",PlayerName(ID),ID);
        return SendClientMessage(playerid,-1,string);
    }
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You cannot rob someone while in a vehicle. Exit the vehicle first.");
    if(GetPlayerState(ID) == PLAYER_STATE_DRIVER || GetPlayerState(ID) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You cannot rob someone while they are in a vehicle. Get them to exit the vehicle first.");
    if(playerid == ID) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You cannot rob yourself, how can you even manage that?");

    if(IsSpawned[ID] != 1)
    {
        format(string,sizeof(string),"{FF0000}[ERROR]: {FFFFFF}%s(%d) is not spawned. You cannot rob dead people ..",PlayerName(ID),ID);
        return SendClientMessage(playerid,-1,string);
    }
    if(IsFrozen[ID] == 1)
    {
        format(string,sizeof(string),"{FF0000}[ERROR]: {FFFFFF}%s(%d) is frozen by a Server Administrator. You cannot rob them.",PlayerName(ID),ID);
        return SendClientMessage(playerid,-1,string);
    }
    if(AttemptedToRobRecently[playerid] >= 1) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You are too tired from your last rob attempt. Please wait before robbing again.");
    if(HasRobbedRecently[playerid] >= 1) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}You are too tired from the last person you robbed. Please wait before robbing again.");
    if(GetPlayerMoney(ID) <= 0) return SendClientMessage(playerid,-1,"{FF0000}[ERROR]: {FFFFFF}That player has no money in their pockets. What would be the point in robbing them?");
    new crand = random(100);
    if(crand <= 30)
    {
        SendClientMessage(playerid,COLOR_RED_ERROR,"Rob attempt failed. The player slipped out of your grasp.");
        AttemptedToRobRecently[playerid] =35;
        return 1;
    }
    if(HasSecureWallet[ID] > 1)
    {
        SendClientMessage(playerid,COLOR_RED_ERROR,"You cannot rape this person. He have Security Wallet.");
        HasSecureWallet[ID] = HasSecureWallet[ID] - 1;
        format(string, sizeof(string), "%s has attempted to rob you, you now have %d Security Wallet left.", PlayerName(playerid),HasSecureWallet[ID]);
        SendClientMessage(ID, -1, string);
        AttemptedToRobRecently[playerid] =25;
        return 1;
    }
    if(IsPlayerCloseToPlayer(playerid,ID,3.5) == 1 && crand > 30)
    {
        new current_zone = player_zone[playerid];
        new mrand =random(GetPlayerMoney(ID));
        SendClientMessage(playerid,COLOR_GREY,"[[_Player Robbed_]]");
        format(string,sizeof(string),"You have robbed $%d from %s(%d). Careful they dont come after you!",mrand,PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_RED,string);

        GivePlayerMoney(playerid,mrand);
        IncreaseWantedLevel(playerid,8);
        HasRobbedRecently[playerid] =180;
        IncreasePlayerScore(playerid,3);

        SendClientMessage(ID,COLOR_GREY,"[[_Robbed_]]");
        format(string,sizeof(string),"You have had $%d robbed from you by %s(%d). Kill them for your money back or run!",mrand,PlayerName(playerid),playerid);
        SendClientMessage(ID,COLOR_RED,string);
        GivePlayerMoney(ID,-mrand);

        format(string,sizeof(string),"[DISPATCH] Robbery: %s(%d) has robbed $%d from %s(%d). Location: %s.",PlayerName(playerid),playerid,mrand,PlayerName(ID),ID,zones[current_zone][zone_name]);
        SendClientMessageToAllCops(string);
        format(string,sizeof(string),"{FFDA00}[ROBBERY]:{FFFFFF} %s(%d) has robbed $%d from %s(%d).",PlayerName(playerid), playerid,mrand,PlayerName(ID),ID);
        SendClientMessageToAll(-1, string);
        return 1;
    }
    return 1;
}
Reply
#2

something wrong in your public OnPlayerCommandText not the command rob
Reply
#3

Yves. i dont use

public OnPlayerCommandText and i deleted it on my script. do i need to put that back?
Reply
#4

hmm thats werid its showing the backtrace on that but try putting it back if it works then i have no clue why it wont let you remove OnPlayerCommandText and your using CMD: need any help pm me
Reply
#5

My admin are now as-sleep. so i might test it tommorow. thanks. ill try the one you said
Reply
#6

yea same happend to me that it was ongamemodeinit and my mysql_Init(); was making the error till i did
// mysql_Init(); it works but my register wont pop up for some reason good luck with that anyways
Reply
#7

The "u" specifier of sscanf returns INVALID_PLAYER_ID (which is 65535) when the player is not found but the code doesn't check for this condition before evaluating OnDuty[ID] - that's probably where the error comes from.

Quote:
Originally Posted by Yves
Посмотреть сообщение
something wrong in your public OnPlayerCommandText not the command rob
It's actually the other way around - the most recent thing is always on top. In this case: OnPlayerCommandText -> CallLocalFunction -> cmd_rob.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)