Jump to content
  • 0

Editing this Script?


PewN

Question


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

how can i add a sql log here so i can see the total online time of all playerS?

this code is from BrianL :D


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;
}

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2351
  • Joined:  10/28/11
  • Last Seen:  

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...

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

oh ok thx!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...