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

HighPingKicker OLO Based/Updated [22/10/2022]


Post New Thread Reply   
 
Thread Tools Display Modes
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 09-07-2021 , 13:48   Re: HighPingKicker OLO Based/Updated [23/08/2021]
Reply With Quote #91

1 - The problem with client_authorized for this question is that sometimes it is called before putinserver, which ended up making the task unfeasible because the player falls into the is_user_connected(id) check, I believe my solution using the native is_user_authorized(id) is a good one, leave your comment if possible.

2 - You're right, changed as described, the task was lack of attention, adjusted.

3 - My style varies from day to day hahaha, but you're right, when the plugin is for other people's use, consistency becomes necessary, done.

4 - Created a global variable to hold the average ping value and broken the check in 2 parts for better reading.

5 - Lack of attention, adjusted.

6 - Done.

Thanks for the teachings in general, especially regarding styles and names, I hope to contribute even more to the community.

Edit 1: The reason I created the version with ent think was thinking that maybe it would be lighter than using tasks, however, for your surprise and displeasure I believe I'm wrong, which is why I remove this version.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 09-07-2021 at 13:53.
iceeedr is offline
Send a message via Skype™ to iceeedr
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-07-2021 , 13:58   Re: HighPingKicker OLO Based/Updated [23/08/2021]
Reply With Quote #92

You don't need to have g_AveragePing global, since it is used only inside CheckPing. You could simply do:
PHP Code:
new AveragePing = (ePlayerData[id][g_Ping] / ePlayerData[id][g_Samples]) 
In general, it is best to avoid global variables, where possible. In pawn plugins, it is kinda hard since you have to maintain state and you can't do so by passing parameters around. But in this particular case, you can get rid of that global.
Also, compute the average once you have enough samples(in the if check if(ePlayerData[id][g_Samples] >= pCvars[VarTest])).

Other than that, everything looks fine.
__________________

Last edited by HamletEagle; 09-07-2021 at 14:00.
HamletEagle is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 09-07-2021 , 14:05   Re: HighPingKicker OLO Based/Updated [23/08/2021]
Reply With Quote #93

Quote:
Originally Posted by HamletEagle View Post
You don't need to have g_AveragePing global, since it is used only inside CheckPing. You could simply do:
PHP Code:
new AveragePing = (ePlayerData[id][g_Ping] / ePlayerData[id][g_Samples]) 
In general, it is best to avoid global variables, where possible. In pawn plugins, it is kinda hard since you have to maintain state and you can't do so by passing parameters around. But in this particular case, you can get rid of that global.
Also, compute the average once you have enough samples(in the if check if(ePlayerData[id][g_Samples] >= pCvars[VarTest])).

Other than that, everything looks fine.
Creating the variable as you said it allocates only 1 id and will be overwritten for each player the task runs, correct me if I'm wrong, but the variable doesn't need to be global [32 + 1]?

Edit: Forget it, I get what you mean, done.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 09-07-2021 at 14:10.
iceeedr is offline
Send a message via Skype™ to iceeedr
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-07-2021 , 14:10   Re: HighPingKicker OLO Based/Updated [23/08/2021]
Reply With Quote #94

Quote:
Originally Posted by iceeedr View Post
Creating the variable as you said it allocates only 1 id and will be overwritten for each player the task runs, correct me if I'm wrong, but the variable doesn't need to be global [32 + 1]?
Nope. You don't do set_task only once, you do it for every player, because ApplyDelayedPingCheck is called for each player which joins the server. putinserver -> InitializePluginChecks -> ApplyDelayedPingCheck -> CheckPing.

Another way to think about this is that the task id is computed using player's id id + TASKCHECK, so you actually end up with 32 different tasks. Generally, if a function has a player id as an argument(even if it's a id + TASK_ID) then it is called individually for each player. If it was a global function(see HLTV for example), you wouldn't be able to have an "id" parameter.
__________________
HamletEagle is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 09-07-2021 , 14:11   Re: HighPingKicker OLO Based/Updated [23/08/2021]
Reply With Quote #95

Quote:
Originally Posted by HamletEagle View Post
Nope. You don't do set_task only once, you do it for every player, because ApplyDelayedPingCheck is called for each player which joins the server. putinserver -> InitializePluginChecks -> ApplyDelayedPingCheck -> CheckPing.

Another way to think about this is that the task id is computed using player's id id + TASKCHECK, so you actually end up with 32 different tasks. Generally, if a function has a player id as an argument(even if it's a id + TASK_ID) then it is called individually for each player. If it was a global function(see HLTV for example), you wouldn't be able to have an "id" parameter.
Yes, after thinking a bit I understood and made the change.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-07-2021 , 14:12   Re: HighPingKicker OLO Based/Updated [23/08/2021]
Reply With Quote #96

Good job, approved. I will also check the older plugins and unapprove them if needed.
__________________

Last edited by HamletEagle; 09-07-2021 at 14:12.
HamletEagle is offline
AllMassive
Senior Member
Join Date: Sep 2004
Location: /dev/urandom
Old 10-19-2021 , 23:02   Re: HighPingKicker OLO Based/Updated [23/08/2021]
Reply With Quote #97

dont know if it matters to anybody else, but i'm still using the old amxbans5 plugin (for some reason) and the lang-variables of this plugin interfere with the ones from amxbans.txt and by this players didnt have been kicked after they've been banned from the server.
Code:
L 10/20/2021 - 00:53:38: String formatted incorrectly - parameter 6 (total 5)
L 10/20/2021 - 00:53:38: [AMXX] Displaying debug trace (plugin "amxbans5.amxx", version "5.0")
L 10/20/2021 - 00:53:38: [AMXX] Run time error 25: parameter error
L 10/20/2021 - 00:53:38: [AMXX]    [0] amxbans5.sma::delayed_kick (line 394)
line 394 of my amxbans5.sma:
Code:
format(kick_message,127,"%L", LANG_PLAYER,"KICK_MESSAGE")
i needed to change the variable KICK_MESSAGE to KICK_MESSAGE1 in Newpingkicker.txt and also in the Newpingkicker.sma.

Last edited by AllMassive; 10-19-2021 at 23:05. Reason: typo
AllMassive is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-20-2021 , 10:19   Re: HighPingKicker OLO Based/Updated [23/08/2021]
Reply With Quote #98

@iceeedr, I forgot during the review, but you should try to create unique lang keys. A good idea is to prefix your keys with the name of your plugin, for example: HPK_KEY_NAME.
__________________

Last edited by HamletEagle; 10-20-2021 at 10:19.
HamletEagle is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-20-2021 , 11:01   Re: HighPingKicker OLO Based/Updated [20/10/2021]
Reply With Quote #99

I apologize for not having noticed this potential error, the plugin has been updated.

PHP Code:
1.5.1 [20/10/2021] - Updated LANG
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-21-2021 , 10:27   Re: HighPingKicker OLO Based/Updated [20/10/2021]
Reply With Quote #100

For romanian translation:

Code:
HPK_WARNING_MESSAGE = ^4[HPK]^1 Jucatori cu ping-ul mai mare de ^4 %d^1 vor primii kick.
->

Code:
HPK_WARNING_MESSAGE = ^4[HPK]^1 Jucatorii cu ping-ul mai mare decat ^4 %d^1 vor primi kick.
__________________
HamletEagle is offline
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 15:05.


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