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

Код:
[22:20:48] [debug] Run time error 4: "Array index out of bounds"
[22:20:48] [debug]  Accessing element at index 100 past array upper bound 99
[22:20:48] [debug] AMX backtrace:
[22:20:48] [debug] #0 00032a78 in public cmd_createfuelstation () from server.amx
[22:20:48] [debug] #1 native CallLocalFunction () [00472e50] from samp-server.exe
[22:20:48] [debug] #2 00008618 in public OnPlayerCommandText () from server.amx
my error cmd:

Код:
CMD:createfuelstation(playerid, params[])
{
        new unit, string[128];
        if(sscanf(params, "d", unit)) return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /createfuelstation [UnitPrice]");
        else if(PlayerData[playerid][AdminLevel] < 4) return SendUnathorizedMessage(playerid);
		new id = SpawnedFuels++;
  		new Float: X, Float: Y, Float: Z;
        GetPlayerPos(playerid, X, Y, Z);
        Fuels[id][FSX] = X;
        Fuels[id][FSY] = Y;
        Fuels[id][FSZ] = Z ;
        Fuels[id][FSUnitPrice] = unit;
        mysql_format(Mysql_users, query, sizeof(query), "INSERT INTO `"DEGALINES_LENTELE"` (`FSPickupID`, `FSX`, `FSY`, `FSZ`, `FSUnitPrice`) VALUES ('%i', '%f', '%f', '%f', '%i')", id, X, Y, Z, unit);
		mysql_tquery(Mysql_users, query, "", "");
    	Fuels[id][FSPickupID] = CreateDynamicPickup(1650, 23,  X, Y, Z+1, 0, -1, -1, 150.0);
   		format(string, sizeof(string), "You have created a fuel station(ID: %d) and set the unit price to %d (X = %f | Y = %f | Z = %f).",id, unit, X, Y, Z);
    	SendClientMessage(playerid, -1, string);
        return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)