Raised This Month: $ Target: $400
 0% 

Player-Based CVARs


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-03-2012 , 06:18   Re: Player-Based CVARs
Reply With Quote #31

Forward_PutInServer_Post :

- Cache the g_aCommandsHolder[ iPlayers ] value.
- Cache the g_aCvarHolder[ iPlayers ] value.
- In the first part, you could use directly ArrayGetStringHandle(), it will avoid to retrieve the string before.
- In the second part of the code, I would check iSize so it would not create aData if 0.

Forward_Disconnect_Post/Forward_PutInServer_Post :

- Cache the g_aCommandsHolder[ iPlayers ] value.
- Cache the g_aCvarHolder[ iPlayers ] value.
- In the first part, you could use directly ArrayGetStringHandle(), it will avoid to retrieve the string before.
- In the second part of the code, I would check iSize so it would not create aData if 0.
- Cache g_aCvarHolder[ iPlayers ].

Actually since it's basically the same code, you could use one function for both.

Cmd_AddCommand :

- You should retrieve the second argument after the iPlayers check.

Cmd_AddCvar :

- You should retrieve the second argument after the iPlayers check.
- You should retrieve the third argument after the aData check.
__________________
Arkshine is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-18-2012 , 08:25   Re: Player-Based CVARs
Reply With Quote #32

No changes done. Author seems inactive. Unapproved.
__________________
Arkshine is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 07-07-2012 , 00:29   Re: Player-Based CVARs
Reply With Quote #33

Quote:
Originally Posted by Arkshine View Post
Forward_PutInServer_Post :

- Cache the g_aCommandsHolder[ iPlayers ] value.
- Cache the g_aCvarHolder[ iPlayers ] value.
- In the first part, you could use directly ArrayGetStringHandle(), it will avoid to retrieve the string before.
- In the second part of the code, I would check iSize so it would not create aData if 0.

Forward_Disconnect_Post/Forward_PutInServer_Post :

- Cache the g_aCommandsHolder[ iPlayers ] value.
- Cache the g_aCvarHolder[ iPlayers ] value.
- In the first part, you could use directly ArrayGetStringHandle(), it will avoid to retrieve the string before.
- In the second part of the code, I would check iSize so it would not create aData if 0.
- Cache g_aCvarHolder[ iPlayers ].

Actually since it's basically the same code, you could use one function for both.

Cmd_AddCommand :

- You should retrieve the second argument after the iPlayers check.

Cmd_AddCvar :

- You should retrieve the second argument after the iPlayers check.
- You should retrieve the third argument after the aData check.
Done. Updated to v1.1.1.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-07-2012 , 03:19   Re: Player-Based CVARs
Reply With Quote #34

Since you are back, thread moved to Review section, will see later.
__________________
Arkshine is offline
flaxo
Member
Join Date: Nov 2013
Old 11-23-2013 , 08:23   Re: Player-Based CVARs
Reply With Quote #35

Can you maybe somehow add a timer Cvar which counts the number of players connected after a mapchange, only within X seconds?
For example I'd like to use this plugin together with a Auto-Round Restart plugin. The player_cvars.ini file should be something like this:

Quote:
[10] (Auto-Restart only if 10+ players are connected)
cvar_autorestartpluginenable 1 (The AutoRR's plugin Cvar for plugin enabling)
sv_restart 1
However, if during the gameplay the number of players falls below 10 and after a while gets over 10 again, the server will auto-restart again just like a new map change causing some players to dissatisfy and disconnect.
Hope you undestood what I want to say. Thanks in advance

Last edited by flaxo; 11-23-2013 at 08:27.
flaxo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-20-2014 , 08:23   Re: Player-Based CVARs
Reply With Quote #36

Please avoid using ArraySize() in a loop, cache the value.

Anyway, it sounds good enough.

Approved.
__________________
Arkshine is offline
zaludan
Member
Join Date: Aug 2012
Old 06-04-2014 , 13:49   Re: Player-Based CVARs
Reply With Quote #37

Am I doing something wrong, or it doesn't work with non-default cvars?
I'm trying to make it work with Voices Management (https://forums.alliedmods.net/showth...02274?p=602274) and it just doesn't.
zaludan 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 07:30.


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