SA-MP Forums Archive
How to do this? - 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: How to do this? (/showthread.php?tid=630049)



How to do this? - Celmir - 08.03.2017

Hello guys! Firstly, I just want to say that thank you for your help that you're going to made.
Secondly, I have a problem how to make a paycheck or something that RP Gamemodes are making.
Like after 1 hour they'll receive a paycheck.
This is my includes: //And If you are using another includes add one.
Код:
// Includes
#include <a_samp>
#include <YSI/y_ini>
#include <sscanf2>
#include <zcmd>



Re: How to do this? - Toroi - 08.03.2017

So, you're asking for guidance or for a functional code to copy-paste?


Re: How to do this? - iLearner - 08.03.2017

Set a timer, with ticking internal of 1 hour, and in the function (which gets called once the timer ticks) make a for loop, (i use foreach though), and give them directly the paycheck or check if their connected time was enough to give them paycheck.

(https://sampwiki.blast.hk/wiki/NetStats_GetConnectedTime)
(https://sampwiki.blast.hk/wiki/SetTimer)


Re: How to do this? - JessThompson - 08.03.2017

Make a timer every that runs a function every minute for example

Make a enum for player info and have two values hours,mins then

Код:
PlayerPayDayT[playerid] = SetTimerEx("PlayerPayDay", 60000, true, "d", playerid);
Then do something like this

Код:
forward PlayerPayDay(playerid);
public PlayerPayDay(playerid)
{
	if(PlayerInfo[playerid][MINS] >= 60)
	{
		// PAYCHECK STUFF
		PlayerInfo[playerid][HOURS]++;
	}
	else
	{
		PlayerInfo[playerid][MINS]++;
	}

}



Re: How to do this? - Celmir - 08.03.2017

Thanks a lot! It's Working.