Array index out of bounds
#1

commands were working find until i complied with ysi v4 now they just send SERVER:Unknown command msg and creates the object,
the console:
Code:
[18:18:49] [debug] Run time error 4: "Array index out of bounds"
[18:18:49] [debug]  Attempted to read/write array element at index 1032 in array of size 996
[18:18:49] [debug] AMX backtrace:
[18:18:49] [debug] #0 0001de20 in public cmd_ocreate (2, 347436) in AdminSys.amx
[18:18:49] [debug] #1 native CallLocalFunction () in sampsvr-port_177
[18:18:49] [debug] #2 000006d8 in public OnPlayerCommandText (2, 347380) in AdminSys.amx
Code:
CMD:ocreate(playerid, params[])
{
    if(PlayerInfo[playerid][Level]<3) return SendClientMessage(playerid, COLOR_RED, "SERVER: You're not allowed to use this command");
	new objectid;
    if(sscanf(params,"d", objectid)) return SendClientMessage(playerid,COLOR_RED,"Usage:/ocreate [object id]");
    if(objectid < 321 || objectid > 19999) return SendClientMessage(playerid,COLOR_RED,"SERVER: Object ID not found.");
    {
        objects++;
        objectsid[objects]=objectid;
        new Float:X, Float:Y, Float:Z, str[128];
        GetPlayerPos(playerid, X, Y, Z);
        SpawnedObject[objects] = CreateDynamicObject(objectid, X, Y, Z+1, 0, 0, 0);
		ObjectSpawned[SpawnedObject[objects]] = 1;
		format(str, 128, "SERVER: Object ID: %d - Created at your location - Index: %d", objectid, objects);
		SendClientMessage(playerid, COLOR_RED, str);
    }
    return 1;
}
Reply


Messages In This Thread
Array index out of bounds - by SaiyanZ - 03.04.2019, 16:32
Re: Array index out of bounds - by raydx - 03.04.2019, 16:48
Re: Array index out of bounds - by Viggo - 03.04.2019, 17:12
Re: Array index out of bounds - by v1k1nG - 03.04.2019, 17:50
Re: Array index out of bounds - by SaiyanZ - 04.04.2019, 12:42
Re: Array index out of bounds - by raydx - 04.04.2019, 12:58
Re: Array index out of bounds - by Pottus - 06.04.2019, 03:16
Re: Array index out of bounds - by Markski - 06.04.2019, 05:07
Re: Array index out of bounds - by SaiyanZ - 06.04.2019, 12:30
Re: Array index out of bounds - by Markski - 06.04.2019, 14:19
Re: Array index out of bounds - by Y_Less - 06.04.2019, 14:46

Forum Jump:


Users browsing this thread: 3 Guest(s)