[HELP] About reset cars - 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: [HELP] About reset cars (
/showthread.php?tid=537883)
[HELP] About reset cars -
bnnb8 - 18.09.2014
Hello I need to ask something,
I want to do a command it reset cars with but it's need to reset unused cars how can I do it?
Re: [HELP] About reset cars -
Eth - 18.09.2014
pawn Код:
CMD:respawncars(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;//if the player is not an admin.
new string[120];//the string used to format messages
format(string,sizeof(string),"[ADMIN] Admin %s[%d] has respawned all the UnOccuiped cars",GetName(playerid),playerid);//we will format the message
SendClientMessageToAll(COLOR_RED,string);//then we will send it to everyone online
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(i);
}
}
return 1;
}
getname function:
put it anywhere in your gamemode:
pawn Код:
stock GetName(playerid)
{
new pName[68];
GetPlayerName(playerid, (pName), sizeof(pName));
return pName;
}
Re: [HELP] About reset cars -
bnnb8 - 20.09.2014
Quote:
Originally Posted by Eth
pawn Код:
CMD:respawncars(playerid,params[]) { if(!IsPlayerAdmin(playerid)) return 0;//if the player is not an admin. new string[120];//the string used to format messages format(string,sizeof(string),"[ADMIN] Admin %s[%d] has respawned all the UnOccuiped cars",GetName(playerid),playerid);//we will format the message SendClientMessageToAll(COLOR_RED,string);//then we will send it to everyone online for(new i=0;i<MAX_VEHICLES;i++) { if(IsVehicleOccupied(i) == 0) { SetVehicleToRespawn(i); } } return 1; }
getname function:
put it anywhere in your gamemode:
pawn Код:
stock GetName(playerid) { new pName[68]; GetPlayerName(playerid, (pName), sizeof(pName)); return pName; }
|
thanks it's works!