Raised This Month: $ Target: $400
 0% 

Vote Kick (With custom Reason) [Updated]


Post New Thread Reply   
 
Thread Tools Display Modes
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-15-2013 , 22:01   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #11

Update with more improve

Have fun
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Old 07-18-2013, 08:50
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: troll, or posting random confusing code, or posting for posts count
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 07-18-2013 , 19:43   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #12

I did not test this plugin. These are just observations from looking at your code:
  • Why do you use LANG_SERVER everywhere? This misses the point of using ML messages.
  • Having console commands prefixed with '.' (or anything similar for that matter) is unconventional. It is personal preference but triggers like this are usually reserved for chat commands.
  • task_exists is unnecessary for most applications. You can easily keep track of it yourself.
  • Your stop function could actively invaildate the vote menus.
  • Always update g_tUsed even if an admin has the ADMIN_VOTEKICK_FLAG. Then make the iMaxTimes check in cmdMain dependant on the admin flag. This way you better handle changing admin flags (unlikely, but good design).
  • Relying on entity ids in your menu is unsafe. A player might disconnect (you never check this) and someone else can even take his spot. You need additional verification here.
  • You use inconsistent indentation throughout your code. You should fix this.
  • (iBanTime > 1) ? "minutes" : "minute" could me using ML
  • Support for AMXBans or similar systems (if there are any) might be desirable for some people.
  • I don't know about others but I find this: Players = iPlayers[i]; to be confusing variable naming
  • You use get_players with a mix of "h" and "ch" flags. In some instances it seems like this is unintentional.
  • I believe you need to do more sanity checks around various cvars (negative values)
  • Also you're potentially risking some divide by 0 problems around get_percentage
  • Is there a technical reason for VK_MAX_REASON_LEN being this low?
  • You could use show_activity from amxmisc.inc for some admin-triggered messages.
  • You use is_user_admin to detect admins which may not be desirable, there could be players that just have a reserved slot or can not kick/ban people.

Please observe that a bunch of these are no demands but suggestions and hints that might make this plugin better as a result, both functionally and technically. Some things do require changes though in my opinion and might prevent this from being approved as a result. Also this list may or may not be complete.
__________________
In Flames we trust!

Last edited by Nextra; 07-18-2013 at 19:55.
Nextra is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-18-2013 , 21:21   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #13

Well some explanations:

Q. Why do you use LANG_SERVER everywhere? This misses the point of using ML messages.
A. Its based arround lang server, normally people not change an language of small plugins.

Q. Having console commands prefixed with '.' (or anything similar for that matter) is unconventional. It is personal preference but triggers like this are usually reserved for chat commands.
A. Its a bug, i forgot to replace with /votekick and place as chat command.

Q. task_exists is unnecessary for most applications. You can easily keep track of it yourself.
A. Its to check a end of vote and remove a menu from player that vote after session of VK

Q. Your stop function could actively invaildate the vote menus.
A. Yes its purpose, if someone vote after end of VK.

Q. Always update g_tUsed even if an admin has the ADMIN_VOTEKICK_FLAG. Then make the iMaxTimes check in cmdMain dependant on the admin flag. This way you better handle changing admin flags (unlikely, but good design).
A. I only add the used for player, admins can start votekick in unlimited times, but its a good idea.

Q. Relying on entity ids in your menu is unsafe. A player might disconnect (you never check this) and someone else can even take his spot. You need additional verification here.
A. Yes, its another bug thanks.

Q. You use inconsistent indentation throughout your code. You should fix this.
A. I really not understand correctly, fix indentation? Explain better.

Q. (iBanTime > 1) ? "minutes" : "minute" could me using ML
A. Yes, thanks.

Q. Support for AMXBans or similar systems (if there are any) might be desirable for some people.
A. If requested yes

Q. I don't know about others but I find this: Players = iPlayers[i]; to be confusing variable naming
A. I not but i see in most common codes in forums, its a my habit

Q. You use get_players with a mix of "h" and "ch" flags. In some instances it seems like this is unintentional.
A. Really yes, i tested whole plugin with bots ( Forever Alone )

Q. I believe you need to do more sanity checks around various cvars (negative values)
A. I think its a cvar (!somevalue) it will check for negative values and return 0 ??

Q. Also you're potentially risking some divide by 0 problems around get_percentage
A. Not using get_players i think, if someone has in server always return any value, and if no votes it will fail anyway.

Q. Is there a technical reason for VK_MAX_REASON_LEN being this low?
A. I think its better to use in menu and short readable in small votes

Q. You could use show_activity from amxmisc.inc for some admin-triggered messages.
A. thanks for suggestion

Q. You use is_user_admin to detect admins which may not be desirable, there could be players that just have a reserved slot or can not kick/ban people.
A. Yes, any admins will disable the votekick when he is online in server, its unecessary

For rest, it's depending from bug reports and testing..
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 07-19-2013 , 06:16   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #14

