Daily bonus.
#1

Hello.

I seem to have a problem here, regarding Daily Bonuses when the player logs into his account or registers.
Basically, every 24 hours, after the player logs in he will recieve score, money..
That's not a problem.
However i don't know how to check each 24 hours, i made a script which doesn't seem to be working.

The saving system is MySQL, but i think this can be done without saving, which i would prefer if possible.

Код:
function CheckDailyBonus(playerid)
{
	if(PInfo[playerid][TotalTime] % 24 == 0)
	{
		GivePlayerMoney(playerid, 50000);
		GivePlayerScore(playerid, 20);
		new string[128];
		format(string,sizeof(string),"[+] "CBLUE"%s(%i) has collected "CGREEN"Daily bonus"CBLUE".",GetPName(playerid),playerid);
		SendClientMessageToAll(COL_GREEN, string);
		ShowBonusTDs(playerid);
	}
	else
	{
		return 1;
	}
}
And then here i have the online time that's constantly counting.

Код:
TotalGameTime(playerid, &h = 0, &m = 0)
{
    PInfo[playerid][TotalTime] = ( (gettime() - PInfo[playerid][ConnectTime]) + (PInfo[playerid][PlayedHours]*60*60) + (PInfo[playerid][PlayedMins]*60) );
    h = floatround(PInfo[playerid][TotalTime] / 3600, floatround_floor);
    m = floatround(PInfo[playerid][TotalTime] / 60,   floatround_floor) % 60;
    return PInfo[playerid][TotalTime];
}
Any help appreciated.
Reply


Messages In This Thread
Daily bonus. - by xPirate - 20.07.2015, 10:27
Re: Daily bonus. [+REP] - by xVIP3Rx - 20.07.2015, 11:07
Re: Daily bonus. [+REP] - by xPirate - 20.07.2015, 11:12
Re: Daily bonus. [+REP] - by xPirate - 21.07.2015, 11:10

Forum Jump:


Users browsing this thread: 2 Guest(s)