rendered paste body---- this function should tell me how many cars in total and how many different ones are in the gCars array, since i dont want to cross the limits ----
---- Command: ----
if(strcmp(cmd, "/countcars", true) == 0) {
new ids[] = 0;
for(new i=0; i<sizeof(gCars); i++)
{
if (in_array(gCars[i][modelid], ids) == 0) ids[] = gCars[i][modelid];
}
format(string, sizeof(string), "Total Cars: %d ; Different ones: %d", sizeof(gCars), sizeof(ids)); // variable string is defined earlier
SendClientMessage(playerid, COLOR_YELLOW, string);
}
---- in_array function: ----
stock in_array(integer, array[])
{
new result = 0;
for(new j=0; j<sizeof(array); j++) {
if (integer == array[j]) result = 1;
}
return result;
}
---- gCars array looks like this: ----
enum CarSpawnInfo {
modelid,
Float:x,
Float:y,
Float:z,
Float:angle,
interiorid,
name[32]
};
new gCars[][CarSpawnInfo] =
{
{ 445, -2443.772949, 2242.602539, 4.682964, 180.306793, 0, "" },
{ 463, -2452.932617, 2242.159667, 4.318945, 178.957595, 0, "" },
---- the error: ----
C:\samp-server-0.2.1-win32\gamemodes\fun.pwn(930) : error 029: invalid expression, assumed zero
C:\samp-server-0.2.1-win32\gamemodes\fun.pwn(930) : warning 215: expression has no effect
C:\samp-server-0.2.1-win32\gamemodes\fun.pwn(942) : warning 224: indeterminate array size in "sizeof" expression (symbol "")
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.