13.03.2012, 12:23
I'm working on my gamemode from 0, and i want to make really good level system based on hours of playing, is there a way to make hours of playing and save it to .ini file? help please
enum pInfo
{
pTime
};
new ShitInfo[MAX_PLAYERS][pInfo];
new timer;
OnGameModeInit()
{
timer = SetTimer("CheckTime",60000,1);
return 1;
}
OnGameModeExit()
{
KillTimer(timer);
return 1;
}
forward CheckTime()
Public CheckTime()
{
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
ShitInfo[i][pTime]++;
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/onlinetime", cmdtext, true) == 0)
{
new string[256];
format(string,256,"( ! ) You have been spent %d minutes on server",ShitInfo[playerid][pTime]);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
return 0;
}
new Hour, Min, Sec;
gettime(Hour, Min, Sec);
new Hour;
gettime(Hour);
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/onlinetime", cmdtext, true) == 0)
{
new string[256];
new Hour;
gettime(Hour);
format(string,256,"( ! ) You have been spent %d Hours on server",ShitInfo[playerid][pTime]Hour);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
return 0;
}