Respawning allcars - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Respawning allcars (
/showthread.php?tid=444937)
Respawning allcars -
LonMihawk - 19.06.2013
pawn Код:
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 > 500)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Radius must be higher than 0 and lower than 500!");
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;
}
this my my cmd for respawning cars when i do /respawncars with radius of 500 the car that has a people inside is being respawned how can i make it unrespawn when there's a player inside the car?
Re: Respawning allcars -
Kindred - 19.06.2013
Can you please show the function RespawnNearbyVehicles?
You can use this stock when you loop through all the vehicles to respawn them.
pawn Код:
stock IsVehicleOccupied(vehicleid)
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerVehicleID(i) == vehicleid) return 1;
else return 0;
}
}
}