Clear cars but only the ones abandoned - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Clear cars but only the ones abandoned (
/showthread.php?tid=209636)
Clear cars but only the ones abandoned -
kin - 11.01.2011
pawn Код:
if(strcmp(cmdtext,"/clearcars")==0)
{
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,magenta,"This command is not avaliable to you!");
{
SendClientMessageToAll(denim,"[SYSTEM]: All cars have been deleted!");
//if(!IsPlayerInAnyVehicle(players[playerid]))
//{
for(new veh;veh < MAX_VEHICLES; veh++)
{
DestroyVehicle(veh);
}
//}
}
return 1;
}
ok well my goal is to make it so if any player is in a vehicle it wont delete their vehicle but it deletes every single othr vehicle that is un occupied. Now my friend did this and i am trying to do it on my own, but seeing as im too stupid i need your help. Please give me code snippets that you think will help me complete it. Do not give me the whole script i do not want spoon fed, thank you.
Re: Clear cars but only the ones abandoned -
_rAped - 11.01.2011
pawn Код:
if(strcmp(cmdtext,"/clearcars")==0)
{
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,magenta,"This command is not avaliable to you!");
{
SendClientMessageToAll(denim,"[SYSTEM]: All cars have been deleted!");
for(new veh;veh < MAX_VEHICLES; veh++)
{
if(!IsVehicleInUse(veh)) DestroyVehicle(veh);
}
}
return 1;
}
Then add this somewhere:
pawn Код:
stock IsVehicleInUse(vehicleid)
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerVehicleID(i) == vehicleid)
return true;
}
}
return false;
}
Credits to whoever made the stock I think it's Sacky.
Re: Clear cars but only the ones abandoned -
kin - 13.01.2011
mmk ty
:P