Need help with a plugin -
DrakeBell - 22.11.2017
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);
}
Re: Need help with a plugin -
DrakeBell - 23.11.2017
The channel command is already setup but we need to integrate the teamspeak plugin in. It would really be helpful if anyone helped.
Re: Need help with a plugin -
DrakeBell - 24.11.2017
Seriously, no one?
Re: Need help with a plugin -
Kane - 24.11.2017
Make use of:
PHP код:
native TSC_MoveClient(clientid, channelid);
Make some sort of verification for their client ID.
Re: Need help with a plugin -
DrakeBell - 24.11.2017
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?
Re: Need help with a plugin -
Kane - 24.11.2017
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(playerid, player_ip, sizeof 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(clientid, nickname[])
{
new client_ip[22];
TSC_GetClientIpAddress(clientid, client_ip, sizeof client_ip);
new client_found;
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
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;
}
Re: Need help with a plugin -
DrakeBell - 24.11.2017
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.
Re: Need help with a plugin -
Kane - 24.11.2017
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?
Re: Need help with a plugin -
DrakeBell - 24.11.2017
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.
Re: Need help with a plugin -
Kane - 24.11.2017
So just use the function with the command.
PHP код:
CMD:channel(playerid, params[])
{
new
id;
sscanf(params, "i", id);
switch(id)
{
case 1: TSC_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(clientid, reasonid, reasonmsg[])
{
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
if(TSClientID[i] == clientid)
{
TSClientID[i] = 0;
SendClientMessage(playerid, -1, "You're no longer on Teamspeak.");
}
}
return 1;
}