Get client nickname by Client Id

Joined
Sep 30, 2015
Messages
16
Points
53
Hey,

How to get client nickname by client id
Example:
if ($event->getType() == "clientleftview") {
$verification = $event["clid"];
$client = $oixb->clientGetById("$verification");
echo $client->client_nickname;
}
But code says invalid clientID
 
Last edited:

ewenjo

That norwegian guy
Joined
Dec 14, 2016
Messages
91
Points
57
Location
Norway
Try this
PHP:
$client = $oixb->serverGetSelected()->clientGetById($verification);
 
Last edited:

Najsr

Moderator
Developer
Joined
Apr 23, 2016
Messages
428
Points
107
Location
void
Maybe it would be resource efficient if you create a class with clid and uid / dbid. Then you would have a list of those and when a client joins, you add him to the list. When he leaves you would find him by clid, do your stuff and then delete him from the list.
 
Joined
Sep 30, 2015
Messages
16
Points
53
Hey, i have another question
How to add server group with certain time user joined the server in 300 seconds?

Example:
foreach($oixb->clientList() as $client) {
$uptimeclient = time() - $client->client_lastconnected;
if($uptimeclient > 300){

try{
if(!$client->addServerGroup($member["group"])){
echo "Already Have"
}else{
$client->addServerGroup($member["group"]);

echo "Added Success";
}
} catch (\Exception $e) {}

}
}

But i remove the server group in teamspeak and switch the channel to add and he add the server group but says already have
 

kalle

high minded
VIP
Contributor
Joined
Oct 28, 2015
Messages
370
Points
118
Location
Bosnia and Herzegovina
Hey, i have another question
How to add server group with certain time user joined the server in 300 seconds?

Example:
foreach($oixb->clientList() as $client) {
$uptimeclient = time() - $client->client_lastconnected;
if($uptimeclient > 300){

try{
if(!$client->addServerGroup($member["group"])){
echo "Already Have"
}else{
$client->addServerGroup($member["group"]);

echo "Added Success";
}
} catch (\Exception $e) {}

}
}

But i remove the server group in teamspeak and switch the channel to add and he add the server group but says already have
Rather use ts rank system.
But if u want script like this, you cant check like this because (I think) its gonna pop error if user already have this group. Before that check user groups, and then assign new group if needed. Also fixing ur English would be nice, for this text I used 2 min to decode. :(
 
Joined
Sep 30, 2015
Messages
16
Points
53
Rather use ts rank system.
But if u want script like this, you cant check like this because (I think) its gonna pop error if user already have this group. Before that check user groups, and then assign new group if needed. Also fixing ur English would be nice, for this text I used 2 min to decode. :(
My english is very bad kkk
 

Alligatoras

Administrator
Joined
Mar 31, 2016
Messages
2,047
Points
341
Age
26
Location
Greece
I would suggest to end that here. After that, the conv will go way further than it should.
 

Top