Author Topic: Detecting if a player in a server is on your RTB friend list  (Read 1881 times)

Is there a way in which I could detect if a player on the server you are on is on your RTB friends list? If socan you help me out?
« Last Edit: July 24, 2012, 01:10:46 PM by Danny Boy »


Why not go through the RTB friends GUI and the player list GUI and if they both have the same player return true?

Something like this should do it:

Code: [Select]
if (RTBCC_Roster.hasID(user_id) && RTBCC_Roster.getByID(user_id).state $= "")
No promises.

Found this in the Connect 2 Chat mod I've referenced like 100 times, lol.

Code: [Select]
function Connect2ChatConductor::FriendsList_GetUserIdByName(%this,%name)
{
%Name = StrLwr(StrReplace(%Name," ","_"));

%Group = RTBCC_Roster.GetObject(0);

if(IsObject(%Group))
{
%GroupCount = %Group.GetCount();

for(%i=0;%i<%GroupCount;%i++)
{
%UserData = %Group.GetObject(%i);

if(IsObject(%UserData))
{
%UserName = StrReplace(%UserData.Name," ","_");

if(StrStr(strLwr(%UserName),strLwr(%Name)) >= 0)
{
return %UserData.ID;
}
}
}
}
return false;
}

function Connect2ChatConductor::FriendsList_GetUserNameById(%this,%Id)
{
%Group = RTBCC_Roster.GetObject(0);

if(IsObject(%Group))
{
%GroupCount = %Group.GetCount();

for(%i=0;%i<%GroupCount;%i++)
{
%UserData = %Group.GetObject(%i);

if(IsObject(%UserData))
{
if(%userData.ID == %Id)
return %UserData.Name;
}
}
}
return false;
}

Then grab either the blockland id, or name from the player list, and use the functions accordingly to achieve your desired results.

That will do perfectly elm thanks.

Edit: Small problem, it seems that the functions are only returning the information for the first person on my friends list. Unless I am missing something

What I'm currently doing is this
Code: [Select]
echo(Connect2ChatConductor::FriendsList_GetUserIdByName(Muzzles56));
No matter what name I put in it always returns 8294 which is the ID of Big Brother who is at the top of my friends list.

What sure to be stupid mistake am I making here?
« Last Edit: July 24, 2012, 03:48:10 PM by Danny Boy »

..... Okay, You forgot a variable, Danny

Code: [Select]
echo(Connect2ChatConductor::FriendsList_GetUserIdByName(Muzzles56));
What sure to be stupid mistake am I making here?

Change the :: to a .

it should be used like so:

Code: [Select]
connect2ChatConductor.friendsList_getUserIdByName(%name);

..... Okay, You forgot a variable, Danny
what are you talking about


Hey, isn't it a bit funny how Cat123 only mainly posts on mine and Danny's coding help topics?

Cunt.

Hey, isn't it a bit funny how Cat123 only mainly posts on mine and Danny's coding help topics?

Cunt.
Not really, and yes, posting into your topics is funny, a bit funny. Ha-ha-ha

Signs of trolling? Maybe so.

Guys this is the coding section, please take it over to the drama section.