AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [CS:GO] Final and fancy solution for putting a player in a team on connect (https://forums.alliedmods.net/showthread.php?t=300549)

joao7yt 09-06-2017 04:37

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

Originally Posted by Neuro Toxin (Post 2546974)
I hook on player spawn.

The first occurrence is from client connecting. The second occurrence u can change the team and cs_respawn the client.

A better way is to listen to the jointeam command. Wait a frame and then set your team.

Well, then you need the player to select a team, which is not "fancy". My way it's exactly like valve does on their servers. And also if a player joins spec, you don't have player spawn to hook. And also if you do want to have the team menu disabled in your server, you wouldn't be able, since you require the client to spawn or do jointeam.

Neuro Toxin 09-06-2017 17:04

Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
 
Spawn calls for spec.

If you dont want a team menu. Wait a frame from the first spawn call during join and set your team and cs respawn if you want to.

joao7yt 09-06-2017 17:12

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

Originally Posted by Neuro Toxin (Post 2547168)
Spawn calls for spec.

If you dont want a team menu. Wait a frame from the first spawn call during join and set your team and cs respawn if you want to.

Then 2 of the 3 problems I mentioned with your method remains: it requires the player to actually select a team, clicking it in the menu (which I think unnecessary since my method bypasses it), and if you want to disable the team menu with "sv_disable_show_team_select_menu 1", you won't be able.

Neuro Toxin 09-06-2017 17:47

Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
 
Just set show to false in the VGUIMenu hook if sv_disable_show_team_select_menu doesn't work for you.

The team menu is distributed on the first spawn call. So wait a frame and then set your team.

joao7yt 09-06-2017 17:56

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

Originally Posted by Neuro Toxin (Post 2547175)
Just set show to false in the VGUIMenu hook if sv_disable_show_team_select_menu doesn't work for you.

The team menu is distributed on the first spawn call. So wait a frame and then set your team.

Oh, wait, the spawn you are saying is when the player connects? If so, I was doing it before, but as I said, if you change the client's with the "Continue" screen opened, it will bug the client, he won't be able to use the team menu to change team... I mean, if you already don't want the client to change team, it's ok, but in my case I want to let them to go to spec (then I set them as a coach for the team he was), and let coaches join to play on the team he's coaching... anyway, what I mean is that changing the client's team too soon (more specifically with the "Continue" screen opned) it will bug the team menu for that client.

Neuro Toxin 09-06-2017 18:06

Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
 
On connect set a flag to set show to false in the vgui to block the team menu.

On first spawn use request frame and set the team in the callback.

On first team vgui set show to false and clear your flag.

joao7yt 09-06-2017 18:14

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

Originally Posted by Neuro Toxin (Post 2547183)
On connect set a flag to set show to false in the vgui to block the team menu.

On first spawn use request frame and set the team in the callback.

On first team vgui set show to false and clear your flag.

I don't see why set team vgui to false... what i'm saying is that the team menu gets unusable if you set the client's team with this screen opened, and I think your method will do exactly that, won't it? Because I think the player spawn callback is called right after the client finishes loading the map, where this screen appears... don't it?

If so, just try to change team after being spawned. You won't be able to use the menu.

Neuro Toxin 09-06-2017 18:26

Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
 
The order will be.

OnSpawn > Request Frame
VGUI > hide
Set Team after VGUI is hidden

You are right. If u play with teams during the vgui you're screwed after an update a while back.

I wrote a whole thread on this then made the motd changer plugin.

joao7yt 09-06-2017 18:30

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

Originally Posted by Neuro Toxin (Post 2547186)
The order will be.

OnSpawn > Request Frame
VGUI > hide
Set Team after VGUI is hidden

Ok
Which spawn is that? the client full connected? or the client being spawned in a team?
Which vgui? The vgui which shows the "Continue" screen? because I think there's no vgui for that screen. Because I said, using ChangeClientTeam with that screen being showed, will bug the team menu...

Why don't you simply post the code here lol

Neuro Toxin 09-06-2017 18:33

Re: [CS:GO] Final and fancy solution for putting a player in a team on connect
 
The spawn is the very first one from connect.

It's been a while since the update that fucked with this stuff.

Im pretty sure if you block the team menu the continue screen doesn't show.


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

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