Get client nickname by Client Id

francisco arsénio

Restricted
Sep 30, 2015
8
1
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:
E

ewenjo

Try this
PHP:
$client = $oixb->serverGetSelected()->clientGetById($verification);
 
Last edited by a moderator:

Najsr

Moderator
TeamSpeak Developer
Apr 23, 2016
483
249
167
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.
 

francisco arsénio

Restricted
Sep 30, 2015
8
1
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
Contributor
Oct 28, 2015
411
253
178
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. :(
 

francisco arsénio

Restricted
Sep 30, 2015
8
1
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
Mar 31, 2016
2,570
12
2,857
381
I would suggest to end that here. After that, the conv will go way further than it should.
 
Top