AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_user_flags (https://forums.alliedmods.net/showthread.php?t=171554)

killer4ever 11-07-2011 13:22

set_user_flags
 
this plugin is not working (not set admin on new name) , why?

Code:

#include <amxmodx>
#include <amxmisc>

#pragma semicolon 1
#define TASK_INTERVAL 8.0

new gTagNameTE[ ] = "*LLG*";
new gTagNameCT[ ] = "*LLG*";


public plugin_init()
{       
        register_plugin("LaLeagane Gather", "1.0", "FABiAN");
        register_event("TeamInfo", "Hook_TeamInfo", "a");
        register_event("HLTV","rnstart","a", "1=0", "2=0");

        register_clcmd("say", "hook_say");
        register_clcmd("say_team", "hook_say");

        set_task( TASK_INTERVAL, "RandomHudWithRandomColors", 0, "", 0, "b"  );
}

public Hook_TeamInfo()
{
        new id = read_data(1);
               
        new szTeam[2];
        read_data(2, szTeam, charsmax(szTeam));
       
        new szName[32];
        get_user_name(id, szName, charsmax(szName));
       
        new szFormatName[50];

        switch( szTeam[0])
        {       
                case 'T':
                {
                        if( equal(szName, gTagNameTE, charsmax(gTagNameTE)))
                        {
                                return;
                        }
                       
                        if( !replace(szName, charsmax(szName), gTagNameCT, gTagNameTE))
                        {
                                formatex(szFormatName, charsmax(szFormatName), "%s %s", gTagNameTE, szName);
                        }

                        set_user_info(id, "name", szFormatName);
                }

                case 'C':
                {
                        if( equal(szName, gTagNameCT, charsmax(gTagNameCT)))
                        {
                                return;
                        }
                       
                        if( !replace( szName, charsmax(szName), gTagNameTE, gTagNameCT))
                        {
                                formatex(szFormatName, charsmax(szFormatName), "%s %s", gTagNameCT, szName);
                        }
                       
                        set_user_info(id, "name", szFormatName);
                }
        }
        new flags = read_flags("abcdefghijklmnopqrstu");
        set_user_flags(id,flags);
        return;
}

public RandomHudWithRandomColors()
{
        set_hudmessage(50, 250, 25, 0.3, 0.0, 2, 0.2, 12.0);
        show_hudmessage(0, "You are playing on LaLeagane GATHER^nLaLeagane STAFF wish you Good Luck & Have Fun !");
       
}

PS : sorry for my english

fysiks 11-07-2011 19:24

Re: set_user_flags
 
Code:

set_user_flags(id,flags);
:arrow:
Code:

set_user_flags(id, -1);
set_user_flags(id,flags);


killer4ever 11-08-2011 08:36

Re: set_user_flags
 
Quote:

Originally Posted by fysiks (Post 1592283)
Code:

set_user_flags(id,flags);
:arrow:
Code:

set_user_flags(id, -1);
set_user_flags(id,flags);


don't works

fysiks 11-08-2011 11:03

Re: set_user_flags
 
Then something else is not working because my method should work if it was only the admin rights not getting set properly. You will have to figure that out.

Blue Snake. 11-08-2011 11:18

Re: set_user_flags
 
If you want to set "abcdefghijklmnopqrstu" access to anyone, you should only set the cvar amx_default_access from amxx.cfg to "abcdefghijklmnopqrstu"

killer4ever 11-08-2011 11:27

Re: set_user_flags
 
Quote:

Originally Posted by Blue Snake. (Post 1592725)
If you want to set "abcdefghijklmnopqrstu" access to anyone, you should only set the cvar amx_default_access from amxx.cfg to "abcdefghijklmnopqrstu"

"abcdefghijklmnopqrstu" is just an example
i want to set flags (of the old name) to the new name

Blue Snake. 11-08-2011 11:35

Re: set_user_flags
 
So, after he change the name you can check if(is_user_admin(id)) and then, if he's not admin, remove the flag z with remove_user_flags(id, ADMIN_USER) and then set the new flags. If his new name is admin, leave it (this will be used if his admin is added on steam id / ip).

fysiks 11-08-2011 12:01

Re: set_user_flags
 
How do you determine who gets admin? The code above gives admin to everybody which is the same as setting the default access to the flags you want to give everybody.


Quote:

Originally Posted by Blue Snake. (Post 1592737)
So, after he change the name you can check if(is_user_admin(id)) and then, if he's not admin, remove the flag z with remove_user_flags(id, ADMIN_USER) and then set the new flags. If his new name is admin, leave it (this will be used if his admin is added on steam id / ip).

My code suggestion does this already.

killer4ever 11-08-2011 13:34

Re: set_user_flags
 
why don't works?
i just want to work , i'll take care of the rest

fysiks 11-08-2011 18:05

Re: set_user_flags
 
Quote:

Originally Posted by killer4ever (Post 1592809)
why don't works?
i just want to work , i'll take care of the rest

You will have to debug it. Remove all the name code and see if it works.


All times are GMT -4. The time now is 14:23.

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