Raised This Month: $ Target: $400
 0% 

Win Messages Changer


Post New Thread Reply   
 
Thread Tools Display Modes
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-17-2013 , 11:44   Re: Win Messages Changer
Reply With Quote #41

You misunderstood the buffer and cvar thing, you don't need to retrieve the 2 cvar values each times.

PHP Code:
    new t_won_msg[MAX_CHARACTERS 1], ct_won_msg[MAX_CHARACTERS 1]
    
get_pcvar_string(msgcvar_tt_won_msgMAX_CHARACTERS)
    
get_pcvar_string(msgcvar_ctct_won_msgMAX_CHARACTERS
Just create 1 array, and set it with the needed cvar, according to WinningTeam.
Then you can let as it was previously, different colours depending on winning team.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 07-17-2013 , 17:05   Re: Win Messages Changer
Reply With Quote #42

I tried create 2 arrays, each one for one cvar but then the message that was displayed was from default game
__________________
Jhob94 is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 07-17-2013 , 19:03   Re: Win Messages Changer
Reply With Quote #43

There is no need for two arrays.
PHP Code:
new won_msg[MAX_CHARACTERS 1]
get_pcvar_string(WinningTeam == msgcvar_t msgcvar_ctwon_msgMAX_CHARACTERS
__________________
In Flames we trust!
Nextra is offline
DIS
Senior Member
Join Date: Jul 2013
Location: Somewhere Here xD
Old 07-18-2013 , 07:37   Re: Win Messages Changer
Reply With Quote #44

What about Round Draw message?
I know maybe there is no usage of it but it should have this feature at least to get approved (If the other same plugin don't have the Round Draw message).
DIS is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 07-18-2013 , 16:23   Re: Win Messages Changer
Reply With Quote #45

Updated.
Instead of do that, i made it read cvars in plugin_init, so it will only check cvar once. Better no?
__________________
Jhob94 is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 07-18-2013 , 16:39   Re: Win Messages Changer
Reply With Quote #46

Now they can't be changed during gameplay anymore. Plus, even if you would want to do it like this, it would have to be done in plugin_cfg and not in plugin_init.

The only sensible alternative you have would be converting the cvars to console commands that update the buffers when they are used.

But this is only called once per round and has no performance impact whatsoever. No point in making these optimizations. Just read them out like before but remove the unnecessary code.
__________________
In Flames we trust!
Nextra is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 07-18-2013 , 17:17   Re: Win Messages Changer
Reply With Quote #47

Updated, is it now ok?
Btw it doesnt affects the "performance impact" so it was really needed?
__________________
Jhob94 is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 07-18-2013 , 18:56   Re: Win Messages Changer
Reply With Quote #48

There is a difference.

You can make a negligible performance improvement that takes a disproportionate amount of work and/or unnecessarily sacrifices usability which misses the point and scope of your plugin totally.

And you can remove a completely unnecessary buffer that has no business being there in the first place. You need to branch based on WinningTeam anyway so why use two buffers when you always use just one of them.

This was a trivial change that makes the code cleaner and simpler, DRY is the magic keyword. The added benefit of a minute performance gain is not the main issue here, code design is.

Also, there may be a point where rather obvious stuff like this can make the difference (like if a similar function was called very frequently or in a rapid succession).
__________________
In Flames we trust!
Nextra is offline
KabirDuy
New Member
Join Date: Jul 2013
Old 07-24-2013 , 05:36   Re: Win Messages Changer
Reply With Quote #49

Good! But not necessary.
__________________
KabirDuy is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 07-24-2013 , 19:58   Re: Win Messages Changer
Reply With Quote #50

Updated.
Now it supports round draw message.
__________________
Jhob94 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 20:54.


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