Jump to content

ingame playtime npc hilfe


leeroy

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  04/28/12
  • Last Seen:  

ich will ein npc bauen der die ingamezeit zählt hier ist mein npc könnte mir bitte jemand helfen

 

Quote

-    script    timess    -1,{
OnInit:
initnpctimer;

OnPCLoginEvent:
times:
startnpctimer;

OnTimer1000:
set @sek,@sek+1;
if(@sek == 60){
    set @sek,0;
    set @min,@min+1;
}
if(@min == 60){
    set @min,0;
    set @stu,@stu+1;
}
if(@stu == 24){
    set @stu,0;
    set @day,@day+1;
}
if(@day == 365){
    set @day,0;
    set @yea,@yea+1;
}
setnpctimer 0;
goto times;

OnPCLogoutEvent:
setnpctimer 0;
stopnpctimer;

}

 

 

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   199
  • Joined:  05/03/13
  • Last Seen:  

Es ist wahrscheinlich deutlich einfacher, wenn du beim Login und Logout ein timestamp erstellst. Dann musst nur noch wenn der Char sich ausloggt die Differenz berechnen. Die berechnete Differenz rechnest du dann auf eine Char Variable drauf, die in der SQL DB liegt und fertig! 

Wenn jemand per command oder npc die Zeit checken will geht das mit dem timestamp ähnlich. 

Edited by Normynator
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  04/28/12
  • Last Seen:  

so gut bin ich noch nicht

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  04/28/12
  • Last Seen:  

wollt erst mal testen obs geht nun kommt das hier

 

new_2-1,49,76,4    script    timess    987,{
mes ""+@played+" Sekunden";
close;

OnPCLogoutEvent:    
    set @time2,gettimetick(0)/1000;
    set @played,@time2-@time;

OnPCLoginEvent:
    set @time,gettimetick(0)/1000;
}

mein server sagt

[Error]: script:run_script_main: infinity loop !

Edited by leeroy
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
Reply to this topic...

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