/rac timer - 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: /rac timer (
/showthread.php?tid=268836)
/rac timer -
qUick1337 - 13.07.2011
Код:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 2)
{
SendClientMessage(playerid, 0x639EC5FF, "You are not authorized to use this command.");
return 1;
}
new bool:unwanted[CAR_AMOUNT];
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
for(new car = 1; car <= 500; car++)
{
if(!unwanted[car]) SetVehicleToRespawn(car);
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "All unused cars has been respawned by administrator %s",sendername);
SendClientMessageToAll(COLOR_RED,string);
}
return 1;
}
I want to add 10 sec timer .. how can i do that ?
Re: /rac timer -
erik019 - 13.07.2011
pawn Код:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 2)
{
SendClientMessage(playerid, 0x639EC5FF, "You are not authorized to use this command.");
return 1;
}
new bool:unwanted[CAR_AMOUNT];
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
}
SetTimerEx("rac",10000,false,"i",playerid);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "All unused cars has been respawned by administrator %s",sendername);
SendClientMessageToAll(COLOR_RED,string);
}
return 1;
}
Copy this at the end of your script.
pawn Код:
forward rac(playerid);
public rac(playerid)
{
for(new car = 1; car <= 500; car++)
{
if(!unwanted[car]) SetVehicleToRespawn(car);
}
}
You can try this...If you having problems with it, reply.
Re: /rac timer -
qUick1337 - 14.07.2011
Thank you, i've got some errors first time but i fixed it.
Re: /rac timer -
erik019 - 14.07.2011
you're welcome