Jump to content

script - zuletzt online


Bayne

Recommended Posts


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   0
  • Joined:  04/23/13
  • Last Seen:  

gibt es eine möglichkeit im script anzufragen wann jmd zuletzt online war?

 

ala:

 

GM bob - offline - zuletzt online: DD/MM//JJ HH:MM

GM bos - online

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  764
  • Reputation:   220
  • Joined:  11/14/11
  • Last Seen:  

Ob jemand online ist:

 

query_sql("SELECT `online` FROM `char` WHERE `char_id` = " + getcharid(0), .@online);
if(.@online)
   mes "online";
else
   mes "offline";
 

Wann sich jemand zuletzt eingeloggt hat (leider nur Account basiert mölich):

 

query_sql("SELECT `lastlogin` FROM `login` WHERE `account_id` = " + getcharid(3), .@lastlogin$);
mes "zuletzt online: " + .@lastlogin$;
 

Sollte so funzen... habs nur schnell dahin getippelt.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   0
  • Joined:  04/23/13
  • Last Seen:  

vielen dank erstmal ;)

werds nach der arbeit heut antest ;)

 

 

EDIT: Danke nochmals, habs ein wenig abändern müssen aber nun gehts ;)

auchgleich gut zu wissen wie man sql_datenbank einträge abfragt ;)

Edited by Bayne
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  181
  • Reputation:   53
  • Joined:  04/07/13
  • Last Seen:  

Alternativ könnte das auch so gehen:

query_sql(
    "SELECT `c`.`online`, DATE_FORMAT(`l`.`lastlogin`, '%d.%m.%Y') as date, DATE_FORMAT(`l`.`lastlogin`, '%H:%i') as time "
    + "FROM `char` c, `login` l "
    + "WHERE `l`.`account_id` = " + getcharid(3) + " AND `c`.`char_id` = " + getcharid(0)
    , .@online, .@date$, .@time$
);
if (.@online) {
    mes "Online";
} else {
    mes "Offline - zuletzt online am " + .@date$ + " um " + .@time$ + " Uhr";
}

So selektierst du beide Werte in einem Query und formatierst das Datum und die Uhrzeit in eine lesbarere Form.

(Anmerkung: Das Skript findet den Status des aktuellen Spielers heraus. Du musst die beiden getcharid-Funktionen durch die Account- bzw. Char-ID des Chars ersetzen, der überprüft werden soll.)

Edited by DeadlySilence
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...