AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help needed with this, modifying flags of user. (https://forums.alliedmods.net/showthread.php?t=154746)

Battousai-sama 04-12-2011 15:03

help needed with this, modifying flags of user.
 
PHP Code:

if(grantedAccess[player] == 0)
    {
        new 
bm = (containi(oldFlags[id], "u"));
        new 
zFlag = (containi(oldFlags[id], "z"));
        new 
bmFlag read_flags("u");
        
oldFlags[id] = get_user_flags(player);
        if((
containi(oldFlags[id], "u")))
        {
            return 
PLUGIN_HANDLED;
        }
        else if(
containi(oldFlags[id], "z"))
        {
            
remove_user_flags(player,oldFlags[id],0)
            
set_user_flags(playerbmFlag0);
            
client_print(0,print_chat"Admin name: %s Player name: %s"namename2);
            
grantedAccess[player] = 1;
        }
        else if(!
bm && !zFlag)
        {
            
set_user_flags(playerbmFlag0);
            
client_print(0,print_chat"Admin name: %s Player name: %s"namename2);
            
grantedAccess[player] = 1;
        }
        return 
PLUGIN_HANDLED;
    } 

I Can't figure out what im doing wrong here.

Exolent[jNr] 04-12-2011 16:40

Re: help needed with this, modifying flags of user.
 
Show where you create oldFlags variable.

Battousai-sama 04-12-2011 16:43

Re: help needed with this, modifying flags of user.
 
at the top of plugin under includes

everything else works, this is the part that doesnt work :(

It should take users flags set to oldFlags and if no flag u adds to it,
if user's oldFlags has "z" removes it and gives u.

Exolent[jNr] 04-12-2011 16:43

Re: help needed with this, modifying flags of user.
 
Show the line.

Battousai-sama 04-12-2011 16:47

Re: help needed with this, modifying flags of user.
 
PHP Code:

new grantedAccess[33];
new 
oldFlags[33]; 

PHP Code:

public client_putinserver(id)
{
    new 
arg1[33];
    
read_argv(1arg131);
    new 
player cmd_target(idarg12);
    
grantedAccess[player] = 0;
    
oldFlags[id] = 0;



fysiks 04-12-2011 19:00

Re: help needed with this, modifying flags of user.
 
PHP Code:

containi(oldFlags[id], "u")
containi(oldFlags[id], "z"

:arrow:

PHP Code:

oldFlags[id] & ADMIN_MENU
oldFlags
[id] & ADMIN_USER 


Battousai-sama 04-12-2011 19:06

Re: help needed with this, modifying flags of user.
 
Quote:

Originally Posted by fysiks (Post 1448615)
PHP Code:

containi(oldFlags[id], "u")
containi(oldFlags[id], "z"

:arrow:

PHP Code:

oldFlags[id] & ADMIN_MENU
oldFlags
[id] & ADMIN_USER 


without the containi o.o?

fysiks 04-12-2011 19:08

Re: help needed with this, modifying flags of user.
 
Quote:

Originally Posted by Battousai-sama (Post 1448618)
without the containi o.o?

Yes, because it is not a string. It is a sum of bits (an integer).

I.e. The value of oldFlags[id] is not "abcd" it is something like the integer 143.

Battousai-sama 04-12-2011 19:12

Re: help needed with this, modifying flags of user.
 
oh i see

Edit: works had a small typo, and thanks for help :)


All times are GMT -4. The time now is 20:11.

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