CMD:respawncars(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], radius;
if(sscanf(params, "d", radius)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /respawncars [radius]");
if(radius < 1 || radius > 40)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Radius must be higher than 0 and lower than 41!");
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;
}
CMD:rac(playerid, params[])
{
if(AdminLevel[playerid] >=2)
{
if(PlayerInfo[playerid][aDuty] == 0) return SendClientMessage(playerid,GREY,"You are not on admin duty.");
new bool:vehicleused[MAX_VEHICLES];
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
{
vehicleused[GetPlayerVehicleID(i)] = true;
}
}
for(new i=1; i < MAX_VEHICLES; i++)
{
if(!vehicleused[i])
{
SetVehicleToRespawn(i);
}
}
new msg[128];
format(msg, sizeof(msg), "Admin %s (%d) has respawned all unused vehicles", PlayerName(playerid), playerid);
SendClientMessageToAll(COLOR_YELLOW, msg);
}else return SendClientMessage(playerid,GREY,"You are not an admin");
return 1;
}
CMD:respawnallcars(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] < 3) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
{
for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++) // vehicleids start at 1
{
SetVehicleToRespawn(i);
}
SendClientMessageEx(playerid, COLOR_GREY, "You have respawned all vehicles");
}
return 1;
}
|
This will respawn all unused vehicles:
PHP код:
|
|
[PHP]CMD:respawnallcars(playerid, params[])
Don't use this one: It will give you compiler errors because the user just copied and pasted his vehicle system command. |
CMD:respawnallcars(playerid, params[])
{
new string[128];
new vehicleid = GetPlayerVehicleID(playerid);
if (PlayerInfo[playerid][pAdmin] < 3) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
{
for(new i = 1, j = GetVehicleModel(vehicleid); i <= j; i++) // vehicleids start at 1
{
SetVehicleToRespawn(i);
format(string, sizeof(string), "You have respawned vehicle ID %d.", i);
SendClientMessageEx(playerid, COLOR_GREY, string);
}
}
return 1;
}