Raised This Month: $32 Target: $400
 8% 

Disconnect Reason


Post New Thread Reply   
 
Thread Tools Display Modes
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 09-01-2011 , 22:07   Re: Disconnect Reason
Reply With Quote #21

You don't really need the cvar dr_enabled. You could just use dr_type for enabling/disabling.

You also don't need to cache whether it is enabled during plugin_cfg since you do it in client_disconnect anyway.

Additionally, disconnects do not happen that often, so it seems unnecessary to use static variables.

It is also unnecessary to create Version as a constant global since it is used only once. You should just use it as an argument in register_plugin.

Another thing you should be aware of is that you don't need to put in the color codes as hex values. Escaping the number by itself (ie. ^1 instead of ^x01) works fine.

As xPaw pointed out (and you agreed upon) you should just use MSG_BROADCAST. If the color code is still attached to g_iDisconnectID, you should use it for ewrite_byte so the name will show in the color of the team the player was on.

Last thing to point out is that you missed a semicolon on line 57.

Otherwise, good job with this.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-01-2011 , 23:37   Re: Disconnect Reason
Reply With Quote #22

Quote:
Originally Posted by Emp` View Post
You don't really need the cvar dr_enabled. You could just use dr_type for enabling/disabling.
I could do that, heck, I could cram all options into a single cvar using bit flags. However, I prefer a separate cvar solely for enabled\disabled.

Quote:
Originally Posted by Emp` View Post
You also don't need to cache whether it is enabled during plugin_cfg since you do it in client_disconnect anyway.
Thanks for noticing. I added the plugin_cfg() g_bEnabled assignment while testing and I left it in accidentally. I was calling SV_DropClient_Post manually and needed the bool value updated prior to an actual player disconnecting.

Quote:
Originally Posted by Emp` View Post
Additionally, disconnects do not happen that often, so it seems unnecessary to use static variables.
Agreed.

Quote:
Originally Posted by Emp` View Post
It is also unnecessary to create Version as a constant global since it is used only once. You should just use it as an argument in register_plugin.
I am aware I could plug the value into register_plugin() directly but I choose not to. I write all of my plugins with a separate Version constant all the way at the top under the includes. I prefer this so when I release a new version I just go to the top to make my increment.

Quote:
Originally Posted by Emp` View Post
Another thing you should be aware of is that you don't need to put in the color codes as hex values. Escaping the number by itself (ie. ^1 instead of ^x01) works fine.
To be honest, my color chat function I obtained on the forums somewhere and I never bothered to modify how the values were laid out. Not that it matters which method is used, but relevant point.

Quote:
Originally Posted by Emp` View Post
As xPaw pointed out (and you agreed upon) you should just use MSG_BROADCAST. If the color code is still attached to g_iDisconnectID, you should use it for ewrite_byte so the name will show in the color of the team the player was on.

Last thing to point out is that you missed a semicolon on line 57.

Otherwise, good job with this.
Thanks for the comments.
__________________
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-02-2011 , 00:05   Re: Disconnect Reason
Reply With Quote #23

I posted a revised copy with corrections made. I will also update the signature as Arkshine suggested when I get a chance.
__________________
Bugsy is offline
Stressful
Senior Member
Join Date: Feb 2011
Old 09-03-2011 , 06:40   Re: Disconnect Reason
Reply With Quote #24

Doesn't work for me . As there's this error . How do I solve it ?
Code:
L 09/03/2011 - 18:35:48: [ORPHEU] Function "SV_DropClient" not found
L 09/03/2011 - 18:35:48: [AMXX] Run time error 10 (plugin "disconnect_reason.amxx") (native "OrpheuGetFunction") - debug not enable
__________________
Stressful is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-03-2011 , 07:00   Re: Disconnect Reason
Reply With Quote #25

Show the output of orpheu parsing the config file at server start. (server log)
__________________
Arkshine is offline
MostwantedScript
Senior Member
Join Date: Sep 2010
Location: Sweden,Gothenburg
Old 09-03-2011 , 15:29   Re: Disconnect Reason
Reply With Quote #26

Great idea! By the way did you get this idea from sa-mp?
__________________
Owner & Creator of
http://mostwantedhf.info
MostwantedScript is offline
Send a message via Skype™ to MostwantedScript
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 09-03-2011 , 15:35   Re: Disconnect Reason
Reply With Quote #27

Quote:
Originally Posted by MostwantedScript View Post
Great idea! By the way did you get this idea from sa-mp?
Quote:
Originally Posted by Bugsy View Post
Made by request.



Nice work Bugsy
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
MostwantedScript
Senior Member
Join Date: Sep 2010
Location: Sweden,Gothenburg
Old 09-03-2011 , 15:41   Re: Disconnect Reason
Reply With Quote #28

my fault
__________________
Owner & Creator of
http://mostwantedhf.info
MostwantedScript is offline
Send a message via Skype™ to MostwantedScript
.:cs.stambeto:.
Senior Member
Join Date: Feb 2010
Location: Bulgaria
Old 09-03-2011 , 16:21   Re: Disconnect Reason
Reply With Quote #29

Nice plugin!
.:cs.stambeto:. is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-03-2011 , 17:24   Re: Disconnect Reason
Reply With Quote #30

You should check if g_iDisconnectID is greater than 0 in SV_DropClient. It happened once that it printed server name.

P.S. I edited it to remove checks, so it prints all disconnect reasons, and works quite ok.
EDIT: Forgot to say that it works on linux.
__________________

Last edited by xPaw; 09-03-2011 at 17:28.
xPaw is offline
Reply


Thread Tools
Display Modes

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 12:36.


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