[HELP] command shop
#1

Hello when some player near shop type /shop server crashed and it says


Run time error 4: "Array index out of bounds"
[12:31:51] [debug] Accessing element at negative index -1
[12:31:51] [debug] AMX backtrace:
[12:31:51] [debug] #0 000dd708 in public cmd_shop (0x00000009, 0x01988554)


here is that command

pawn Код:
CMD:shop(playerid,params[])
{
    if(IgracLogiran[playerid] != 1)
    {
        SCM(playerid,COLOR_GRAD2,"{FFFFFF}[{F81414}G-Protect{FFFFFF}] {C3C3C3}Morate biti logirani za koristenje ove komande!");
        return 1;
    }
    new x;
    for(new i = 19; i < 22; i++) here I check if the player is near a shop of bussines which is from id 19 to 22
    {
        if(IsPlayerInRangeOfPoint(playerid,4.0,SFBussinesInfo[i][sfenterX],SFBussinesInfo[i][sfenterY],SFBussinesInfo[i][sfenterZ]))
        {
            x++;
            if(SFBussinesInfo[NearShop[playerid]][sfProducts] <= 0) return GameTextForPlayer(playerid,"~r~there's no products here anymore",5000,1);
            NearShop[playerid] = i;
            ShowPlayerDialog(playerid,229,DIALOG_STYLE_LIST,"Dobrodosli na Kiosk","{FFFFFF}Bon od 50$\n{FFFFFF}Bon od 100$\n{FFFFFF}Bon od 150$\n{FFFFFF}Bon od 200$\n{FFFFFF}Buket Cvijeca(20$)\n{FFFFFF}Upaljac(10$)\n{FFFFFF}Cigare(17$)\n{FFFFFF}Coca-Cola(5$)","Kupi","Odustani");
            break;
        }
    }
    if(x == 0) return SCM(playerid,COLOR_GRAD2,"{F81414}[Greska!] {C3C3C3}you are not near shop!");
    return 1;
}
Reply


Messages In This Thread
[HELP] command shop - by Luca12 - 18.06.2014, 10:15
Re: [HELP] command shop - by Konstantinos - 18.06.2014, 10:20
Re: [HELP] command shop - by Luca12 - 18.06.2014, 10:21
Re : [HELP] command shop - by S4t3K - 18.06.2014, 10:21
Re: [HELP] command shop - by Konstantinos - 18.06.2014, 10:30

Forum Jump:


Users browsing this thread: 3 Guest(s)