Quote:
Originally Posted by SaiyanZ
I found the line if i remove the line the command works
any ideas what should i do to replace it with something else?
PHP 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; // <----- this line
format(str, 128, "SERVER: Object ID: %d - Created at your location - Index: %d", objectid, objects);
SendClientMessage(playerid, COLOR_RED, str);
}
return 1;
}
|
Why not try printing the contents of SpawnedObject[objects] into chat or something so you can see what value it has, and then from there figure out how it reaches said value?
The way I understand it, it seems you're giving that variable a value larger than 998, which is why you break out of the array's bounds.