Individual player timers?
#5

Code:
new timer[MAX_PLAYERS];
Ex:

Code:
public OnPlayerConnect(playerid)
{
        timer[playerid] = SetTimerEx("fast",25000,1,"i",playerid);
        return 1;
}
The above code will call the function "fast(playerid)" (it's random) when a player connects and will repeat every 25 seconds.

We could have fun like so:

Code:
forward fast(playerid);
public fast(playerid)
{
        if(IsPlayerInAnyVehicle(playerid))
        {
                new veh = GetPlayerVehicleID(playerid);
                new Float:x,Float:y,Float:z;
                GetVehiceVelocity(veh,x,y,z);
                SetVehicleVelocity(veh,x+50,y,z);
        }
        return 1;
}
Now every 25 seconds it will check if the player is in a vehicle, will give him a boost!

If you have more players, it wouldn't be really wise to use per-player-timers. You could use a "for" loop every 25 seconds.
Reply


Messages In This Thread
Individual player timers? - by VictorMartinez - 21.07.2010, 00:49
Re: Individual player timers? - by Kar - 21.07.2010, 00:59
Re: Individual player timers? - by VictorMartinez - 21.07.2010, 01:01
Re: Individual player timers? - by Kar - 21.07.2010, 01:38
Re: Individual player timers? - by DJDhan - 21.07.2010, 02:58
Re: Individual player timers? - by VictorMartinez - 21.07.2010, 03:43

Forum Jump:


Users browsing this thread: 1 Guest(s)