Raised This Month: $ Target: $400
 0% 

Player indexing problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 06-10-2014 , 17:28   Player indexing problem
Reply With Quote #1

Oi

Im having some issue when code on player indexing is passed on when it should not be.
wondering how half-life indexes players and if the loop through max players is just a loop and not reindexing.
Is this a common problem?

ps. would really appreciate some help here, Can provide code if necessary.

Last edited by vamppa; 06-10-2014 at 17:30.
vamppa is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 06-10-2014 , 17:36   Re: Player indexing problem
Reply With Quote #2

Code is necessary. We have no idea what you are talking about, and I don't feel like guessing what you are on to.

As a general answer: Player indexes go from 1 to get_maxplayers() and a player keeps this index for the entire time they are connected to the server. So when iterating over the indexes you have to check if they are connected.


/edit: If you manage to solve the problem on your own, please still provide a bit of code and what you did to solve your issue. It can help people searching for this in the future.
__________________
In Flames we trust!

Last edited by Nextra; 06-10-2014 at 17:38.
Nextra is offline
bol
Member
Join Date: Feb 2014
Old 06-11-2014 , 19:06   Re: Player indexing problem
Reply With Quote #3

Ive got a similar problem.

Last edited by bol; 06-11-2014 at 19:07.
bol is offline
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 06-11-2014 , 19:08   Re: Player indexing problem
Reply With Quote #4

Then what happens when a player disconnects and more players join before map timeleft.
Eventually other players would get the index number a previous player had?

What if lets say a users steamid/name is still kept in server memory for that particular index number?
It shouldn't happen for such information to get passed on.
instead it should be refreshed as player on entrance or on function would get_user_name.
with the use of new zName[32] instead of static would result in correct displaying of the players steamid/name.
perhaps my error is that I dont check enough if the user is connected on each function where I would guess is necessary.
vamppa is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-11-2014 , 20:21   Re: Player indexing problem
Reply With Quote #5

Quote:
Originally Posted by vamppa View Post
Then what happens when a player disconnects and more players join before map timeleft.
Eventually other players would get the index number a previous player had?
Yes. IIRC, every time a player connects, they will get the lowest index available at that time. If you have players 1,3,4,6 on the server, the next player will get index 2. The next 5 (assuming nobody leaves that has a lower index.


Quote:
Originally Posted by vamppa View Post
What if lets say a users steamid/name is still kept in server memory for that particular index number?
It shouldn't happen for such information to get passed on.
instead it should be refreshed as player on entrance or on function would get_user_name.
with the use of new zName[32] instead of static would result in correct displaying of the players steamid/name.
perhaps my error is that I dont check enough if the user is connected on each function where I would guess is necessary.
You have to manually clear and/or repopulate the variables in question. You will see this done in almost all well coded plugins that store information for users.

It sounds like what you are experiencing is a race condition. We can't really help you diagnose/fix your issue without your actual code.
__________________
fysiks is offline
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 06-12-2014 , 01:09   Re: Player indexing problem
Reply With Quote #6

I see could I send the code via PM?
vamppa is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 06-12-2014 , 05:26   Re: Player indexing problem
Reply With Quote #7

You should reset all client related cache or storage variables on client_connect or client_disconnect. Caching the players name is not necessary unless you use it in a very frequently called function (such as Client_PreThink). Cache steamids on client_authorized and you will be fine.

Please post the problematic code here or create a small substitute plugin that exhibits the same issues. It is much more helpful if we can solve this problem in the public space so others (like bol) can find the solution.
__________________
In Flames we trust!
Nextra is offline
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 06-12-2014 , 08:40   Re: Player indexing problem
Reply With Quote #8

Looks like issue is somewhat found.
Certain clients get this Server tried to send invalid command:"connect 81.93.251.130:27015"
https://forums.alliedmods.net/showthread.php?t=160523

While it works fine for others. this is not down to usage of a certain cvar available since latest hl patches.
Ive been mistaken thinking it had to do with player indexing as the reason why some players didnt get sent.
Going to read further there, seeing it is an old thread (before patches) the issue still persist today.
Meanwhile I wonder Has it become common knowledge today what causes this bug to appear?
vamppa is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 06-12-2014 , 09:11   Re: Player indexing problem
Reply With Quote #9

You simply can not send that command to clients anymore. Valve has patched the game to disallow this. It is not a bug and not an AMXX issue.
__________________
In Flames we trust!

Last edited by Nextra; 06-12-2014 at 09:12.
Nextra is offline
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 06-13-2014 , 01:04   Re: Player indexing problem
Reply With Quote #10

Yeah I was mistaken to think it was also caused by a bug, it looks to be is only caused by valve. (In particular fighting redirecting for some time)
Do understand why valve implants these blocks. guess they dont got much of a choice when some began to abuse it. quite sad as it only hurts 3rd party mods communities. and not to forget helps cheaters as some methods are obsolete.

Last night after testing out valve latest build it looked like there had been another update which made previously tested "work around" obsolete.
While I was just off the latest build for a few weeks to create something for our community. not to be mistaken for some non steam wanker.
If interested the patches changed quite a bit some people that use older builds use it for what I personally think is a dirty reason _special but also for example mouse input issues. After being on valves latest since they started updating I indeed noticed when was using 2013 Aprils build. that for people who play with little old half-life mouse accel it had been changed. rawinput players shouldn't notice a thing.

anyway going off topic, In the plugins code Ive left the redirect work around in for those players that got it makes it handier.
For the others ive kicked them with the following message "Redirection failed, due to valves latest restriction you manually need to connect to HLTV with this ip xxx.xxx.xx.xxx:27020"

Last edited by vamppa; 06-13-2014 at 02:03.
vamppa is offline
Reply



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 09:49.


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