CMD:respawncars(playerid, params[]) { if (PlayerInfo[playerid][pAdmin] >= 2) { new string[128], radius; if(sscanf(params, "d", radius)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /respawncars [radius]"); if(radius < 1 || radius > 999999) { SendClientMessageEx(playerid, COLOR_WHITE, "Radius must be higher than 0 and lower than 999999!"); return 1; } RespawnNearbyVehicles(playerid, radius); format(string, sizeof(string), "You have respawned all vehicles within a radius of %d.", radius); SendClientMessageEx(playerid, COLOR_GREY, string); } else { SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!"); } return 1; }
Hello before I post any script, what happend if you use a timers to use all cars of your gamemodes, example :
|
CMD:carr(playerid, params[])
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
SetVehicleToRespawn(i);
}
return 1;
}
pawn Код:
|
CMD:carr(playerid, params[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
RemovePlayerFromVehicle(i);
}
}
for(new i = 0; i < MAX_VEHICLES; i++)
{
SetVehicleToRespawn(i);
}
return 1;
}
CMD:respawncars(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
for(new i=0; i<MAX_VEHICLES; i++)
{
new vehs;
foreach(Player, x)
{
if(GetPlayerVehicleID(x) == i)
{
vehs = 1;
}
}
if(!vehs)
{
SetVehicleToRespawn(i);
}
vehs = 0;
}
format(string, sizeof(string), "AdmCmd: %s has respawned all unused vehicles.", RPN(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, string);
return 1;
}
- Scanff
- foreach