AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Player indexing problem (https://forums.alliedmods.net/showthread.php?t=241888)

vamppa 06-10-2014 17:28

Player indexing problem
 
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.

Nextra 06-10-2014 17:36

Re: Player indexing problem
 
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.

bol 06-11-2014 19:06

Re: Player indexing problem
 
Ive got a similar problem.

vamppa 06-11-2014 19:08

Re: Player indexing problem
 
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.

fysiks 06-11-2014 20:21

Re: Player indexing problem
 
Quote:

Originally Posted by vamppa (Post 2150110)
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 (Post 2150110)
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.

vamppa 06-12-2014 01:09

Re: Player indexing problem
 
I see could I send the code via PM?

Nextra 06-12-2014 05:26

Re: Player indexing problem
 
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.

vamppa 06-12-2014 08:40

Re: Player indexing problem
 
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?

Nextra 06-12-2014 09:11

Re: Player indexing problem
 
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.

vamppa 06-13-2014 01:04

Re: Player indexing problem
 
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"


All times are GMT -4. The time now is 09:42.

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