AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Moving from spec to team issue (https://forums.alliedmods.net/showthread.php?t=307492)

GoldNux 05-12-2018 12:29

[HELP] Moving from spec to team issue
 
When I use cs_set_user_team to move a player from spec to a team.
That player spawns with a glitched hud and some features disabled.

Anyone know how to move from spec to team properly to avoid this?

Thanks.

Bugsy 05-12-2018 12:36

Re: [HELP] Moving from spec to team issue
 
Not sure if this will fix it but try ExecuteHam( Ham_CS_RoundRespawn , id )

GoldNux 05-12-2018 16:32

Re: [HELP] Moving from spec to team issue
 
Quote:

Originally Posted by Bugsy (Post 2591872)
Not sure if this will fix it but try ExecuteHam( Ham_CS_RoundRespawn , id )

Where is the best place to insert that?

Players being transferred to spec from a team, and then assigned to a team are not experiencing any problems.
It's when you are already in spec, and then transferred to a team that this issue occurs.
Note that there is a line preventing spectators from being moved to spec, so this is not the issue.

Thank you.

Code:
public balance(id, level, cid) {     if (!cmd_access(id, level, cid, 2))     {         return PLUGIN_HANDLED     }     new arg1[4]     read_argv(1, arg1, charsmax(arg1))     randPercent = str_to_num(arg1)     new players[32]     new playercount     get_players(players, playercount)     SortCustom1D(players, playercount, "compareByKD")     new i     for (i = 0; i < playercount; i++)     {         new id = players[i]         if (!is_user_hltv(id) && cs_get_user_team(id) != CS_TEAM_SPECTATOR)         {             cs_set_user_team(id, CS_TEAM_SPECTATOR)                         new data[2]             data[0] = id             data[1] = i             set_task((1.0 * i) + 4.0, "assignUserTeam", _, data, sizeof(data))         }     }         set_task((1.0 * i) + 4.0, "restartRound")     return PLUGIN_CONTINUE } public restartRound() {     console_cmd(0, "sv_restart 1") } public assignUserTeam(data[]) {     new id = data[0]     new order = data[1]     cs_set_user_team(id, order % 2 == 0 ? CS_TEAM_CT : CS_TEAM_T)     new name[40]     get_user_name(id, name, 40)         console_cmd(0,"say %s has a kill / death ratio of: %f", name, getKD(id)) }

Bugsy 05-12-2018 18:02

Re: [HELP] Moving from spec to team issue
 
After you set the team
PHP Code:

cs_set_user_team(idorder == CS_TEAM_CT CS_TEAM_T


Natsheh 05-12-2018 18:13

Re: [HELP] Moving from spec to team issue
 
This problem happens when player is blocked from his 1st join try executing jointeam command on the player, and the team number as its 1st argument.

In get_players(players, playercount)

You can pass in 3rd param flag h to skip retrieving hltv

GoldNux 05-13-2018 07:19

Re: [HELP] Moving from spec to team issue
 
Quote:

Originally Posted by Natsheh (Post 2591928)
This problem happens when player is blocked from his 1st join try executing jointeam command on the player, and the team number as its 1st argument.

In get_players(players, playercount)

You can pass in 3rd param flag h to skip retrieving hltv

Thank you guys for trying to help, but none of these solutions worked.
I tried "manually" setting the player team using jointeam and menuselect.
The player could not respawn at all after doing this, I also tried adding the Ham_CS_RoundRespawn.
Then a combination of the two, and both on their own.

The only ideas I have left is to just ask everyone to join a team, or just having everyone "retry".
And ofc you could set the teams with players already in a team, but it does not look very nice.
Also you could use jointeam and menuselect on all the players I guess..

Natsheh 05-13-2018 08:17

Re: [HELP] Moving from spec to team issue
 
After setting user team you need to also set his class by joinclass command

GoldNux 05-13-2018 09:26

Re: [HELP] Moving from spec to team issue
 
Quote:

Originally Posted by Natsheh (Post 2591986)
After setting user team you need to also set his class by joinclass command

If a player joined the server and did not picked spectator they still get the HUD issue.
I tried manually picking slot5 and all kinds of things, I think I'm gonna have to give up on this one.

I also had to add delay and stuff to sort of make it work, looks really messy now..
Anyways, thanks!

Bugsy 05-13-2018 11:12

Re: [HELP] Moving from spec to team issue
 
Can you provide specifics on what HUD items are glitched and features disabled?

Also a step-by-step to reproduce the issue would help.

Natsheh 05-13-2018 11:44

Re: [HELP] Moving from spec to team issue
 
Check auto join on connect plugin


All times are GMT -4. The time now is 04:35.

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