[Help] Saving Character online time.
#1

Hello, Ive seen a lot of Stunt script with /gametime and you see your hour/Minutes of online time and i need that for my script, im looking for stunt scripts that might have it and i searched for it on search, i cannot find it but i will keep looking, if anyone knows where i can get this, that will be very helpfull.

also, on another note, if anyone knows a good /time command tutorial or FS, that would be helpful
Reply
#2

here is a quick one I made up :P

pawn Код:
#include <a_samp>

forward GameTime(playerid);

new gtm[MAX_PLAYERS] = 0;
new gth[MAX_PLAYERS] = 0;
public OnPlayerConnect(playerid)
{
    SetTimerEx("GameTime",60000,1,"i",playerid);
    return 1;
}

public GameTime(playerid)
{
    if(gtm[playerid]<60)
    {
      gtm[playerid]++;
    }
    if(gtm[playerid] == 60)
    {
      gth[playerid]++;
      gtm[playerid] = 0;
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/gametime", cmdtext, true, 10) == 0)
    {
        new string[128];
        format(string,sizeof(string),"You Have Been On This Server For %i hours and %i minutes!",gth[playerid],gtm[playerid]);
        SendClientMessage(playerid,COLOR,string);
        return 1;
    }
    return 0;
}
NOT TESTED
Reply
#3

on player connect get time on player leave get time and get the differnece
Reply
#4

Quote:
Originally Posted by Mowgli
Hello, Ive seen a lot of Stunt script with /gametime and you see your hour/Minutes of online time and i need that for my script, im looking for stunt scripts that might have it and i searched for it on search, i cannot find it but i will keep looking, if anyone knows where i can get this, that will be very helpfull.

also, on another note, if anyone knows a good /time command tutorial or FS, that would be helpful
hi
i did an fs that will save the total played time for a player in a file...
using the fs you can do /time or /time ID ...
get it there http://snoob-community.wikispaces.com/OnlineTime.pwn
or on pastebin http://pawno.pastebin.com/d32b00abb
its based on a 1 minute timer...
the 4 Function should be easy to use in your GM or FS.
i hope this will help.

many time people told me i should use "dini" or "dudb" to read/write to file, but i try to always do my script using native a_samp include only.
Reply
#5

Time function
by Abernethy
pawn Код:
forward ShowPlayerTime(playerid);

public ShowPlayerTime(playerid)
{
    new string[128];
    new year,month,day; getdate(year, month, day);
    new hour,minute,second; gettime(hour,minute,second);
     format(string, sizeof(string), " The current Date is %d/%d/%d Time: %d:%d:%d", day, month ,year, hour, minute, second);
    SendClientMessage(playerid, 0x40a5ecFF, string);
    return true;
}
pawn Код:
if (strcmp("/time", cmdtext, true) == 0)
    {
    ShowPlayerTime(playerid);
    return true;
    }
Edit: This is a reply to
Quote:

also, on another note, if anyone knows a good /time command tutorial or FS, that would be helpful

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)