22.12.2013, 03:39
pawn Код:
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);
}
}
}
}
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, "d", 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 %i meters.", radius);
SendClientMessage(playerid, COLOR_NICESKY, szMessage);
format(szMessage, sizeof(szMessage), "AdmCmd:{FFFFFF} %s just performed an area respawn with the radius of %i meters.", playerVariables[playerid][pAdminName], radius);
submitToAdmins(szMessage, COLOR_HOTORANGE);
return 1;
}

