Time played not showing correctly
#1

Greetings. I'm back with another server problem. The problem is, whenever a player types /stats on the server, their time played doesn't go up at all. I looked up the HoursPlayed and MinutesPlayed variables in the GM and I only found them in /stats, /buyadmin and /buyvip. I don't know what to do and where to add these variables to fix this problem. Thanks in advance.

Here's the script:

pawn Код:
CMD:stats(playerid, params[])
{
    new afile[10000], targetid, str[1950], str2[1950], str3[1950], P1Register[4], P1Logged[15], sLine[400];
    new PName[MAX_PLAYER_NAME];
    if (isnull(params)) targetid = playerid;
    else targetid = strval(params);
    new aranktext[36],kranktext[36];
    if(kArank[targetid] == 1) { kranktext = "Newbie"; }
    else if(kArank[targetid] == 2) {  kranktext = "AdvancedKiler"; }
    else if(kArank[targetid] == 3) {  kranktext = "BabyKiller"; }
    else if(kArank[targetid] == 4) {  kranktext = "Psycho"; }
    else if(kArank[targetid] == 5) {  kranktext = "The Nigga"; }
    else if(kArank[targetid] == 6) {  kranktext = "The Killer"; }
    else if(kArank[targetid] == 7) {  kranktext = "Master Killer"; }
    else if(kArank[targetid] == 8) {  kranktext = "Monster Killer"; }
    else if(kArank[targetid] == 9) {  kranktext = "Destroyer"; }
    else if(kArank[targetid] == 10) {  kranktext = "Pro Shooter"; }
    else if(kArank[targetid] == 11) {  kranktext = "Hitman"; }
    else if(kArank[targetid] == 12) {  kranktext = "Imunity Killer"; }
    else if(kArank[targetid] == 13) {  kranktext = "Elite Killer"; }
    else if(kArank[targetid] == 14) {  kranktext = "Leader Killer"; }
    else if(kArank[targetid] == 15) {  kranktext = "The Best Killer"; }
    else if(kArank[targetid] == 16) {  kranktext = "Legendary"; }

    if(aArank[targetid] == 0) { aranktext = "Member"; }
    else if(aArank[targetid] == 1) { aranktext = "Helper"; }
    else if(aArank[targetid] == 2) {  aranktext = "Helper"; }
    else if(aArank[targetid] == 3) {  aranktext = "Mini Moderator"; }
    else if(aArank[targetid] == 4) {  aranktext = "Moderator"; }
    else if(aArank[targetid] == 5) {  aranktext = "Master Moderator"; }
    else if(aArank[targetid] == 6) {  aranktext = "Administrator"; }
    else if(aArank[targetid] == 7) {  aranktext = "Junior Administrator"; }
    else if(aArank[targetid] == 8) {  aranktext = "Senior Administrator"; }
    else if(aArank[targetid] == 9) {  aranktext = "Master Administrator"; }
    else if(aArank[targetid] == 10) {  aranktext = "Master Administrator"; }
    else if(aArank[targetid] == 11) {  aranktext = "Co-Owner"; }
    else if(aArank[targetid] == 12) {  aranktext = "Owner"; }
   
    if(IsPlayerConnected(targetid)) {
    GetPlayerName(targetid, PName, MAX_PLAYER_NAME);
    format(afile,sizeof(afile),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)));
    if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: Nu aveti cont pe server! Va rugam inregistrati-va! <'/register [password]'>.");
    if(fexist(afile)) P1Register = "Yes"; else P1Register = "No";
    if(PlayerInfo[ playerid ][LoggedIn] == 1) P1Logged = "{00ff00}Yes"; else P1Logged = "{FC0303}No";
    format(sLine, sizeof(sLine), "{fff000}+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+");
    format(str3, sizeof(str3), "{FC8403}*{037BFC}Player Money: {ffffff}$%d \n{FC8403}*{037BFC}Player Visits: {ffffff}%d \n{FC8403}*{037BFC}Coins: {ffffff}%d \n\n", GetPlayerMoney( targetid ), PInfo[ targetid ][ Visits ], PlayerInfo[ targetid ][ Coins ]);
    format(str2, sizeof(str2), "{FC8403}*{037BFC}Skin: {ffffff}%d\n{FC8403}*{037BFC}Registered: %s \n{FC8403}*{037BFC}Logged: %s \n{FC8403}*{037BFC}Score: {ffffff}%d \n{FC8403}*{037BFC}Admin Level: {ffffff}[ ({037bfc}%d{ffffff}) {037bfc}%s{ffffff} ] \n{FC8403}*{037BFC}V.I.P Level: {ffffff}%d\n%s%s", GetPlayerSkin( targetid ), P1Register, P1Logged, GetPlayerScore( targetid ), PlayerInfo[ targetid ][ Level ], aranktext, pVipInfo[ targetid ][ Vip ], str3, sLine);
    format(str, sizeof(str), "%s \n{FC0303}%s{00ff00}'s Stats \n \n {FC8403}*{037BFC}Time Played: \n {ffffff}%d {FC8403}*{ff0000}Hours\n{00ddff} %02d {FC8403}*{ff0000}Minutes \n {fc8403}*{037bfc}Killer Rank: {ffffff}({037bfc}%s{ffffff}} \n{FC8403}*{037BFC} Player Kills: {ffffff}%d \n{FC8403}*{037BFC}Player Deaths: {ffffff}%d\n%s", sLine, PName, PInfo[ targetid ][ HoursPlayed ], PInfo[ targetid ][ MinutesPlayed ], kranktext, PlayerInfo[ targetid ][ Kills ], PlayerInfo[ targetid ][ Deaths ], str2);
    return ShowPlayerDialog(playerid, 758, 0, ""B"Electro"YE"-"R"Stunt {037BFC}Player Stats", str, "Ok", "Cancel");
    } else return SendClientMessage(playerid, red, "Player Not Connected!");
}
Reply
#2

Find anything related to "HoursPlayed" and "MinutesPlayed" enum

There should be something that increases then every minute/second, if there isn't any then you should make it.

Also check if "Time played" and "Hours Playerd" is increasing while you're playing..
Reply
#3

How do I make it?
Reply
#4

Two ways, Use a timer to increase the Hours/Minutes every Hour/Minute or use timestamps..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)