28.03.2013, 13:23
here you got just edited your command a bit and made a stock for you
EDIT
Im Too Slow. someone posted already on top. but give this a try if the code above won't work.
pawn Код:
CMD:respawncars(playerid, params[])
{
new string[128], radius;
if (PlayerInfo[playerid][pAdmin] < 3) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
if(sscanf(params, "d", radius)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /respawncars [radius]");
if(radius < 1 || radius > 40) return endClientMessageEx(playerid, COLOR_WHITE, "Radius must be higher than 0 and lower than 41!");
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsVehicleEmpty(i) == 1)
{
RespawnNearbyVehicles(playerid, radius);
format(string, sizeof(string), "You have respawned all vehicles within a radius of %d.", radius);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
}
return 1;
}
//add this where all your stock is
stock IsVehicleEmpty(vehicleid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, vehicleid)) return 0;
}
return 1;
}
Im Too Slow. someone posted already on top. but give this a try if the code above won't work.