-
-
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
Add a flags update forward and a override param in set_user_flags #475
base: master
Are you sure you want to change the base?
Changes from 2 commits
8659c90
163b4e8
e2c7ecb
b4170b4
a3f5769
6edebc9
9b26923
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,16 @@ forward client_connect(id); | |
*/ | ||
forward client_connectex(id, const name[], const ip[], reason[128]); | ||
|
||
/** | ||
* Called after the client's admin flags are changed. | ||
* | ||
* @param id Client index | ||
* @param flags New client flags | ||
* | ||
* @noreturn | ||
*/ | ||
forward client_flags_updated(id, flags); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd also pass id of set here, so we'll know which set of flags has been updated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I never knew different sets of flag existed until I saw the actual .cpp file. Are different sets ever used? Because if not, it would be rather unnecessary to have to write the set argument every time we use the forward if we'll never have to use it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have to write all params in forward, they can be skipped, so if someone doesn't depend on sets, they can safely omit last param. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I knew they existed but I never knew their purpose. The doc says:
I almost feel that we should just ignore flag sets and use a single one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even if AMXX doesn't use other values than 0, it still may be used by 3rd plugins for their some specific permission system, so they don't mess up with the AMXX's one. I think including that param wouldn't do much harm, but it's just my opinion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Amaroq7 we can add it later if someone really uses sets. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually if they can really be skipped when using the forwards (haven't actually checked this), then there's really no problem if that param can be passed too. I'll check this tomorrow and add it if that's the case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Amaroq7 @rsKliPPy @WPMGPRoSToTeMa - I added the flag set as the last parameter in the forward, so people can skip it if not needed. I also passed the old flags so people can see which flags were changed. |
||
|
||
/** | ||
* Called when the client gets a valid SteamID. | ||
* | ||
|
@@ -1814,7 +1824,7 @@ native task_exists(id = 0, outside = 0); | |
* @error If the index is not within the range of 0 to MaxClients, an | ||
* error will be thrown. | ||
*/ | ||
native set_user_flags(index, flags = -1, id = 0); | ||
native set_user_flags(index, flags = -1, id = 0, bool:override = false); | ||
|
||
/** | ||
* Returns the client's admin flags as a bitflag sum. | ||
|
@@ -1826,6 +1836,7 @@ native set_user_flags(index, flags = -1, id = 0); | |
* | ||
* @param index Client index, 0 to set flags of server | ||
* @param id Flag set id, ranging from 0 to 31 | ||
* @param override If set to true, all other flags will be removed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Misplaced param's description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, I always get confused when viewing .inc files because of the way the description is placed above the native. Fixed. |
||
* | ||
* @noreturn | ||
* @error If the index is not within the range of 0 to MaxClients, an | ||
|
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.
You need to check for parameter availability here.
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.
Sorry, I'm fairly new to this. How do I exactly add that check?
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.
Here's an example
amxmodx/amxmodx/amxmodx.cpp
Line 1443 in 7b3646a
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.
Is it actually necessary? The 4th parameter has a default value of "false" if it's not used. Just curious why it's needed.
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 you will need to recompile all plugins that using
get_players
.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 Plugins that don't get compiled against the new *.inc will pass you 3 parameters, and core needs to handle that situation gracefully.
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.
@Nextra @Amaroq7 @WPMGPRoSToTeMa - Thanks, I added the necessary check.