Kill nearby vehicle - 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: Kill nearby vehicle (
/showthread.php?tid=434245)
Kill nearby vehicle -
Fell - 01.05.2013
Is there any admin command to kill nearby vehicles one by one? for example (/kcc - /killclosestcar) By using this command as an admin you kill the nearest vehicle to you. And then it gets respawned at its spawn point.
I appreciate all the help!
Thanks.
Re: Kill nearby vehicle -
Faisal_khan - 01.05.2013
Well try this and check if it works:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/kcc", cmdtext, true) == 0)
{
if(IsPlayerAdmin[playerid])
{
new Float:X, Float:Y, Float:Z, Float:X1, Float:Y1, Float:Z1;
GetPlayerPos(playerid, X, Y, Z);
for(new i = 0; i < MAX_VEHICLES; i++)
{
new vid = GetPlayerVehicleID(playerid);
if(GetVehicleDistanceFromPoint(i, X1, Y1, Z1) == 20)//here 20 is the radius
{
DestroyVehicle(i);
}
}
}
return 1;
}
return 0;
}