Quote:
Originally Posted by ^SmileY View Post
Q. Why do you use LANG_SERVER everywhere? This misses the point of using ML messages.
A. Its based arround lang server, normally people not change an language of small plugins.
Sorry, but this makes no sense. There are a lot of messages for player information that should be using ML. Use LANG_PLAYER and player ids for most if not all of them. You don't need to change the language of the plugin, AMXX does this automatically for every player.

Quote:
Originally Posted by ^SmileY View Post
Q. task_exists is unnecessary for most applications. You can easily keep track of it yourself.
A. Its to check a end of vote and remove a menu from player that vote after session of VK
I know, but you can keep track of the task running yourself with some global bool. task_exists is a crutch.

Quote:
Originally Posted by ^SmileY View Post
Q. Your stop function could actively invaildate the vote menus.
A. Yes its purpose, if someone vote after end of VK.
That's why you could menu_cancel for them. They can't use the menu then.

Quote:
Originally Posted by ^SmileY View Post
Q. Always update g_tUsed even if an admin has the ADMIN_VOTEKICK_FLAG. Then make the iMaxTimes check in cmdMain dependant on the admin flag. This way you better handle changing admin flags (unlikely, but good design).
A. I only add the used for player, admins can start votekick in unlimited times, but its a good idea.
I know what you want to do. But always do the counting and then let admins through later. This way you always have correct counts internally. If someone loses his rights halfway through a map you handle this better and it's a trivial change.

Quote:
Originally Posted by ^SmileY View Post
Q. You use inconsistent indentation throughout your code. You should fix this.
A. I really not understand correctly, fix indentation? Explain better.
Looking at it again it is just a minor issue. No worries.

Quote:
Originally Posted by ^SmileY View Post
Q. I don't know about others but I find this: Players = iPlayers[i]; to be confusing variable naming
A. I not but i see in most common codes in forums, its a my habit
Leave it if you like it but just to clarify my statement: Players is inconsistent with your style (uppercase, no tag prefix) and it's plural for a value that can only hold one player.

Quote:
Originally Posted by ^SmileY View Post
Q. I believe you need to do more sanity checks around various cvars (negative values)
A. I think its a cvar (!somevalue) it will check for negative values and return 0 ??
(!somevalue) is true if the value is 0, and only if it's 0. Negative values behave just like positive values, they are not 0. This could be a problem especially for the ban time cvars.

Quote:
Originally Posted by ^SmileY View Post
Q. Also you're potentially risking some divide by 0 problems around get_percentage
A. Not using get_players i think, if someone has in server always return any value, and if no votes it will fail anyway.
Players can disconnect. This is unlikely but still better to fix it.

Quote:
Originally Posted by ^SmileY View Post
Q. Is there a technical reason for VK_MAX_REASON_LEN being this low?
A. I think its better to use in menu and short readable in small votes
Good point.

Quote:
Originally Posted by ^SmileY View Post
Q. You use is_user_admin to detect admins which may not be desirable, there could be players that just have a reserved slot or can not kick/ban people.
A. Yes, any admins will disable the votekick when he is online in server, its unecessary
is_user_admin is true if a player has any admin flag. But players could have just ADMIN_RESERVATION or ADMIN_IMMUNITY - admins might award these to regulars. They can't issue bans or kicks but still stop your plugin from working. You should check flags yourself and ideally make it a cvar or at least a define.
__________________
In Flames we trust!
Nextra is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-19-2013 , 08:00   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #15

Thanks for especify errors, for indentation its an style of my code, like

if(value) bhastrue = true;

out instead of

if(value)
bhastrue = true

or maybe

if(value)
{
bhastrue = true
}

or something..

for is_user_admin i will check this and for task_exists().

I will re-write some part of plugin using your tips thanks.

Ah yeah, adding amx_bans or advanced_bans support ( i will check if plugin running and adjust it automatically.)
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 01-17-2014 , 02:09   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #16

/votekick <reason> change to >
/votekick = will open a menu votekick after player choose a member, will type a reason
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 01-17-2014 , 06:56   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #17

Not need, because i not have to use messagemod _some_command to open for player type the reason

__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
FinSmart
Junior Member
Join Date: Oct 2009
Location: Planet Pluto
Old 01-17-2014 , 07:50   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #18

nice plugin.. =3
__________________
Once A Camper,Always A Camper
FinSmart is offline
Send a message via MSN to FinSmart
gui1porpis
Member
Join Date: Jan 2009
Location: Brodowski, SP, Brazil
Old 07-21-2014 , 22:47   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #19

By say is not working, how to proceed?
Code:
	register_clcmd(".votekick","cmdMain", 	.info = "<Reason> - Main Vote Kick Menu");
	register_concmd(".stopvotekick","cmdStop",ADMIN_VOTEKICK_FLAG,"- Cancels Vote Kick in progress");
__________________
gui1porpis is offline
Send a message via MSN to gui1porpis Send a message via Skype™ to gui1porpis
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-22-2014 , 11:37   Re: Vote Kick (With custom Reason) [Updated]
Reply With Quote #20

Describe your problem,
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 05:57.


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