hello friends how i can add world check in this part im using tfs 1.2 so it have to be read from players_online table i have first player_id and second world_id querys
im trying to copy it from here but this was created for othire im trying to implement in new znote but no know how i want this get world_id first
PHP:
function user_count_online($world_id) {
if ($world_id == '1') {
$online = mysql_select_single("SELECT COUNT(`player_id`) AS `value` FROM `players_online`;");
return ($online !== false) ? $online['value'] : 0;
} elseif ($world_id == '2') {
$online = mysql_select_single_test("SELECT COUNT(`player_id`) AS `value` FROM `players_online`;");
return ($online !== false) ? $online['value'] : 0;
} else {
$data = mysql_select_single("SELECT COUNT(`id`) AS `count` from `players` WHERE `online` = 1;");
return ($data !== false) ? $data['count'] : 0;
}
}
PHP:
function user_count_online($world) {
if ($world == '1') {
$data = mysql_select_single_first("SELECT COUNT(`id`) AS `count` from `players` WHERE `online` = 1;");
return ($data !== false) ? $data['count'] : 0;
} elseif ($world == '2') {
$data = mysql_select_single_test("SELECT COUNT(`id`) AS `count` from `players` WHERE `online` = 1;");
return ($data !== false) ? $data['count'] : 0;
} else {
$data = mysql_select_single("SELECT COUNT(`id`) AS `count` from `players` WHERE `online` = 1;");
return ($data !== false) ? $data['count'] : 0;
}
}
Last edited: