-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modernize and improve imessage.sma #575
base: master
Are you sure you want to change the base?
Conversation
And scrollmsg plugin display only dead fix it? |
@all85100 It will be done later in a separate PR. This one is only for |
Just a note about the next time you do a lot of changes in a plugin, please try to break down in multiple commits. As much as you can. It will be easier to review. Here, I would have made a commit for the style, the moving code, bind_cvar, etc. |
@Arkshine Got it. |
You should use |
@IgnacioFDM That's not necessary. There's no need to force users to use semicolons. It's just a coding style. Half of the plugins have semicolons, so it's just right to add them where they're missing. |
I mean, if the entire plugin is going to have semicolons, for consistency it's best to tell the compiler to keep it that way. Otherwise you end up with what you are trying to fix with this PR: Some lines have semicolons, some don't. |
@IgnacioFDM I added |
There's no |
Yes, but when beginners want to make changes to the file for their server, they probably won't know that they must use semicolons. It's not that big of a deal really. Let's see what @Arkshine has to say. |
|
||
bind_pcvar_num(create_cvar("amx_imessage_only_dead", "0", _, "Set to 1 to show info messages only to dead clients", true, 0.0, true, 1.0), g_amx_imessage_only_dead); | ||
bind_pcvar_float(create_cvar("amx_freq_imessage", "180", _, "Frequency in seconds of info messages", true, 0.0), g_amx_freq_imessage); | ||
bind_pcvar_float(create_cvar("amx_imessage_x_pos", "-1.0", _, "X position for info messages", true, -1.0, true, 1.0), g_amx_imessage_x_pos); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bound logic doesn't fit good here, because the valid values are 0.0 <= x <= 1.0 || x == -1.0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, but it's the only available way to set the boundaries. Anyways, values from -1.0 to 0.0 won't output any errors so it's not a big deal. It can be done via hooking the cvar and checking it there, but I don't know if it's necessary to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OciXCrom this can be an example for custom validation. And I think it would be better to add a param for custom filter in create_cvar
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this may be very useful. The params in create_cvar
definitely need some rework.
The changes include:
amx_imessage_only_dead
to control whether or not the messages will show only to dead players (requested in About the scrollmsg and imessage plugins #571).amx_imessage_x_pos
to set the X position rather than having it hardcoded in the .sma file.amx_imessage_y_pos
to set the Y position rather than having it hardcoded in the .sma file.amx_imessage_holdtime
to set the holdtime rather than having it hardcoded in the .sma file.create_cvar
andbind_pcvar_*
functions instead of the old ones.show_hudmessage
toShowSyncHudMsg
to prevent overlapping messages if the repeat time is shorter.