SA-MP Forums Archive
Create function rentacar - 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)
+--- Thread: Create function rentacar (/showthread.php?tid=610526)



Create function rentacar - Thinh - 25.06.2016

Please help me make car rental functions . When you get one car from the rental place , you lose 1000SAD and run 60 minutes. After 60 minutes rental car , the car will automatically spawn back again
Please help me


Re: Create function rentacar - Mencent - 25.06.2016

Hello!

You must use "GivePlayerMoney" to remove 1000$.
PHP код:
GivePlayerMoney(playerid,-1000); 
* When you have your own money script then you have to use your own function.

Then you have to start a timer (SetTimerEx) when the player rent a car (interval: 60000; repeating: 1).
PHP код:
SetTimerEx("OnPlayerRentACar",60000,1,"i",playerid); 
The timer can look like this.
In the callback of the timer you have to increase a variable +1.
Then you have to make an if query:
PHP код:
if(thevariable[playerid] == 60)
{
       
//60 minutes

I hope my english is understandable!


Re: Create function rentacar - Thinh - 25.06.2016

Help me create ? i don't understand


Re: Create function rentacar - Mencent - 25.06.2016

Do you have still a code?