Help me
#1

Hey guys, how can i made a script when Admin go "On duty" to display time spended from admin on duty ..

For example : Admin Micho_Mkd is on duty ! [DutyTIME: 21hr:21min]
Here is a picture : http://prnt.sc/ezh4vy
Reply
#2

Quote:
Originally Posted by michomkd
View Post
Hey guys, how can i made a script when Admin go "On duty" to display time spended from admin on duty ..

For example : Admin Micho_Mkd is on duty ! [DutyTIME: 21hr:21min]
Here is a picture : http://prnt.sc/ezh4vy
PHP Code:
enum aduty
{
    
bool:isinduty,
    
dutysec,
    
dutymin
}
new 
admintime[MAX_PLAYERS][aduty];
//Global timer >> 
settimer("duty",1000,true);
forward duty();
public 
duty()
{
    for(new 
i;i<MAX_PLAYERS;i++)
    {
        if(
IsAnAdmin(i))
        {
            if(
admintime[i][isinduty])
            {
                if(
dutysec 60)
                {
                    
admintime[i][dutysec]++;
                }
                if(
dutysec == 60)
                {
                    
admintime[i][dutysec] = 0;
                    
admintime[i][dutymin]++;
                }
            }
        }
    }
    return 
1;

Reply
#3

Use gettime(). You don't even need any extra variables or timers. You probably already set a variable to 1 once a player goes on duty so just replace that 1 with gettime() without parameters. When player goes off duty (or when the duty time is requested) you do gettime() - yourDutyVariable[playerid] and that will give you the time in seconds for the current session which can then be added to the total. That can then be converted into minutes and hours as desired.
Reply
#4

Quote:
Originally Posted by Vince
View Post
Use gettime(). You don't even need any extra variables or timers. You probably already set a variable to 1 once a player goes on duty so just replace that 1 with gettime() without parameters. When player goes off duty (or when the duty time is requested) you do gettime() - yourDutyVariable[playerid] and that will give you the time in seconds for the current session which can then be added to the total. That can then be converted into minutes and hours as desired.
Can u add me on ********, i didn't get it :/

https://www.********.com/michomkd
Reply
#5

BUMP !
Reply
#6

BUMPP!
Reply
#7

He's saying instead of using the timer, you could simply use gettime and count how long they were on duty for.

You'd be storing the time the admin went on duty currently as a variable. The time overall that the player has been on duty would be included in the playerinfo enum/account info.

The current gettime would be compared to the onduty "start" of the current session, and added to the overall time.

When the admin goes off duty then that time would be added to the players account info.
Reply
#8

Quote:
Originally Posted by michomkd
View Post
BUMPP!
Hey, u can use gettime()

GetTime()
Reply
#9

Code:
if(PlayerInfo[playerid][pGameMaster] >= 1)
   {
        new sg1[128];
        new hour,minuite,second;
		gettime(hour,minuite,second);
        GameMasterDuty[playerid] = 1;
        GetPlayerName(playerid,sg1,MAX_PLAYER_NAME);
        SetPlayerColor(playerid,COLOR_DBLUE);
        SetPlayerHealth(playerid,999);
        SetPlayerArmour(playerid,999);
        SetPlayerSkin(playerid, 217);
        format(sg1,sizeof(sg1),"{f79d27}ScorpionWorld RolePlay | {FFFFFF}GameMaster %s e na dolznost.",sg1);
        SendClientMessageToAll(COLOR_WHITE,sg1);
    }
Is this okey ?
Reply
#10

Those hour minute second variables will only be visible IN that if statement, so close, but you'll need to learn a bit more.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)