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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

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