Jump to content
  • 0

Question

4 answers to this question

Recommended Posts

Posted

query_sql("SELECT account_id FROM `char` WHERE online = 1 LIMIT 128;",.@accounts);

Then to get player names, do a loop:

rid2name(.@accounts[var])

  • Upvote 1
Posted

Chars:

select char_id from `char` where online=1;

Accounts:

select l.account_id from `login` l join `char` c on l.account_id = c.account_id where c.online=1

The results can be more than 128 rows, use limit to restrict the row number using a page.

set .@PageSize, 100;
set .@Counter, 0;
do {
  set .@Results, query_sql("select l.account_id from `login` l join `char` c on l.account_id = c.account_id where c.online=1 limit " + .@Page + "," + .@PageSize, .@accounts);
  for (set .@x,0; .@x < .@Results; set .@x, .@x + 1) {
 set .@Counter, .@Counter + 1;
 debugmes "Account #" + .@Counter + ": " + .@accounts[.@x];
  }
  set .@Page, .@Page + .@PageSize;
} while (.@Results);

  • Upvote 1

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.   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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...