Count Player Leaves
I want to count how many times the player leaves server but not count the retry command.
I have this simple code (test code) i saw other codes but i want one simple solution. Someone can help me ? PHP Code:
|
Re: Count Player Leaves
It is not possible to detect if the user disconnected with the retry command. Also, if they do use retry, there is no guarantee that they will have the same index as they did before
|
Re: Count Player Leaves
I want to count how many times the player leaves server but not count the retry command.
So: PHP Code:
|
Re: Count Player Leaves
You need to work with SteamIDs here, using a Trie is usually the best option for that. Just using the client entity index is not reliable because they are not constant for any one client. If player a leaves and player b connects afterwards they will have the same index.
PHP Code:
|
Re: Count Player Leaves
Quote:
@Nextra Thanks but one more question i can use a global count because i want to run one function to save this in sqlx? Like this: PHP Code:
|
Re: Count Player Leaves
Storing the counts globally based on player index is pointless. As multiple people have told you the indexes are meaningless after a user disconnects. The code you have posted above will break because of this. I repeat: Indexes are not permanent! There is a reason I used the tries to work with steamids instead of player indexes.
If you want a per-user count use my code. Add a global counter if you want, but do it separately from the player counts. If you want only a global count you can remove everything regarding the g_leave_count trie and just work with the global counter. /edit: Please try to actually understand what I did with the code. Your changes break it completely and shows that you did not understand it at all. |
Re: Count Player Leaves
Search in forum, i think the Disconnect reason (With orpheu) can help you :)
EDIT: https://forums.alliedmods.net/showthread.php?p=1545485 You need to custom this plugin to use a DR_DROPPED to count as quit |
Re: Count Player Leaves
Or simply incrementing his leaves in client_disconnect() and save it using nVault with AutdID
|
Re: Count Player Leaves
Quote:
|
Re: Count Player Leaves
Problem Solved.
Thanks for all answers. And special thanks Nextra for the code and sorry my ignorance. |
| All times are GMT -4. The time now is 21:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.