CMD:respawncars(playerid, params[]) { if (PlayerInfo[playerid][pAdmin] >= 3) { new string[128], radius; if(sscanf(params, "d", radius)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /respawncars [radius]"); if(radius < 1 || radius > 10000) { SendClientMessageEx(playerid, COLOR_WHITE, "Radius must be higher than 0 and lower than 1000!"); 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; }
Here is the command +REP if helped
Код:
RespawnNearbyVehicles(playerid, radius); |
for(new i = 1, j = GetVehiclePoolSize(); i <= j; i++)
{
if(IsVehicleStreamedIn(i, playerid))
{
SetVehicleToRespawn(i);
}
}
stock RespawnNearbyVehicles(playerid, Float:radi) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); for(new i=1; i<MAX_VEHICLES; i++) { if(GetVehicleModel(i)) { new Float:posx, Float:posy, Float:posz; new Float:tempposx, Float:tempposy, Float:tempposz; GetVehiclePos(i, posx, posy, posz); tempposx = (posx - x); tempposy = (posy - y); tempposz = (posz - z); if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) { SetVehicleToRespawn(i); } } } } Command: CMD:arearespawn(playerid, params[]) { new Float:radius; if(playerVariables[playerid][pAdminLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!"); if(sscanf(params, "f", radius)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/arearespawn [Radius in Meters]"); if(radius < 1 || radius > 40)return SendClientMessage(playerid, -1, "Dot radio (1 - 40)"); RespawnNearbyVehicles(playerid, radius); format(szMessage, sizeof(szMessage), "You have respawned all cars within the radius of %f meters.", radius); SendClientMessage(playerid, COLOR_NICESKY, szMessage); format(szMessage, sizeof(szMessage), "AdmCmd:{FFFFFF} %s just performed an area respawn with the radius of %f meters.", playerVariables[playerid][pAdminName], radius); submitToAdmins(szMessage, COLOR_HOTORANGE); return 1; }