Raised This Month: $ Target: $400
 0% 

[CS:GO] Final and fancy solution for putting a player in a team on connect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 04-05-2018 , 15:56   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #1

Yeah it works
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 04-05-2018 , 16:23   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #2

Quote:
Originally Posted by Papero View Post
Yeah it works
Nice, I updated the post.
joao7yt is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 06-01-2018 , 15:53   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #3

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"), TeamMenuHooktrue);
    
    
//Team Hooks
    
AddCommandListener(Cmd_JoinTeam"jointeam");
    
AddCommandListener(Cmd_JoinTeam"spectate");
}

public 
Action Cmd_JoinTeam(int client, const char[] commandint args)
{
    
//Prevent team change
    
return Plugin_Stop;
}

public 
Action TeamMenuHook(UserMsg msg_idProtobuf msg, const int[] playersint playersNumbool reliablebool init)
{
    
char buffermsg[64];
    
    
msg.ReadString("name"buffermsgsizeof(buffermsg)); //Use methodmaps
    
if (StrEqual(buffermsg"team"true))
    {
        
int client players[0];
        
        
RequestFrame(Frame_SetTeamGetClientUserId(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(clientCS_TEAM_CT); //Change team

__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 06-01-2018 , 15:58   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #4

Quote:
Originally Posted by Papero View Post
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"), TeamMenuHooktrue);
    
    
//Team Hooks
    
AddCommandListener(Cmd_JoinTeam"jointeam");
    
AddCommandListener(Cmd_JoinTeam"spectate");
}

public 
Action Cmd_JoinTeam(int client, const char[] commandint args)
{
    
//Prevent team change
    
return Plugin_Stop;
}

public 
Action TeamMenuHook(UserMsg msg_idProtobuf msg, const int[] playersint playersNumbool reliablebool init)
{
    
char buffermsg[64];
    
    
msg.ReadString("name"buffermsgsizeof(buffermsg)); //Use methodmaps
    
if (StrEqual(buffermsg"team"true))
    {
        
int client players[0];
        
        
RequestFrame(Frame_SetTeamGetClientUserId(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(clientCS_TEAM_CT); //Change team

That’s exactly what I said on the original post -.-
joao7yt is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 06-01-2018 , 16:15   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #5

Quote:
Originally Posted by joao7yt View Post
That’s exactly what I said on the original post -.-
I've just pointed out that they can use
Code:
Plugin_Stop
to stop the displaying and the listener to block the team change...
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 06-01-2018 , 16:21   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #6

Quote:
Originally Posted by Papero View Post
I've just pointed out that they can use
Code:
Plugin_Stop
to stop the displaying and the listener to block the team change...
Oh, right... So, it’s been a long time since I posted it, but if I’m not mistaken, when I was messing with it back then, I tried Plugin_Stop and it cause some issue, I don’t remember if it crashed the server or something like that. But if you tried it and it didn’t, they must’ve changed something that fixed it. I will run some tests when I can to be sure it’s not causing any bugs...
joao7yt is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 06-01-2018 , 16:41   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #7

Quote:
Originally Posted by joao7yt View Post
Oh, right... So, it’s been a long time since I posted it, but if I’m not mistaken, when I was messing with it back then, I tried Plugin_Stop and it cause some issue, I don’t remember if it crashed the server or something like that. But if you tried it and it didn’t, they must’ve changed something that fixed it. I will run some tests when I can to be sure it’s not causing any bugs...
On my test server it didn't caused any issue, I was alone but I don't think it matters.
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 06-01-2018 at 16:42.
Papero is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-30-2018 , 09:24   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #8

With the new panorama, you can assign a team in player_connect_full (i tried with requestframe) without any bugs. I can buy and i can switch teams, also the teammenu is no more called on connect.
There is a bug if you assign a team in player_spawn event (if teamnum is CS_TEAM_NONE, also with request frame): you can't switch teams.
player_connect_full is called after player_spawn (the first spawn).

Last edited by Ilusion9; 08-30-2018 at 10:33.
Ilusion9 is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 08-31-2018 , 02:07   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #9

Quote:
Originally Posted by Ilusion9 View Post
With the new panorama, you can assign a team in player_connect_full (i tried with requestframe) without any bugs. I can buy and i can switch teams, also the teammenu is no more called on connect.
There is a bug if you assign a team in player_spawn event (if teamnum is CS_TEAM_NONE, also with request frame): you can't switch teams.
player_connect_full is called after player_spawn (the first spawn).
So, I tested with player_connect_full and seems like I can go to spec but then i can't join ct again...
joao7yt is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 08-31-2018 , 05:36   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #10

Quote:
Originally Posted by joao7yt View Post
So, I tested with player_connect_full and seems like I can go to spec but then i can't join ct again...
with or without requestframe?
i use requestframe and i can switch the teams whenever i want.
Ilusion9 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode