PewN Posted September 21, 2012 Group: Members Topic Count: 209 Topics Per Day: 0.04 Content Count: 892 Reputation: 27 Joined: 12/09/11 Last Seen: April 16, 2016 Share Posted September 21, 2012 how can i add a sql log here so i can see the total online time of all playerS? this code is from BrianL poring_c01,100,100,0 script TotalTimeOnline 910,{ mes "For your account, you have been online a total of:"; mes callsub(S_SecToTime, @login_time ? (#secs_online + (gettimetick(2)-@login_time)) : #secs_online); close; S_SecToTime: set .@seconds, getarg(0); set .@seconds, .@seconds - set(.@weeks, .@seconds / 604800)*604800; set .@str$, .@str$ + .@weeks+((.@weeks==1) ? " week":" weeks")+", "; set .@seconds, .@seconds - set(.@days, .@seconds / 86400)*86400; set .@str$, .@str$ + .@days+((.@days==1) ? " day":" days")+", "; set .@seconds, .@seconds - set(.@hours, .@seconds / 3600)*3600; set .@str$, .@str$ + .@hours+((.@hours==1) ? " hour":" hours")+", "; set .@seconds, .@seconds - set(.@mins, .@seconds / 60)*60; set .@str$, .@str$ + .@mins+((.@mins==1) ? " min":" mins")+", and "; set .@str$, .@str$ + .@seconds+((.@seconds==1) ? " second":" seconds"); return .@str$; OnPCLoginEvent: set @login_time, gettimetick(2); end; OnPCLogoutEvent: if (@login_time) set #secs_online, #secs_online + (gettimetick(2)-@login_time); end; } Quote Link to comment Share on other sites More sharing options...
Emistry Posted September 21, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2371 Joined: 10/28/11 Last Seen: Tuesday at 12:58 PM Share Posted September 21, 2012 you can try this if you want.... OnWhisperGlobal: if( query_sql("SELECT `value` FROM `global_reg_value` WHERE str='#secs_online' AND `account_id`='"+getcharid( 3,@whispervar0$ )+"'",.@Times$ ) ){ dispbottom "[ "+@whispervar0$+" Online Time : "; dispbottom callsub(S_SecToTime,atoi( .@Times$ )); }else{ dispbottom "Player not found / not online."; } end; just put it below your script.... then pm the NPC with a player name..... that player must be online... 1 Quote Link to comment Share on other sites More sharing options...
PewN Posted September 21, 2012 Group: Members Topic Count: 209 Topics Per Day: 0.04 Content Count: 892 Reputation: 27 Joined: 12/09/11 Last Seen: April 16, 2016 Author Share Posted September 21, 2012 oh ok thx! Quote Link to comment Share on other sites More sharing options...
Question
PewN
how can i add a sql log here so i can see the total online time of all playerS?
this code is from BrianL
Link to comment
Share on other sites
2 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.