Need help with a plugin
#1

So umm I'm deciding to use this guy's plugin https://sampforum.blast.hk/showthread.php?tid=437671 So what we have is that we have a channel command. Whenever someone uses /channel 1, it automatically gives out a message saying "example has switched to channel 1" Can you help me integrate it within the script, so that when ever someone uses /channel 1, he automatically gets switched to channel 1. I need complete steps please.

Код:
if(Voip[playerid] == false) return SCM(playerid, COLOR_GREY,"You have not activated your Voip label. (Hint: /channel on)");
	Update3DTextLabelText(voiplabel[playerid], 0xE91616FF, "Channel: 1");
	SendNearbyMessage(playerid, 20.0, 0xE91616FF, "**%s Has switched to the channel 1.**", ReturnName(playerid, 0), params);
	}
Reply
#2

The channel command is already setup but we need to integrate the teamspeak plugin in. It would really be helpful if anyone helped.
Reply
#3

Seriously, no one?
Reply
#4

Make use of:
PHP код:
native TSC_MoveClient(clientidchannelid); 
Make some sort of verification for their client ID.
Reply
#5

I'm using your base roleplay script if that helps but how do I call it? The thing is, that how do I make the verification?
Reply
#6

Not entirely familiar with the plugin but I'm only looking at the include so bare with me.

PHP код:
new TSClientID[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    new 
player_ip[22]; 
    
GetPlayerIp(playeridplayer_ipsizeof player_ip); 
    
TSClientID[playerid] = TSC_GetClientIdByIpAddress(player_ip);
    return 
1;

Is one of the ways I can think of.

EDIT:

Or you could do:

PHP код:
public TSC_OnClientConnect(clientidnickname[]) 

    new 
client_ip[22];  
    
TSC_GetClientIpAddress(clientidclient_ipsizeof client_ip); 
    
    new 
client_found;
    for(new 
0GetPlayerPoolSize(); <= ji++) 
    { 
        if(!
strcmp(ReturnIP(i), client_ip)) 
        { 
            
TSClientID[i] = clientid
            
client_found 1;
        } 
    } 
    
    if(!
client_found)
        
TSC_SendClientMessage(clientid"We didn't find you ingame. Connect to the server and reconnect on TS.");
    
    return 
1

Reply
#7

Okay thank you, umm hope I'm not being so much of a pain but, how do I exactly integrate it in following up with the /channel command. I was going for 'If' param's but I still need to be able to setup the TSC_MoveClient with the server. I would appreciate it if you or anyone else could give me an extensive step to step guide on this.
Reply
#8

Well you already have their client ID so just go and do:
PHP код:
TSC_MoveClient(TSClientID[playerid], channel_id_depending_on_the_channel); 
What exactly are you trying to do? Is this it, or?
Reply
#9

This seems to be considerable but what I'm exactly trying to do is, that when ever some uses the command /channel 1, he gets moved to the Channel 1 on TS. The channel ID for channel 1 is 4.
Reply
#10

So just use the function with the command.

PHP код:
CMD:channel(playeridparams[])
{
    new
        
id;
        
    
sscanf(params"i"id); 
    
    switch(
id)
    {
        case 
1TSC_MoveClient(TSClientID[playerid], 4); 
    }
    return 
1;

Also, you wanna make sure the player is still connected to Teamspeak using TSC_OnClientDisconnect. An example:
PHP код:
public TSC_OnClientDisconnect(clientidreasonidreasonmsg[])
{
    for(new 
0GetPlayerPoolSize(); <= ji++)
    {
        if(
TSClientID[i] == clientid)
        {
            
TSClientID[i] = 0;
            
SendClientMessage(playerid, -1"You're no longer on Teamspeak.");
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)