|
Senior Member
Join Date: Nov 2014
Location: Brazil
|
06-01-2018
, 15:58
Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
|
#37
|
Quote:
Originally Posted by Papero
If someone is interested using this way you can put a player on a team on connect(without showing the teammenu) and prevent its change.
PHP Code:
public void OnPluginStart()
{
HookUserMessage(GetUserMessageId("VGUIMenu"), TeamMenuHook, true);
//Team Hooks
AddCommandListener(Cmd_JoinTeam, "jointeam");
AddCommandListener(Cmd_JoinTeam, "spectate");
}
public Action Cmd_JoinTeam(int client, const char[] command, int args)
{
//Prevent team change
return Plugin_Stop;
}
public Action TeamMenuHook(UserMsg msg_id, Protobuf msg, const int[] players, int playersNum, bool reliable, bool init)
{
char buffermsg[64];
msg.ReadString("name", buffermsg, sizeof(buffermsg)); //Use methodmaps
if (StrEqual(buffermsg, "team", true))
{
int client = players[0];
RequestFrame(Frame_SetTeam, GetClientUserId(client));
return Plugin_Stop; //Don't show the teammenu
}
return Plugin_Continue;
}
public void Frame_SetTeam(any userid)
{
int client = GetClientOfUserId(userid);
if (!client)
return;
ChangeClientTeam(client, CS_TEAM_CT); //Change team
}
|
That’s exactly what I said on the original post -.-
|
|
|
|