Meister Posted August 23, 2012 Group: Members Topic Count: 280 Topics Per Day: 0.06 Content Count: 841 Reputation: 17 Joined: 04/16/12 Last Seen: March 4, 2024 Share 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 Link to comment Share on other sites More sharing options...
1 shinnobie Posted August 24, 2012 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 12 Reputation: 1 Joined: 12/23/11 Last Seen: September 26, 2024 Share 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 Link to comment Share on other sites More sharing options...
Akkarin Posted August 23, 2012 Group: Forum Manager Topic Count: 282 Topics Per Day: 0.06 Content Count: 3144 Reputation: 1630 Joined: 03/26/12 Last Seen: Tuesday at 10:17 AM Share 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 Link to comment Share on other sites More sharing options...
Meister Posted August 23, 2012 Group: Members Topic Count: 280 Topics Per Day: 0.06 Content Count: 841 Reputation: 17 Joined: 04/16/12 Last Seen: March 4, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
Meister Posted August 24, 2012 Group: Members Topic Count: 280 Topics Per Day: 0.06 Content Count: 841 Reputation: 17 Joined: 04/16/12 Last Seen: March 4, 2024 Author Share Posted August 24, 2012 i don't see nothing wrong with a little bump and grind - *Bump hehe. Quote Link to comment Share on other sites More sharing options...
shinnobie Posted August 24, 2012 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 12 Reputation: 1 Joined: 12/23/11 Last Seen: September 26, 2024 Share 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 Link to comment Share on other sites More sharing options...
Meister Posted August 24, 2012 Group: Members Topic Count: 280 Topics Per Day: 0.06 Content Count: 841 Reputation: 17 Joined: 04/16/12 Last Seen: March 4, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
Meister Posted August 25, 2012 Group: Members Topic Count: 280 Topics Per Day: 0.06 Content Count: 841 Reputation: 17 Joined: 04/16/12 Last Seen: March 4, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
shinnobie Posted August 25, 2012 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 12 Reputation: 1 Joined: 12/23/11 Last Seen: September 26, 2024 Share 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 Link to comment Share on other sites More sharing options...
Meister Posted August 25, 2012 Group: Members Topic Count: 280 Topics Per Day: 0.06 Content Count: 841 Reputation: 17 Joined: 04/16/12 Last Seen: March 4, 2024 Author Share 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 Link to comment Share on other sites More sharing options...
vip53041 Posted May 8, 2013 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 52 Reputation: 0 Joined: 04/27/13 Last Seen: April 12, 2017 Share Posted May 8, 2013 i think its cool script i will try it today Thanks Quote Link to comment Share on other sites More sharing options...
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 emongLink to comment
Share on other sites
10 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.