Hey Guys i need some help saving players game time and registered time with mysql
I want to know how to save them in the db for example (Unix_time) and what to do as a code for them into the script..
Ive A Gametime mode from a fellow forum memeber
PHP Code:
ew connectTime[MAX_PLAYERS], overallTime[MAX_PLAYERS];
public
OnPlayerConnect(playerid)
{
// Load your overall time and store it in
// overallTime[playerid]
connectTime[playerid] = gettime();
return 1;
}
public
OnPlayerDisconnect(playerid, reason)
{
overallTime[playerid] += (gettime() - connectTime[playerid]);
// Save overallTime[playerid];
return 1;
} // To get how many hours, minute, seconds..
overallTime[playerid] += (gettime() - connectTime[playerid]);
new
hours = floatround(overallTime[playerid] / 3600, floatround_tozero),
mins = floatround((overallTime[playerid] - hours*3600) / 60, floatround_tozero),
secs = overallTime[playerid] - (mins*60 + hours*3600); stock ConvertTime(SECONDS_)
{
new MINUTES_, HOURS_, DAYS_, String[200];
if(SECONDS_ > 59)
{
MINUTES_ = SECONDS_ / 60;
SECONDS_ = SECONDS_ - MINUTES_ * 60;
}
if(MINUTES_ > 59)
{
HOURS_ = MINUTES_ / 60;
MINUTES_ = MINUTES_ - HOURS_ * 60;
}
if(HOURS_ > 23)
{
DAYS_ = HOURS_ / 24;
HOURS_ = HOURS_ - DAYS_ * 24;
}
format(String, sizeof(String), "%02d Days, %02d Hours, %02d Minutes and %02d Seconds", DAYS_, HOURS_, MINUTES_, SECONDS_);
if(DAYS_ < 1) format(String, sizeof(String), "%02d Hours, %02d Minutes and %02d Seconds", HOURS_, MINUTES_, SECONDS_);
if(DAYS_ < 1 && HOURS_ < 1) format(String, sizeof(String), "%02d Minutes and %02d Seconds", MINUTES_, SECONDS_);
if(DAYS_ < 1 && HOURS_ < 1 && MINUTES_ < 1) format(String, sizeof(String), "%02d Seconds", SECONDS_);
return String;
}
Which is better? i want Gametime to be Days/Hours/Mins
Also Register Time format should be day/month/year
Could someone help me please,I would appreciate your help...
Aucun commentaire:
Enregistrer un commentaire