Raised This Month: $ Target: $400
 0% 

Boolean Reset Only Disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 02-17-2017 , 07:33   Boolean Reset Only Disconnect
Reply With Quote #1

I have an array g_canJoin[33]

So i reset the value after client disconnect:
g_canJoin[id]= false;

Do i need to reset it also on client_connect?

I heard that sometimes when client crashes or looses internet connection there is a chance that player_disconnect event doesnt trigger after player disconnection.

This means that after one player's disconnect without player_disconnect event then boolean will stay true on connection instead of false.

Is this true? And is it safe to reset boolean value only on disconnect?

Last edited by siriusmd99; 02-17-2017 at 07:36.
siriusmd99 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-17-2017 , 07:58   Re: Boolean Reset Only Disconnect
Reply With Quote #2

Depends the situation, example in Ice Cube plugin, you must reset it on disconnect either if player is frozen and disconnects the ice cube will remain. It's not necessary to reset on both forwards, reset it just on client_disconnect or just client_connect , just put some logic into it.
__________________

Last edited by edon1337; 02-17-2017 at 07:59.
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-17-2017 , 08:13   Re: Boolean Reset Only Disconnect
Reply With Quote #3

For amxx < 183, there is a chance that client_disconnect won't be fired. A new forward was added in 1.8.3 to fix this problem. Depending on what amxx version you use, decide when to reset.
__________________
HamletEagle is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 02-17-2017 , 08:22   Re: Boolean Reset Only Disconnect
Reply With Quote #4

Quote:
Originally Posted by edon1337 View Post
Depends the situation, example in Ice Cube plugin, you must reset it on disconnect either if player is frozen and disconnects the ice cube will remain. It's not necessary to reset on both forwards, reset it just on client_disconnect or just client_connect , just put some logic into it.
You want logic? Ok.
For example I check users for inconsistent files (such as client side .dll files which can be fake cvar spoofer or different cheats) and if it doesn't find such file (incosistent file) it sets boolean allowed to true, else it sets boolean to false.
After that i check in putinserver boolean and if it's false then i kick player.

The problem is that I can't set allowed to false on connect because plugin_precache is triggered before client_connect. And imagine that case when client_disconnect is not triggered. It means that even if player has that file then boolean still remains true from previous disconnected player.
siriusmd99 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-17-2017 , 08:40   Re: Boolean Reset Only Disconnect
Reply With Quote #5

Then, use both.
__________________
edon1337 is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 02-17-2017 , 09:42   Re: Boolean Reset Only Disconnect
Reply With Quote #6

If client is between connect and putinserver then client_disconnect is not called. If client is after putinserver then client_disconnect must be called always.

What is the problem to use client_connect for resetting?
__________________

Last edited by PRoSToTeM@; 02-17-2017 at 09:44.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 02-17-2017 , 10:18   Re: Boolean Reset Only Disconnect
Reply With Quote #7

Quote:
Originally Posted by PRoSToTeM@ View Post
If client is between connect and putinserver then client_disconnect is not called. If client is after putinserver then client_disconnect must be called always.

What is the problem to use client_connect for resetting?
Because value is set on precache. g_allowed= true is set on precache.
But precache is called before client_connect.
siriusmd99 is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 02-17-2017 , 10:58   Re: Boolean Reset Only Disconnect
Reply With Quote #8

Quote:
Originally Posted by siriusmd99 View Post
Because value is set on precache. g_allowed= true is set on precache.
But precache is called before client_connect.
What is g_allowed? Why u need precache?
Just set g_canJoin[x] = true in client_connect and reset it if something goes wrong.
__________________

Last edited by PRoSToTeM@; 02-17-2017 at 11:00.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-17-2017 , 11:53   Re: Boolean Reset Only Disconnect
Reply With Quote #9

In 183 isn't client_disconnected()?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 02-18-2017 , 10:43   Re: Boolean Reset Only Disconnect
Reply With Quote #10

Quote:
Originally Posted by HamletEagle View Post
For amxx < 183, there is a chance that client_disconnect won't be fired. A new forward was added in 1.8.3 to fix this problem. Depending on what amxx version you use, decide when to reset.
But does FM's FM_ClientDisconnect for example work properly and cover all the cases?
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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 20:44.


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