Raised This Month: $51 Target: $400
 12% 

Problem with my CS Pick up manager


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-14-2016 , 21:41   Re: Problem with my CS Pick up manager
Reply With Quote #11

I redid some of it and added comments. It was not thoroughly tested.
Spoiler
__________________
Bugsy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-15-2016 , 02:19   Re: Problem with my CS Pick up manager
Reply With Quote #12

Wow, thank you Bugsy. Looks perfect now, anyway i'm gonna giving some tests and come back with answer, thanks

Btw about here:
PHP Code:
//Changed so all 3 use the same forward function. 
    
register_touch"armoury_entity" "player" "OnPlayerTouchItem" );  
    
register_touch"weaponbox" "player" "OnPlayerTouchItem" );  
    
register_touch"weapon_shield" "player" "OnPlayerTouchItem" ); 
I was thinking to do this edit some days ago

Anyway thanks.

Btw, can i leave CSW_SHIELD as an const ?
PHP Code:
const CSW_SHIELD 31
though is the same thing when you define already write in memory the number 31, also another 31 is writed in memory when you use iWeaponID = CSW_SHIELD so better as const, i'm correct no?

Also i tested and is works perfect everything! <3
__________________
Project: Among Us

Last edited by Craxor; 09-16-2016 at 21:20.
Craxor is offline
Send a message via ICQ to Craxor
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-17-2016 , 12:01   Re: Problem with my CS Pick up manager
Reply With Quote #13

Just another problem, as i have not so much knowledge in bits i need to ask you about this.

I'm trying to create another 2 commands .

. First one for putting all the list inside of the vault, wich i succesfully done, works perfect.
. Second one to Remove all the keys from the ( to emtpy the vault ) wich also works perfect, but the problem is that all the vaults will reset only after map change not instantly, i made just now on the moment and i'm tired but i leave them here for you to check, thank you

PHP Code:
// this one works perfect, i leave here just for you to see, maybe you observe something that you don;t like
public addallkeyidlevelcid )

        
// im using "1" as num command because i don't need any argument.
    
if( !cmd_accessid level cid ) ) 
        return 
PLUGIN_HANDLED
    
    new 
szModelFile12 14 ]; 

    for( new 
sizeof gKeyList ) ; i++ ) 
    { 
        
formatexszModelFile charsmaxszModelFile ), gModelFile gKeyList] );
        
gBlockWeapons |= ( << );

        
nvault_setgNewVault szModelFile "1" );  
    }       
    return 
PLUGIN_HANDLED
}

public 
remallkeyidlevelcid )
{
    if( !
cmd_accessid level cid ) ) 
        return 
PLUGIN_HANDLED;


    
nvault_prunegNewVault0get_systime( ) );
    
client_printidprint_console"You've succesfully reseted all the list!" );

    
// We update the bitfield. ( and here is the problem i'm suppose ) ...
    
for( new 33>= sizeof gKeyList ) ; i-- ) 
        
gBlockWeapons = ( << );
        

    return 
PLUGIN_HANDLED;

__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-17-2016 , 12:04   Re: Problem with my CS Pick up manager
Reply With Quote #14

To remove all you do not need the loop, you can just do gBlockWeapons = 0.

Your remove all code does not work because you messed up the for loop as well as the bit operation. You would use the exact same for loop as for the add all function. But like I said above, this is not needed as setting the variable to 0 clears all bits. I just want you too see where your mistake was.
PHP Code:
    for( new sizeof gKeyList ) ; i++ ) 
        
gBlockWeapons &= ~( << ); 
In your add all, you should check that the weapon is actually a weapon (it must not exist in the ignore list)
PHP Code:
public addallkeyidlevelcid )

    
// im using "1" as num command because i don't need any argument.
    
if( !cmd_accessid level cid ) ) 
        return 
PLUGIN_HANDLED
    
    new 
szModelFile12 14 ]; 
    
    for( new 
sizeof gKeyList ) ; i++ ) 
    { 
        if ( !( 
gIgnoreWeapons & ( << ) ) )
        {
            
formatexszModelFile charsmaxszModelFile ), gModelFile gKeyList] );
            
gBlockWeapons |= ( << );
        
            
nvault_setgNewVault szModelFile "1" );  
        }
    }  
    
    return 
PLUGIN_HANDLED

__________________

Last edited by Bugsy; 09-17-2016 at 12:13.
Bugsy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-17-2016 , 12:09   Re: Problem with my CS Pick up manager
Reply With Quote #15

Quote:
Originally Posted by Bugsy View Post
To remove all you do not need the loop, you can just do gBlockWeapons = 0.
Wow, very fucking fast maan )

Thank you Bugsy, so now i'm understand also what bitfields are.
__________________
Project: Among Us

Last edited by Craxor; 09-17-2016 at 12:14.
Craxor is offline
Send a message via ICQ to Craxor
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-17-2016 , 12:14   Re: Problem with my CS Pick up manager
Reply With Quote #16

Quote:
Originally Posted by Craxor View Post
Wow, very fucking fast maan )

Thank you Bugsy, so now i'm understand also what bitfields are also.
I actually went to the thread to look at something and you literally just posted a reply. It was weird, good timing though.
__________________
Bugsy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-17-2016 , 12:19   Re: Problem with my CS Pick up manager
Reply With Quote #17

To be cleary the IgnoreWeapons are bitfield wich contain all the weapons id wich are not inside of the vault.

Edit: oo shit, now i'm understand, is for avoid using "" empty string or unused weapons from inside of the array. Sorry, i'm rush to much to ask instead of checking by myself what you wrote on comments ... ya ya now i'm understand perfect for what is
__________________
Project: Among Us

Last edited by Craxor; 09-17-2016 at 12:28.
Craxor is offline
Send a message via ICQ to Craxor
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 03:43.


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