[Help] Saving Character online time. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Saving Character online time. (
/showthread.php?tid=94781)
[Help] Saving Character online time. -
Mowgli - 01.09.2009
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
Re: [Help] Saving Character online time. -
Yuryfury - 01.09.2009
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
Re: [Help] Saving Character online time. -
brett7 - 01.09.2009
on player connect get time on player leave get time and get the differnece
Re: [Help] Saving Character online time. -
snoob - 01.09.2009
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.
Re: [Help] Saving Character online time. -
Abernethy - 01.09.2009
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
|