Meister Posted August 23, 2012 Posted August 23, 2012 (edited) Anyone can share or make a src code in which.. 1. when using @gametime - command it will show how many minutes your account has played the game.. 2. when using @playtime - it will show how many minutes you have played from its first login.. example.. @gametime -- dispbottom > You have played 136 total. like the example above.. any question.. With this script or src modification. Do I need to add tables? like login minute? Thanks! Edited August 23, 2012 by emong Quote
1 shinnobie Posted August 24, 2012 Posted August 24, 2012 Hi! Sorry, I'm misunderstood your request Could you please try this then? GameTime will be saved once the command is called or players have log-out from the game. - script atcmd_gamestat -1,{ OnInit: bindatcmd("gametime","atcmd_gamestat::OnGameTime"); bindatcmd("playtime","atcmd_gamestat::OnPlayTime"); end; OnPlayTime: set .@time,(gettimetick(2) - @gs_playtime); set .@h,.@time / 3600; set .@m,.@time / 60 % 60; set .@s,.@time % 60; dispbottom "You have played "+.@h+"h "+.@m+"m and "+.@s+"s."; end; OnGameTime: set gs_gametime,@gs_gametime_t+(gettimetick(2) - @gs_playtime); //Save GameTime total set .@time,gs_gametime; set .@d,.@time / 86400 % 7; set .@h,.@time / 3600 % 24; set .@m,.@time / 60 % 60; set .@s,.@time % 60; dispbottom "You have played "+.@d+"d "+.@h+"h "+.@m+"m and "+.@s+"s total."; end; OnPCLoginEvent: set @gs_playtime,gettimetick(2); set @gs_gametime_t,gs_gametime; end; OnPCLogoutEvent: set gs_gametime,@gs_gametime_t+(gettimetick(2) - @gs_playtime); //Save GameTime total end; } 1 Quote
Akkarin Posted August 23, 2012 Posted August 23, 2012 Do you mean since the player logged in, or since the char was created? If it's since last login you could do it with either a timer or an sql query o.O Quote
Meister Posted August 23, 2012 Author Posted August 23, 2012 (edited) ayy. wait edited hehe. Sorry for the misunderstanding. and yeah.. its like this.. @gametime - is for the whole time the account has played.. @playtime - the time of the player from its first login.. Thanks! Do you mean since the player logged in, or since the char was created? If it's since last login you could do it with either a timer or an sql query o.O I have a question with the timer.. cause if I use timer. How will I use the @playtime command? Edited August 23, 2012 by emong Quote
Meister Posted August 24, 2012 Author Posted August 24, 2012 i don't see nothing wrong with a little bump and grind - *Bump hehe. Quote
shinnobie Posted August 24, 2012 Posted August 24, 2012 Try this... - script atcmd_gamestat -1,{ OnInit: bindatcmd("gametime","atcmd_gamestat::OnGameTime"); bindatcmd("playtime","atcmd_gamestat::OnPlayTime"); end; OnPlayTime: set .@min,(gettimetick(2) - gs_playtime) / 60; set .@sec,(gettimetick(2) - gs_playtime) % 60; dispbottom "You have played "+.@min+" min and "+.@sec+" sec."; end; OnGameTime: dispbottom "You have played "+gs_gametime+" total"; end; OnPCLoginEvent: set gs_gametime,gs_gametime+1; set gs_playtime,gettimetick(2); end; } Quote
Meister Posted August 24, 2012 Author Posted August 24, 2012 Try this... - script atcmd_gamestat -1,{ OnInit: bindatcmd("gametime","atcmd_gamestat::OnGameTime"); bindatcmd("playtime","atcmd_gamestat::OnPlayTime"); end; OnPlayTime: set .@min,(gettimetick(2) - gs_playtime) / 60; set .@sec,(gettimetick(2) - gs_playtime) % 60; dispbottom "You have played "+.@min+" min and "+.@sec+" sec."; end; OnGameTime: dispbottom "You have played "+gs_gametime+" total"; end; OnPCLoginEvent: set gs_gametime,gs_gametime+1; set gs_playtime,gettimetick(2); end; } wow fantastic! but something's wrong with the timer.. e.g. at first login (just seconds later).. when I used command @playtime: it will display "You have played for 1 min and 15 seconds" - even it didn't pass 1 minute yet.. and for the @gametime.. e.g. it doesn't add up. it is still 1 .. "You have played 1 total" .. how to set it with hr + min + sec? and if possible +days.. Thanks! Quote
Meister Posted August 25, 2012 Author Posted August 25, 2012 (edited) Hi! Sorry, I'm misunderstood your request Could you please try this then? GameTime will be saved once the command is called or players have log-out from the game. - script atcmd_gamestat -1,{ OnInit: bindatcmd("gametime","atcmd_gamestat::OnGameTime"); bindatcmd("playtime","atcmd_gamestat::OnPlayTime"); end; OnPlayTime: set .@time,(gettimetick(2) - @gs_playtime); set .@h,.@time / 3600; set .@m,.@time / 60 % 60; set .@s,.@time % 60; dispbottom "You have played "+.@h+"h "+.@m+"m and "+.@s+"s."; end; OnGameTime: set gs_gametime,@gs_gametime_t+(gettimetick(2) - @gs_playtime); //Save GameTime total set .@time,gs_gametime; set .@d,.@time / 86400 % 7; set .@h,.@time / 3600 % 24; set .@m,.@time / 60 % 60; set .@s,.@time % 60; dispbottom "You have played "+.@d+"d "+.@h+"h "+.@m+"m and "+.@s+"s total."; end; OnPCLoginEvent: set @gs_playtime,gettimetick(2); set @gs_gametime_t,gs_gametime; end; OnPCLogoutEvent: set gs_gametime,@gs_gametime_t+(gettimetick(2) - @gs_playtime); //Save GameTime total end; } Papeng! Thanks! Working great! BUT there's a problem for @gametime.. e.g. When the server restart or I run ./athena-start stop and re run it agian. The @gametime also disappears.. How to solve it? Edited August 25, 2012 by emong Quote
shinnobie Posted August 25, 2012 Posted August 25, 2012 @emong, @gametime only saved data when player called the command or he/she log-out from the game. I'm not sure whether it would be good to put a timer to save gametime on each online player. If you do @kickall before close the server, I think it would trigger the OnPCLogoutEvent and save gametime variable. Quote
Meister Posted August 25, 2012 Author Posted August 25, 2012 thanks for the explanation. So if I randomly close the server the variable isn't save and there is that possibility that the save data for that variable will be lost? Quote
vip53041 Posted May 8, 2013 Posted May 8, 2013 i think its cool script i will try it today Thanks Quote
Question
Meister
Anyone can share or make a src code in which..
1. when using @gametime - command it will show how many minutes your account has played the game..
2. when using @playtime - it will show how many minutes you have played from its first login..
example..
@gametime --
dispbottom > You have played 136 total.
like the example above..
any question..
With this script or src modification. Do I need to add tables? like login minute? Thanks!
Edited by emong10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.