DeleteUnusedCars cmd? - 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: DeleteUnusedCars cmd? (
/showthread.php?tid=169467)
DeleteUnusedCars cmd? -
xZacharias - 19.08.2010
hello
the thread name says it all. I tried to make an "deleteallcars" command but it dont works
Код:
if(strcmp(cmd, "/deleteallcars", true) == 0 || strcmp(cmd, "/dac", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][Level] >= 4)
{
new bool:unwanted[128];
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
for(new car = 91; car >= 90; car++)
{
if(!unwanted[car]) DestroyVehicle(car);
}
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER: All unused cars deleted by %s.", pname);
SendClientMessageToAll(COLOR_WHITE,string);
}
else
{
SendClientMessage(playerid, red, "you are not authorized to use this command!");
return 1;
}
}
return 1;
}
can somebody say me what I did wrong? or can somebody make me an working script?
Re: DeleteUnusedCars cmd? -
Jefff - 19.08.2010
pawn Код:
if(strcmp(cmd, "/deleteallcars", true) == 0 || strcmp(cmd, "/dac", true) == 0)
{
if(PlayerInfo[playerid][Level] >= 4)
{
for(new veh=1; veh<MAX_VEHICLES; veh++)
if(GetVehicleModel(veh))
for(new player; player<MAX_PLAYERS; player++)
if(IsPlayerConnected(player))
if(!IsPlayerInVehicle(player,veh))
DestroyVehicle(veh);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "SERVER: All unused cars deleted by %s.",pname);
SendClientMessageToAll(COLOR_WHITE,string);
}else SendClientMessage(playerid, red, "you are not authorized to use this command!");
return 1;
}
Re: DeleteUnusedCars cmd? -
xZacharias - 19.08.2010
thanks it works but I wanted to delete all cars ID 91+
should i just change the veh=1 to veh=91 or something?
/edit: i tried it, now it works very well thanks mate
Re: DeleteUnusedCars cmd? -
Matthias_ - 19.08.2010
Use MAX_VEHICLES?