27.07.2015, 21:36
Well, I'm using this for getting players total online time. I just wanted to ask is it good the way i am using? Cuz i have seen and heard gettime is best way. but i don't know how to save online time in gettime ways. Anyone post some codes?
PHP код:
forward TimeOnServer(); //Defining the public
public TimeOnServer() //calling the public for the timer
{
for(new i=0; i<MAX_PLAYERS; i++) //Looping through players
{
if(IsPlayerConnected(i)) //For me I rather use IsSpawned, but for most people who might not have IsSpawned Variable, use IsPlayerConnected
{
pData[i][pMinutes] ++; //Increasing pMinutes every 60 seconds.
if(pData[i][pMinutes] >= 60) //Checking if minutes reached 60. (one hour) pData[playerid][pVip] == 1
{
pData[i][pMinutes] =0; //Setting a new hour.
pData[i][pHours] ++; //Increasing online hour +1.
}
return 1;
}