hours and minutes wont work
#1

On Top
pawn Код:
enum pData
{
    AdminLevel,
    Cash,
    Score,
    vip,
    Hour,
    Minute
};
new PlayerData[MAX_PLAYERS][pData];
when player disconnect
pawn Код:
dini_IntSet(file, "Hour", PlayerData[playerid][Hour]);
        dini_IntSet(file, "Minute", PlayerData[playerid][Minute]);
when the player registers
pawn Код:
PlayerData[playerid][Hour] = dini_Int(file, "Hour");
            PlayerData[playerid][Minute] = dini_Int(file, "Minute");
player log in
pawn Код:
PlayerData[playerid][Hour] = dini_Int(file, "Hour");
            PlayerData[playerid][Minute] = dini_Int(file, "Minute");
forward
pawn Код:
forward OnlineTimeUpdate(playerid);
public OnlineTimeUpdate(playerid)
{
    PlayerData[playerid][Minute] ++;
    if(PlayerData[playerid][Minute] == 60)
    {
        PlayerData[playerid][Hour] ++;
        PlayerData[playerid][Minute] = 0;
    }
}
when i do /stats after 3minute it shows HOURS: 0 MINUTES : 0
pawn Код:
format(string, sizeof(string), " {FFB300}Name: %s \n\n Adminlevel: %d %s\n\n Vip: %d\n\n Cash: %d\n\n Score: %d\n\n Hours: %i\n\n Minutes: %i",Name,PlayerData[playerid][AdminLevel],AdminRank,PlayerData[playerid][vip],GetPlayerMoney(playerid),GetPlayerScore(playerid),PlayerData[playerid][Hour],PlayerData[playerid][Minute]);
    ShowPlayerDialog(playerid,10000,DIALOG_STYLE_MSGBOX, "Stats",string,"Close","");
Reply
#2

hmmm... i havent a clue. im just posting because im bored. sorry.
Reply
#3

Quote:
Originally Posted by sciman001
Посмотреть сообщение
hmmm... i havent a clue. im just posting because im bored. sorry.
Go post somthing useless somewhere else.

@Tanush, Try the post above with the timer, If you already have/timer doesnt work) then Post back, Illl help ya all i can.
Reply
#4

lol. sorry.
Reply
#5

Thanks it work
Reply
#6

No problem tanush. Need any help PM me.
Reply
#7

Wait i found something out please help, the minute increases by 1 after 2-5minutes
Reply
#8

*bump*
Reply
#9

Is your timer started when the player spawns and killed when he disconnects? Also can you post the SetTimer part?
Reply
#10

Why are you using a timer? Just save how many milliseconds that player has been on the server.
pawn Код:
public OnPlayerConnect(playerid)
{
    PlayerData[playerid][Time] = GetTickCount();
}
public OnPlayerDisconnect(playerid,reason)
{
    dini_IntSet(file, "Time", dini_Int(file, "Time")+(GetTickCount()-PlayerData[playerid][Time]));
}
Then dini_Int(file, "Time") will return how many milliseconds the player has been on the server (use a time converter to change it to hours/minutes)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)