.:: [ PAYDAY HELP ]::. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: .:: [ PAYDAY HELP ]::. (
/showthread.php?tid=145019)
.:: [ PAYDAY HELP ]::. -
DarkPower - 30.04.2010
I have one qestion about payday system, i wanna to make when play connect to start timer what will count player online time and if he dissconnect and connect again to CONTINUE that timer and after 30min, he get 1000$ > can you help me.....
Re: .:: [ PAYDAY HELP ]::. -
CAR - 30.04.2010
I think this works (not tested)
It will create a file with the name of the player and saves the seconds he played, if seconds are 30 it will be set to 0 and the player gets $1000
pawn Код:
new SecondsPlayed[MAX_PLAYERS];
forward PayDay();
OnGameModeInit()
{
SetTimer("PayDay", 1000, true);
return 1;
}
public PayDay()
{
for(new i=0; i<MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
{
new playername[24];
GetPlayerName(i, playername, sizeof(playername));
if(!dini_Exists(udb_encode(playername))) { dini_Create(udb_encode(playername)); }
SecondsPlayed[playerid] = dini_Int(udb_encode(playername), "secondsplayed");
SecondsPlayed[playerid]++;
if(SecondsPlayed[playerid] == 30)
{
GivePlayerMoney(playerid, 1000);
SecondsPlayed[playerid] = 0;
}
dini_IntSet(udb_encode(playername), "secondsplayed", SecondsPlayed[playerid]);
}
return 1;
}