Raised This Month: $ Target: $400
 0% 

set_user_flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killer4ever
Junior Member
Join Date: Aug 2011
Old 11-07-2011 , 13:22   set_user_flags
Reply With Quote #1

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
killer4ever is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-07-2011 , 19:24   Re: set_user_flags
Reply With Quote #2

Code:
set_user_flags(id,flags);

Code:
set_user_flags(id, -1);
set_user_flags(id,flags);
__________________
fysiks is offline
killer4ever
Junior Member
Join Date: Aug 2011
Old 11-08-2011 , 08:36   Re: set_user_flags
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Code:
set_user_flags(id,flags);

Code:
set_user_flags(id, -1);
set_user_flags(id,flags);
don't works
killer4ever is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-08-2011 , 11:03   Re: set_user_flags
Reply With Quote #4

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.
__________________

Last edited by fysiks; 11-08-2011 at 11:04.
fysiks is offline
Blue Snake.
Member
Join Date: May 2011
Location: Romania
Old 11-08-2011 , 11:18   Re: set_user_flags
Reply With Quote #5

If you want to set "abcdefghijklmnopqrstu" access to anyone, you should only set the cvar amx_default_access from amxx.cfg to "abcdefghijklmnopqrstu"
Blue Snake. is offline
killer4ever
Junior Member
Join Date: Aug 2011
Old 11-08-2011 , 11:27   Re: set_user_flags
Reply With Quote #6

Quote:
Originally Posted by Blue Snake. View Post
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
killer4ever is offline
Blue Snake.
Member
Join Date: May 2011
Location: Romania
Old 11-08-2011 , 11:35   Re: set_user_flags
Reply With Quote #7

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).
Blue Snake. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-08-2011 , 12:01   Re: set_user_flags
Reply With Quote #8

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. View Post
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.
__________________

Last edited by fysiks; 11-08-2011 at 12:03.
fysiks is offline
Old 11-08-2011, 12:18
Bugsy
This message has been deleted by Bugsy. Reason: nvm
killer4ever
Junior Member
Join Date: Aug 2011
Old 11-08-2011 , 13:34   Re: set_user_flags
Reply With Quote #9

why don't works?
i just want to work , i'll take care of the rest
killer4ever is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-08-2011 , 18:05   Re: set_user_flags
Reply With Quote #10

Quote:
Originally Posted by killer4ever View Post
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.
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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