lil question
#1

How can i make if player does /stats, it will show how long the player played in the server by hours and time?
Reply
#2

Save the hours and time in Pvars, And then show them with a formmated text..
Reply
#3

Sorry i don't know how to use PVar that much :P
Reply
#4

OnPlayerConnect.

pawn Code:
SetTimerEx("UpdateTime", 60*1000, 1, "i", playerid);
Function.

pawn Code:
forward UpdateTime(playerid);
public UpdateTime(playerid)
{
    SetPVarInt(playerid, "Time", GetPVarInt(playerid, "Time")+1);
    return 1;
}
Reply
#5

Lil question,how i make how many minutes player played in /stats xD?
Reply
#6

Is stats a dialog?
Reply
#7

yes
pawn Code:
CMD:stats(playerid, params[])
{
    new AdminRank[30];
    new string[128];
    new Name[MAX_PLAYER_NAME];
    switch (PlayerData[playerid][AdminLevel])
    {
    case 0: format(AdminRank, 30, "(Not Admin)");
    case 1: format(AdminRank, 30, "(Server Moderator)");
    case 2: format(AdminRank, 30, "(Global Moderator)");
    case 3: format(AdminRank, 30, "(Administrator)");
    case 4: format(AdminRank, 30, "(Server Owner)");
    }
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    format(string, sizeof(string), " {FFB300}Name: %s \n\n Adminlevel: %d %s\n\n Vip: %d\n\n Cash: %d\n\n Score: %d",Name,PlayerData[playerid][AdminLevel],AdminRank,PlayerData[playerid][vip],GetPlayerMoney(playerid),GetPlayerScore(playerid));
    ShowPlayerDialog(playerid,10000,DIALOG_STYLE_MSGBOX, "Stats",string,"Close","");
    return 1;
}
Reply
#8

Just create the new line in the text.

(Time %i)

And for its variable put
pawn Code:
GetPVarInt(playerid, "Time");
Reply
#9

thanks for everything but i have problem with saving it on connect,
on top
pawn Code:
enum pData
{
    AdminLevel,
    Cash,
    Score,
    vip,
    Hour,
    Minute
};
new PlayerData[MAX_PLAYERS][pData];
on player connect
pawn Code:
SetTimerEx("Hours",3600000, 1, "i", playerid);
    SetTimerEx("Minutes", 60*1000, 1, "i", playerid);
OnPlayerDisconnect
pawn Code:
dini_IntSet(file, "Hours",PlayerData[playerid][Hour]);
        dini_IntSet(file, "Minutes",PlayerData[playerid][Minute]);
When player registers
pawn Code:
dini_IntSet(file, "Hours",PlayerData[playerid][Hour]);
            dini_IntSet(file, "Minutes",PlayerData[playerid][Minute]);
when player loggs
pawn Code:
SetPVarInt(playerid,"Minutes",dini_Int(file, "Minutes"));
            SetPVarInt(playerid,"Hours",dini_Int(file, "Hours"));
and forward/public
pawn Code:
forward Hours(playerid);
public Hours(playerid)
{
    SetPVarInt(playerid, "Hours", GetPVarInt(playerid, "Hours")+1);
    return 1;
}
forward Minutes(playerid);
public Minutes(playerid)
{
    SetPVarInt(playerid, "Minutes", GetPVarInt(playerid, "Minutes")+1);
    return 1;
}
Reply
#10

Quote:
Originally Posted by -Rebel Son-
View Post
OnPlayerConnect.

pawn Code:
SetTimerEx("UpdateTime", 60*1000, 1, "i", playerid);
You shouldn't create a new infinitely repeating timer every time a player joins the server...
Reply
#11

still please help me with saving
Reply
#12

please help, i only need help with saving stats
Reply
#13

Don't bump like that, you have to wait FORTY EIGHT hours first.

And search for account system tutorials instead of spamming the forums with your "lil questions."
Reply
#14

Torrans Account system saves time, Just like the example i gave you. Now. Quit spamming the forum/repeated bumping. It wont help you get replys.
Reply
#15

i already have an account saving, i just only need help with how to save the PVar. please help
Reply
#16

*bump*
Reply
#17

Edit:
i hate your signature...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)