[HELP] Timer on Respawnallcars? - 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: [HELP] Timer on Respawnallcars? (
/showthread.php?tid=126041)
[HELP] Timer on Respawnallcars? -
FreddeN - 06.02.2010
Hello guys and girls, I need help to make a timer on /respawnallcars.
Код:
if(strcmp(cmd, "/respawnallcars", true) == 0 || strcmp(cmd, "/rac", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][Admin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use that 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 <= 268; 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;
}
It should be 30 seconds and then the cars should respawn.
Thanks for all answers
Re: [HELP] Timer on Respawnallcars? -
boelie - 06.02.2010
Do you realy want this to work with a command ? because you could use 'AddStaticVehicleEx ' and set
that to 30
Re: [HELP] Timer on Respawnallcars? -
FreddeN - 06.02.2010
Quote:
Originally Posted by boelie
Do you realy want this to work with a command ? because you could use 'AddStaticVehicleEx ' and set
that to 30
|
When a admin types /respawnallcars it should like say "WARNING: 30 seconds before respawn"
Re: [HELP] Timer on Respawnallcars? -
Mobster11 - 07.02.2010
ive got a code that checks if anyones in the car but i dont think its what you want
public CarCleaner(vehicleid)
{
for(new i; i < MAX_VEHICLES; i++)
{
if(!IsVehicleInUse(vehicleid))
{
SetVehicleToRespawn(i);
}
}
printf("Cars Cleaned!");
}
IsVehicleInUse(vehicleid){
new temp;
for(new i=0;i<200;i++){
if(IsPlayerConnected(i) && IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i)==PLAYER_STATE_DRIVER){
temp++;
}
}
if(temp > 0){ return true; } else return false;
}
the function above isnt made by me.
the timer is made by me