30.04.2010, 15:15
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
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;
}