/fixallvehicles or /repairallcars - 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: /fixallvehicles or /repairallcars (
/showthread.php?tid=499207)
/fixallvehicles or /repairallcars -
TheLastShadow - 07.03.2014
I want a command to repair all cars on the server . Sorry for my english. Thank's.
Re: /fixallvehicles or /repairallcars -
CutX - 07.03.2014
you'd have to loop trough all vehicles
pawn Код:
YCMD:repairall(playerid,params[],help)
{
if(help) return SendClientMessage(playerid,-1,"/repairall is used to repair every single vehicle on the server.");
//maybe do some admin-condition here
for(new i=0; i<MAX_VEHICLES; i++)
RepairVehicle(i);
SendClientMessageToAll(-1,"All vehicles have been repaired by an admin!");
}
instead of MAX_VEHICLES
you could also use
pawn Код:
stock GetMaxVehicles()
{
new iCount;
for(new i = 1; i < MAX_VEHICLES; ++i)
if(GetVehicleModel(i)) iCount++;
return iCount;
}
Re: /fixallvehicles or /repairallcars -
TheLastShadow - 07.03.2014
Can make this command with if(strcmp ..) ??
Re: /fixallvehicles or /repairallcars -
CrazyFrenzy - 07.03.2014
PHP код:
if (strcmp("/repairall", cmdtext, true, 9) == 0)
{
for(new i=0; i<MAX_VEHICLES; i++)
RepairVehicle(i);
SendClientMessageToAll(-1,"All vehicles have been repaired by an admin!");
return 1;
}