#3

Using SetTimerEx.

PHP код:
//Under the playing being told he's paying $50
//You'll be needing a public variable for each player. i.e. new BikeRentTimer[MAX_PLAYERS];
BikeRentTimer[playerid] = SetTimerEx("PayPerMinute"60000 /*60000(miliseconds) = 1 minute*/true"i"playerid); 
Now you create a new function (for the code that will be run every 1 minute, i.e. take $50)

PHP код:
forward PayPerMinute(playerid);
public 
PayPerMinute(playerid)
{
    
GivePlayerMoney(playerid, -50);

This timer will loop until you use KillTimer.

When the player stops renting the bike (when they get off or something, whatever you choose) you'll need to kill the timer like so

PHP код:
 KillTimer(BikeRentTimer[playerid]); 
And that will stop the timer from running, otherwise it will just keep running every 1 minute.


Hope this helps
Reply


Messages In This Thread
Rent - by Dimkata - 17.02.2019, 21:12
Re: Rent - by Dimkata - 18.02.2019, 16:36
Re: Rent - by ItsRobinson - 18.02.2019, 18:40
Re: Rent - by Dimkata - 18.02.2019, 20:14

Forum Jump:


Users browsing this thread: 1 Guest(s)