Raised This Month: $ Target: $400
 0% 

Help with Flag's within this script!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 04-02-2009 , 17:30   Help with Flag's within this script!
Reply With Quote #1

Hey guys when I try to change the FLAG used to give the admin this ability it doesnt register all the admins get the boost regardless of if they have the flag or not.

This was done by a member of the community requested here,
http://forums.alliedmods.net/showthread.php?t=88521

Code:
    #include <amxmodx>
    #include <fakemeta>
    #include <hamsandwich>
    
    const MAX_CLIENTS = 32;
    new bool:gCanSpeed[ MAX_CLIENTS + 1 ];
    
    new pCvarKnifeSpeed;
    new pCvarKnifeFlags;
    
    public plugin_init()
    {
        register_plugin( "Knife Speed", "1.0.0", "Arkshine" );
        
        pCvarKnifeSpeed = register_cvar( "knife_speed", "400" );
        pCvarKnifeFlags = register_cvar( "knife_flags", "a" );
        
        RegisterHam( Ham_CS_Item_GetMaxSpeed, "weapon_knife", "Event_ChangeKnifeSpeed" );
    }

    public client_putinserver( Client )
    {
        gCanSpeed[ Client ] = !!( get_user_flags( Client ) & GetFlagsFromCvar() );
    }
    
    public Event_ChangeKnifeSpeed ( const Entity )
    {
        if ( gCanSpeed[ pev( Entity, pev_owner ) ] )
        {
            SetHamReturnFloat( get_pcvar_float( pCvarKnifeSpeed ) );
            return HAM_SUPERCEDE;
        } 
        
        return HAM_IGNORED;
    }
    
    GetFlagsFromCvar ()
    {
        static Flags[ 26 ];
        get_pcvar_string( pCvarKnifeFlags, Flags, charsmax( Flags ) );

        return read_flags( Flags );
    }
Thanks guys
__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-02-2009 , 19:39   Re: Help with Flag's within this script!
Reply With Quote #2

What flags did you write ?
Arkshine is offline
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 04-05-2009 , 14:44   Re: Help with Flag's within this script!
Reply With Quote #3

I used M and T
__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-06-2009 , 08:50   Re: Help with Flag's within this script!
Reply With Quote #4

You have written knife_flags "mt" ? Are you sure that the cvar well changed ?
Arkshine is offline
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 04-07-2009 , 11:33   Re: Help with Flag's within this script!
Reply With Quote #5

No I mean I tried m, and then I tried t.
Not both of those flags together.

I changed it correctly and I checked it 3 or 4 times.

pCvarKnifeSpeed = register_cvar( "knife_speed", "335" );
pCvarKnifeFlags = register_cvar( "knife_flags", "m" );
__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 04-07-2009 , 11:49   Re: Help with Flag's within this script!
Reply With Quote #6

PHP Code:
gCanSpeedClient ] = !!( get_user_flagsClient ) & GetFlagsFromCvar() ); 
Why the double ! mark?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-07-2009 , 11:53   Re: Help with Flag's within this script!
Reply With Quote #7

@YamiKaitou : To get 0 or 1.

a & b ;
if true : will give a, then '!' will give 0 and the second '!' will give 1.
if false: will give 0, then '!' will give 1 and the second '!' will give 0.

edit : @Kitami : just tested, it works fine for me. I've removed 'm' in users.ini ; changed 'a' to 'm' in the plugin, and when I'm on the server, I don't have the speed. I've debugged too, nothing wrong.

Last edited by Arkshine; 04-07-2009 at 12:13.
Arkshine is offline
Reply



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 02:20.


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