Quote:
Originally Posted by Zume-Zero
pawn Код:
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:
pawn Код:
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; }
|
Got it to work. Thank you both guys, you were really helpful.
Also in the code shown above you need to make the "RespawnNearbyVehicles" a stock and change the %d and %i to %f, because it is a float abviously.
Cheers!