Jump to content
Bayne

script - zuletzt online

Recommended Posts

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

Ob jemand online ist:

 

query_sql("SELECT `online` FROM `char` WHERE `char_id` = " + getcharid(0), [email protected]);
if([email protected])
   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), [email protected]$);
mes "zuletzt online: " + [email protected]$;
 

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

Link to comment
Share on other sites

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

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)
    , [email protected], [email protected]$, [email protected]$
);
if ([email protected]) {
    mes "Online";
} else {
    mes "Offline - zuletzt online am " + [email protected]$ + " um " + [email protected]$ + " 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...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.