[CS:GO] GetClientTeam() returns incosistent numbers
Hey there.
I'm currently working on a plugin that is supposed to automatically start the knife round once all players all connected. After that the winning team can decide !switch or !stay and so on... You know the procedure. Some of the plugins features are working fine, but I struggle to count the players in order to determine when the knife round has to start. My current counter works like this (just a small snippet out of a big .sp. Pls ignore non-declared variables and so on): PHP Code:
The code above the first if statement is just for debugging purposes. I'll come back to that later. The first if statement should check rather the player joined a team or if he's a spectator. I don't want to count connects if they join the spectators!! So, now I come back to the debug part. If you run this on a server, you'll notice that the returned number are inconsistent! My testing setup: - Laptop - CS:GO Server on Debian 10 VM - Running CS:GO, joined the Server - Main PC - Running CS:GO, joined the Server Testing procedure: I switched teams on the Laptop, as well as the Main PC, and checked the returned numbers in the chat. Results (in the order I tested): Joining T -> Returned Number: 3 Joining CT -> Returned Number: 2 Joining T -> Returned Number: 3 Joining CT -> Returned Number: 2 (so far so good) Joining Spec -> Returned Number: 3 Joining CT -> Returned Number: 1 I think you now got a pretty good look at my issue. I would be SO glas if somebody knows a fix for that! Thanks in advance! :) |
Re: [CS:GO] GetClientTeam() returns incosistent numbers
PHP Code:
And maybe you want GetTeamClientCount to only count players on T and CT. |
Re: [CS:GO] GetClientTeam() returns incosistent numbers
Well, you can use if(GetClientTeam(client) > 1), also if you have spectators in-game GetClientCount may return them too, im not sure i have never used that function. Try the classic loop... <= MaxClients to count them.
|
Re: [CS:GO] GetClientTeam() returns incosistent numbers
Quote:
Edit: "if(GetClientTeam(client) > 1)". Pls see my initial post. You can see there, that even a CT showed up as Team ID 1. |
Re: [CS:GO] GetClientTeam() returns incosistent numbers
Quote:
|
Re: [CS:GO] GetClientTeam() returns incosistent numbers
I guess you check their team too early with your way
PHP Code:
|
Re: [CS:GO] GetClientTeam() returns incosistent numbers
Quote:
|
Re: [CS:GO] GetClientTeam() returns incosistent numbers
Guys I really need help with this. I can't find ANY solution to ONLY count players.
|
Re: [CS:GO] GetClientTeam() returns incosistent numbers
PHP Code:
PHP Code:
|
Re: [CS:GO] GetClientTeam() returns incosistent numbers
Isn't it a timing issue? So, listening for that command returned for you non-expected result, before actual join the team.
Consider using "player_team" event. Or re-write logic entirelly, round_start -> CreateTimer + above Vaggelis code. Or [ANY] Wait Connection |
All times are GMT -4. The time now is 00:26. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.