if(strcmp(cmd, "/resetcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
format(string, sizeof(string), "All cars have been respawned by admin");
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
}
for(new car = 1; car <= 1850; car++)
{
SetVehicleToRespawn(car);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You are not authorized to use this command.");
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/resetcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
format(string, sizeof(string), "INFO: All unused vehicles have been respawned.");
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
}
new bool:unwanted[CAR_AMOUNT];
foreach (Player,player)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
for(new car = 0; car < MAX_VEHICLES; car++)
{
if(!unwanted[car])
{
RespawnAllCars(car);
}
}
new bool:unwanted[MAX_VEHICLES];
for(new c =0; c < MAX_VEHICLES ;c++)
{
if(!unwanted[c])
{
SetVehicleToRespawn(c);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "WARNING: You do not have access to this command");
return 1;
}
}
return 1;
}
if(strcmp(cmd, "/resetcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
format(string, sizeof(string), "INFO: All unused vehicles have been respawned.");
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
}
new bool:unwanted[CAR_AMOUNT];
foreach (Player,player)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
for(new car = 0; car < MAX_VEHICLES; car++)
{
if(!unwanted[car])
{
RespawnAllCars(car);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "WARNING: You do not have access to this command");
return 1;
}
}
return 1;
}
Saw my mistake was tired last nighte HERE, get foreach.
pawn Код:
|