AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Hook player flag change (https://forums.alliedmods.net/showthread.php?t=320723)

iceeedr 01-05-2020 20:35

Hook player flag change
 
Is there any way to know the exact moment a player had its flags changed? Example someone wins admin in the middle of the round and I want to execute something the moment he had the flags changed ...

OciXCrom 01-05-2020 21:07

Re: Hook player flag change
 
Nope - https://github.com/alliedmodders/amxmodx/pull/475

We can just pray the PR gets reviewed soon.

Bugsy 01-05-2020 21:13

Re: Hook player flag change
 
I think you will just need to keep re-checking as I do not believe there are any events fired when flags are changed. It is not an expensive native so it's not the end of the world.

PHP Code:

static cell AMX_NATIVE_CALL get_user_flags(AMX *amxcell *params/* 2 param */
{
    
int index params[1];
    
    if (
index || index gpGlobals->maxClients)
    {
        
LogError(amxAMX_ERR_NATIVE"Invalid player id %d"index);
        return 
0;
    }
    
    
int id params[2];
    
    if (
id 0)
        
id 0;
    
    if (
id 31)
        
id 31;
    
    return 
GET_PLAYER_POINTER_I(index)->flags[id];



iceeedr 01-05-2020 21:46

Re: Hook player flag change
 
Thanks both of you.


All times are GMT -4. The time now is 02:52.

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