OnlineTime counter Problem - 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: OnlineTime counter Problem (
/showthread.php?tid=528743)
OnlineTime counter Problem -
GShock - 29.07.2014
pawn Код:
forward OnlineTime(playerid);
public OnlineTime(playerid)
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
PlayerInfo[i][Minutes]++;
if (PlayerInfo[i][Minutes] >= 60)
{
PlayerInfo[i][Minutes] = 0;
PlayerInfo[i][Hours]++;
new string[128];
new RandomPay = random(50000 - 10000) + 10000;
GivePlayerMoney( playerid, RandomPay );
format(string, sizeof(string), " [PAYDAY] You Have Got Paycheck Of => $%i", RandomPay);
SendClientMessage(i, COLOR_WHITE, string);
}
}
}
return 1;
}
^ This msg is set to show up every 60 minutes of player's in-game time.
Here is the timer for this.
pawn Код:
OnlineTime = SetTimerEx("OnlineTime", 60000, true, "i", playerid);
But for some reason it shows up every 15-20 minutes. Also the players onlinetime increase 1 minute in like 30 seconds. -_-
Anyone wanna help out? I
+Rape for helping me :>
Re: OnlineTime counter Problem -
Stanford - 29.07.2014
Alright, you need to do a player variables instead of this OnlineTime use
and it should work as charm.
do not forget to add
pawn Код:
new OnlineTime[MAX_PLAYERS];
at the top of your script.