Raised This Month: $246 Target: $400
 61% 

Notices

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


Post New Thread Reply   
 
Thread Tools Display Modes
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 03-22-2018 , 14:14   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #31

Quote:
Originally Posted by Sipro View Post
It is working for CS:S?
I donít really know... maybe
joao7yt is online now
OSWO
Senior Member
Join Date: Jul 2015
Location: United Kingdom, London
Old 03-24-2018 , 22:38   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #32

Why dont you use RequestFrame instead of 0.1 timers (:
__________________
OSWO is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 03-25-2018 , 02:13   Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
Reply With Quote #33

Quote:
Originally Posted by OSWO View Post
Why dont you use RequestFrame instead of 0.1 timers (:
Didnít try it yet. Do you know if that works?
joao7yt is online now
Papero
Senior Member
Join Date: Aug 2016
Location: Rimini, 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 #34

Yeah it works
__________________
Papero is offline
Send a message via Skype™ to Papero
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 #35

Quote:
Originally Posted by Papero View Post
Yeah it works
Nice, I updated the post.
joao7yt is online now
Papero
Senior Member
Join Date: Aug 2016
Location: Rimini, 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 #36

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

__________________
Papero is offline
Send a message via Skype™ to Papero
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 #37

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 online now
Papero
Senior Member
Join Date: Aug 2016
Location: Rimini, 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 #38

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...
__________________
Papero is offline
Send a message via Skype™ to Papero
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 #39

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 online now
Papero
Senior Member
Join Date: Aug 2016
Location: Rimini, 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 #40

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.
__________________

Last edited by Papero; 06-01-2018 at 16:42.
Papero is offline
Send a message via Skype™ to Papero
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:05.


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