Get client nickname by Client Id

francisco arsénio

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

ewenjo

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

Najsr

Moderator
TeamSpeak Developer
Joined
Apr 23, 2016
Messages
483
Reaction score
249
Points
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
Joined
Sep 30, 2015
Messages
8
Reaction score
1
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
Contributor
Joined
Oct 28, 2015
Messages
411
Reaction score
253
Points
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
Joined
Sep 30, 2015
Messages
8
Reaction score
1
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,570
Solutions
12
Reaction score
2,857
Points
381
I would suggest to end that here. After that, the conv will go way further than it should.
 
Top