a certain action
ie
im in arcade now i have a separate list for users in arcade and it will so there possible?
When you view the list of users online, you can see which actions/topics/boards they are viewing, so it should be possible to make a list just for one action.
Have a look at the code from the 'Who.php' source file, this infomation is stored in the '{$db_prefix}log_online' table. I can help you do it, if you need some help. ;)
thank you for the offer if you can help thatl be fab ive been sitting here for hours trying to figar it out
can you help please
ok i kinda got this working with a little help from jeza at smf arcade
the code im using
// heres the bullits duck lol
$bullet2 = '<img src="'.$settings['images_url'].'/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
//its ok now bullits have flown by stand up again lol
require("SSI.php");
$online = ssi_whosOnline('array');
foreach($online['users'] as $user){
$result = db_query("
SELECT url
FROM {$db_prefix}log_online
WHERE ID_MEMBER = {$user['id']}",__FILE__, __LINE__);
$checkit = mysql_fetch_assoc($result);
$data = @unserialize($checkit['url']);
if($data['action']=='arcade')
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link']; echo ' ';
}
unset($data);
It kinda works, but seems to be one click away. Maybe the log url is updated AFTER you enter the arcade? could there be somthing missing?
you can see what im trying to do here
http://sleepy-arcade.ath.cx/dev/index.php?action=forum
look for users in arcade in info center
I can't see a problem with codes. What is the problem with it?
it seems to be a click away not a biggie realy but would like to know why
Well, below is the code that I tested:
require_once('SSI.php');
// Heres the bullits duck lol
$bullet2 = '<img src="'.$settings['images_url'].'/aim.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
// Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
foreach($online['users'] as $user)
{
$result = db_query("
SELECT url
FROM {$db_prefix}log_online
WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);
$checkit = mysql_fetch_assoc($result);
$data = @unserialize($checkit['url']);
if($data['action']=='arcade')
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link']; echo ' ';
unset($data);
}
It worked perfectly...
writelog() function does not update the log_online table every second. It waits some time to pass cause of performace issues. So there is nothing wrong with your code.
ok thanks one more questin hope you can help
im trying to put an else statment there so when no onbe is in the arcade it will show now players insead of a blanck box not sure if else is the way to go i was just tryin to go from another mod and i was getting unexepted t else errors
:d
oh and one more lol
can you right that above code for smf 2 please i cant do that eather thank you
This code for SMF 1.1.5:
require_once('SSI.php');
// Heres the bullits duck lol
$bullet2 = '<img src="'.$settings['images_url'].'/aim.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
// Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
$arcade_users = array();
foreach($online['users'] as $user)
{
$result = db_query("
SELECT url
FROM {$db_prefix}log_online
WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);
$checkit = mysql_fetch_assoc($result);
$data = @unserialize($checkit['url']);
if($data['action']=='arcade')
{
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link']; echo ' ';
$arcade_users[] = $user;
}
unset($data);
}
// No arcade users?
if(empty($arcade_users))
echo 'Blah';
Change the database query to this code for SMF 2 Beta:
$result = $smcFunc['db_query']('','
SELECT url
FROM {db_prefix}log_online
WHERE id_member = {int:user_id}',
array(
'user_id' => $user['id'],
)
);
works a treat thank you
can you help with this
im trying to put an else statment there so when no onbe is in the arcade it will show now players insead of a blanck box not sure if else is the way to go i was just tryin to go from another mod and i was getting unexepted t else errors
Its already in the code that I posted. :P
See this:
// No arcade users?
if(empty($arcade_users))
{
// Insert 'else' code here. ;)
}
If you want help with the specific code inside the 'else' statement, then you will have to describe it a bit more. ;)
thanks works great didnt see that last time:D
i know you said this code was ok but its giving this error
Undefined index: action
Line: 171
line 171 = if($data['action']=='arcade')
whole code
require_once('SSI.php');
// Heres the bullits duck lol
$bullet2 = '<img src="'.$settings['images_url'].'/aim.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
// Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
$arcade_users = array();
foreach($online['users'] as $user)
{
$result = db_query("
SELECT url
FROM {$db_prefix}log_online
WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);
$checkit = mysql_fetch_assoc($result);
$data = @unserialize($checkit['url']);
if($data['action']=='arcade')
{
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link']; echo ' ';
$arcade_users[] = $user;
}
unset($data);
}
Find:
if($data['action']=='arcade')
Replace:
if(isset($data['action']) && $data['action'] == 'arcade')
thank you
need a little help again with this im setting it up so it shows what they are doing in the arcade ie if they are playing a game it will show the thumbnail of that game now if there veiwing the arcade index it still show the image wich should be only there if they are playing a game how can i hide the image for veiwing arcade index?
you can problay see what i mean here
http://waynesworld.kicks-ass.net/forum2/index.php?action=arcade
right at the bottom
my code
function wdmboard_ArcadeStatsonline()
{
global $txt, $context,$settings;
require_once('SSI.php');
// Heres the bullits duck lol
$bullet2 = '<img src="'.$settings['images_url'].'/aim.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
// Its ok now bullits have flown by stand up again lol
$online = ssi_whosOnline('array');
$arcade_users = array();
foreach($online['users'] as $user)
{
$result = db_query("
SELECT url
FROM {$db_prefix}log_online
WHERE ID_MEMBER = $user[id]",__FILE__, __LINE__);
$checkit = mysql_fetch_assoc($result);
$data = @unserialize($checkit['url']);
if($data['action']=='arcade')
{
echo $bullet2 , $user['hidden'] ? '<i>' . $user['link'] . ' </i>' : $user['link']; echo ' <a href="',$scripturl , '?action=arcade;sa=play;game=' . $context['arcade']['game']['id'],'"><img " border="0" src="',$context['arcade']['game']['thumbnail'],'" width="20" height="20" alt=" Playing ',$context['arcade']['game']['name'],' on Arcade"/></a>';
$arcade_users[] = $user;
}
unset($data);
}
// No arcade users?
if(empty($arcade_users))
echo 'no players playing at the moment';
// end wdmboard_statsonline
}