Jump to content
  • 0
tmav94

Query_sql to check if the players is online

Question

3 answers to this question

Recommended Posts

  • 0

why use query_sql

you can use this method

.@acc_id = charid2rid(.@char_id);if (!.@acc_id){    debugmes "Char not online";    end;}//DO anything with .@char_id and .@acc_id here.(Character is Online)

Share this post


Link to post
Share on other sites
  • 0


This method is new for me...

 

why use query_sql

you can use this method

.@acc_id = charid2rid(.@char_id);if (!.@acc_id){    debugmes "Char not online";    end;}//DO anything with .@char_id and .@acc_id here.(Character is Online)

 

Look this other two:

query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE `char`.online=1") 

and:

if(isloggedin(getcharid(3))) 

They do the samething?

Share this post


Link to post
Share on other sites
  • 0

 

This method is new for me...

 

why use query_sql

you can use this method

.@acc_id = charid2rid(.@char_id);if (!.@acc_id){    debugmes "Char not online";    end;}//DO anything with .@char_id and .@acc_id here.(Character is Online)

 

Look this other two:

query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE `char`.online=1") 

and:

if(isloggedin(getcharid(3))) 

They do the samething?

No.

getcharid(3)

Means character is attached.

you can do something like

query_sql "SELECT `account_id` FROM `char` WHERE `char_id`='"+ .@char_id +"' AND `online`=1",.@acc_id;if (!.@acc_id){//CHARACTER IS OFFLINEend;}//CHARACTER IS ONLINE

but I recommend you to use charid2rid, as its efficient as compared to executing Queries.

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

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