/rac timer
#1

Код:
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 ?
Reply
#2

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.
Reply
#3

Thank you, i've got some errors first time but i fixed it.
Reply
#4

you're welcome
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)