AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How can I do "string union"? (https://forums.alliedmods.net/showthread.php?t=57099)

phreakbg 06-28-2007 08:13

How can I do "string union"?
 
Hello :)
I have to write a plugin and I need the following. The task is to modify the admin plugin so that the users have rights from IP+ from nick.

For example:
my ip (a.b.c.d) has access "ade"
my nik (Phreak) has acces "abdie"

so when I join the server from my ip and with my nick i should have access: "abdei".
A have the both access strings and how should I do the union so that it is correct not : "ade" + "abdie" = "adeabdie", but "ade" + "abdie" = "abdei"
Thank u ;)

BAILOPAN 06-28-2007 11:20

Re: How can I do "string union"?
 
read_flags() both of the strings, "or" the values together, then set_user_flags()

phreakbg 07-02-2007 09:54

Re: How can I do "string union"?
 
Quote:

Originally Posted by BAILOPAN (Post 495807)
read_flags() both of the strings, "or" the values together, then set_user_flags()

You mean like:
set_user_flags(id, g_aAccess[index])
set_user_flags(id, g_aAccess[index2])
Where g_aAccess is array with all the rights (nick + IP) and "index" is index of the nick and "index2" is the index of the IP

stupok 07-03-2007 14:40

Re: How can I do "string union"?
 
I think this is what he means:

Code:

new flags1 = read_flags("ade")
new flags2 = read_flags("abdie")
       
flags1 |= flags2
       
set_user_flags(id, flags1)


phreakbg 07-03-2007 16:06

Re: How can I do "string union"?
 
Quote:

Originally Posted by stupok69 (Post 498101)
I think this is what he means:

Code:

new flags1 = read_flags("ade")
new flags2 = read_flags("abdie")
 
flags1 |= flags2
 
set_user_flags(id, flags1)


:oops: Well, exactly. Am I stupid or what ?!
10x very much :)


All times are GMT -4. The time now is 21:34.

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