AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=7)
-   -   Add a flags update forward in 1.8.3 (https://forums.alliedmods.net/showthread.php?t=303962)

OciXCrom 12-29-2017 08:38

Add a flags update forward in 1.8.3
 
Please, just do it. It's not hard to do. Making plugins for admin prefixes and stuff like that is pure death. You have to make multiple checks and functions in order to properly update the prefix when the flags change (on connect, on name change, etc) and you can't possibly detect all cases without editing other plugins.

PHP Code:

/* Called when the user's flags are changed. */
forward client_flags_updated(idiFlags); 


Relaxing 12-29-2017 09:14

Re: Add a flags update forward in 1.8.3
 
Can you show any idea how to make this forward just by describing it? Also for what iFlags stands?

OciXCrom 12-29-2017 09:18

Re: Add a flags update forward in 1.8.3
 
What more descirption do you need than "called when the admin flags are updated"? It stand for the user's current flags.

Relaxing 12-29-2017 13:51

Re: Add a flags update forward in 1.8.3
 
Quote:

Originally Posted by Relaxing (Post 2568701)
how to make


OciXCrom 12-29-2017 14:05

Re: Add a flags update forward in 1.8.3
 
Do you know what a forward is? Are you an AMXX developer? Probably no to both questions. Just leave this to the people who it's meant for.

Relaxing 12-29-2017 18:04

Re: Add a flags update forward in 1.8.3
 
Quote:

Originally Posted by OciXCrom (Post 2568749)
Do you know what a forward is? Are you an AMXX developer? Probably no to both questions. Just leave this to the people who it's meant for.

You submitted a suggestion that you cannot even describe by just using words. Pointless

fysiks 12-29-2017 18:20

Re: Add a flags update forward in 1.8.3
 
He's actually described it enough to know exactly what he is requesting.

fysiks 12-30-2017 02:22

Re: Add a flags update forward in 1.8.3
 
The request is not directly related to the admin prefixes plugin. The requested feature is something that would be used inside of such a plugin for knowing when admin flags change.

So, the request is fully described in the code block (with two lines of code; one being a comment line) and the rest of his post is an explanation as to why he wants such a feature.

OciXCrom 12-30-2017 08:26

Re: Add a flags update forward in 1.8.3
 
I can try doing this myself and submit a pull request, but I have no clue on how to compile the .cpp/.h files to get actual modules. Any quick tutorials? Is this going to work for the default AMXX files too?

amxmodx.cpp:
Code:
static cell AMX_NATIVE_CALL set_user_flags(AMX *amx, cell *params) /* 3 param */ {     int index = params[1];     if (index < 0 || index > gpGlobals->maxClients)     {         LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);         return 0;     }     CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);     int flag = params[2];     int id = params[3];     if (id < 0)         id = 0;     if (id > 31)         id = 31;     pPlayer->flags[id] |= flag;     executeForwards(FF_ClientFlagsUpdated, static_cast<cell>(index), static_cast<cell>(flag), static_cast<flags[id]>(i));     return 1; }

^ Don't kill me if what I wrote makes no sense.

klippy 12-30-2017 08:47

Re: Add a flags update forward in 1.8.3
 
Wouldn't hurt to try it yourself, it's a great experience.

Anyway if you are on Windows you would need either Visual Studio 2013+ or just C++ Build Tools (I don't know if this will work, but it should). You also need Git to download necessary stuff (you can do without it, but it will make it easier) and Python installed to run AMBuild.

Go to a directory where you want to download all this stuff and execute in order:
Code:

### First time setup ###

git clone https://github.com/alliedmodders/ambuild
python ambuild/setup.py install
git clone https://github.com/alliedmodders/hlsdk
git clone https://github.com/alliedmodders/metamod-hl1
git clone https://github.com/alliedmodders/amxmodx

### Build process ###

#Now vcvars32.bat may not be in your PATH env variable.
#It seems like it's usually under "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin" (May be other than 14.0 depending on VS version).
#You have to run it in THE CURRENT cmd.exe INSTANCE for it to set up some environment variables (like the path to your compiler).
vcvars32
mkdir amxmodx/obj-windows
cd amxmodx/obj-windows

#configure.py will throw an exception if the compiler isn't found (for example: vcvars32 not executed)
python ../configure.py --no-mysql

###Finally build
ambuild

If you want to contribute, before making any changes to the source tree first check if the build process works for you.
Now that you made sure it works, to make a contribution go to https://github.com/alliedmodders/amxmodx and click the "Fork" button.
Make sure your current working directory is where you cloned amxmodx and execute following commands to set remote repositories. This is a one-time setup.
Code:

git remote set-url origin https://github.com/<your GH username>/amxmodx
git remote add upstream https://github.com/alliedmodders/amxmodx

Now that you want to make a change do
Code:

git checkout master #Switch to the master branch
git pull upstream master #Update your master branch to match alliedmodders' one
git checkout -b admin-flags-forward #Create a new branch named admin-flags-forward and switch to it

### Make changes ###

#Check what files have been changed. You DON'T want to commit just any file, only the ones that really concern your update.
#For example opening the project in Visual Studio or some other IDE is known to change/add some files to the source tree.
#You don't want any temporary/backup files commited, only the ones you actually updated.
git status

#Add files that you want to commit, relative to the current working directory.
#If there are no files that you WOULDN'T want to commit you can just do "git add -a" to add all.
#For example if you changed "amxmodx/amxmodx.cpp", "amxmodx/meta_api.cpp" and "plugins/include/amxmodx.inc" you would execute
git add "amxmodx/amxmodx.cpp" "amxmodx/meta_api.cpp" "plugins/include/amxmodx.inc"

#Finally commit your update, together with a short, but descriptive message, and push it to your GitHub.
git commit -m "Add a flags update forward client_flags_updated"
git push origin admin-flags-forward

Now when you go to your "amxmodx" either on your or AlliedModders' account on GitHub a "Compare and Pull Request" button will pop up.


All times are GMT -4. The time now is 06:41.

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