Query_sql to check if the players is online

tmav94

New member
Messages
55
Points
0
Github
tmav94
i have the ".@char_id". How can i apply this action (query_sql) with this var?

 
why use query_sql

you can use this method

Code:
.@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)
 
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?

 
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.

 
Back
Top