|
|
In the past I've seen various ways of checking the current number of online players, but all that I've seen have a fatal flaw. Depending on how the server was turned off (or more specifically, if it crashes) the player count gets messed up. Here's the one I'm talking about:- J' Z- s7 Y- S* D0 t4 n) z: M* g% s/ o
Code:! i* ]- ]" t) j- u! E) e
$mssql = mssql_query("SELECT * FROM [ACCOUNT_DBF].dbo.[ACCOUNT_TBL] WHERE isuse='J'");
: |- I- B* v0 Y" z7 W; G+ p0 d) Becho mssql_num_rows($mssql);Here's a more proper code, which will automatically reset the current online count whenever the world server program is opened:: M) G1 F: h. x4 r
Code:
) L+ t$ e7 U/ M3 s5 z& R$mssql = mssql_query("SELECT * FROM [CHARACTER_01_DBF].dbo.[CHARACTER_TBL] WHERE MultiServer='1'");
! E* p6 L6 y. b) _- T$ D7 D9 g, u3 z+ wecho mssql_num_rows($mssql);
. Z2 f6 ^. x+ q$ v/ Y- \) y
8 m! ?- G$ }$ t |
|