Raised This Month: $ Target: $400
 0% 

Weapon Pickup Block


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-04-2010 , 22:32   Weapon Pickup Block
Reply With Quote #1

How would I go about blocking anyone from picking up a weapon if a bool is true?
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-04-2010 , 22:34   Re: Weapon Pickup Block
Reply With Quote #2

I saw you looked into it before (I stalked your profile) so you should know how to just block it. Loop through all players and if player has the bool set true, block, else don't.

Simple as that. I'm just too lazy to check up the actual code.


Edit: You could try this:
PHP Code:
#include < amxmodx >
#include < hamsandwich >

public plugin_init( ) {
    
register_plugin"No Weapon Pickup""1.0""xPaw" );
    
    
RegisterHamHam_Touch"weaponbox""FwdHamPlayerWeaponTouch" );
    
RegisterHamHam_Touch"armoury_entity""FwdHamPlayerWeaponTouch" );
}

public 
FwdHamPlayerWeaponTouch( const iEntity, const id )
    return 
g_LastRequest HAM_SUPERCEDE HAM_IGNORED
__________________

Last edited by DarkGod; 08-04-2010 at 23:04.
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-04-2010 , 22:40   Re: Weapon Pickup Block
Reply With Quote #3

Quote:
Originally Posted by DarkGod View Post
I saw you looked into it before (I stalked your profile) so you should know how to just block it. Loop through all players and if player has the bool set true, block, else don't.

Simple as that. I'm just too lazy to check up the actual code.
I'm not exactly sure how to go about it. If someone could possibly "help" me (give me the code) i would love them.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-04-2010 , 22:47   Re: Weapon Pickup Block
Reply With Quote #4

Quote:
Originally Posted by DarkGod View Post
I saw you looked into it before (I stalked your profile) so you should know how to just block it. Loop through all players and if player has the bool set true, block, else don't.

Simple as that. I'm just too lazy to check up the actual code.


Edit: You could try this:
PHP Code:
#include <amxmodx>
#include <hamsandwich>

new bool:CanPickup[33] = true

public plugin_init()
{
    
register_plugin"Block Weapon Pickup""1.0""Wrecked" )
    
    new 
classname[20// weapon_smokegrenade (19) + 1
    
    
for( new CSW_P228<= CSW_P90i++ )
    {
        if ( 
get_weaponnameiclassnamecharsmaxclassname ) ) )
        {
            
RegisterHamHam_Item_Deployclassname"HamItemDeployPre")
            
/* Other forwards that you could've used:
                * Ham_AddPlayerItem
                * Ham_Item_CanDeploy
                * Ham_Touch
            */
        
}
    }
}

public 
HamItemDeployPreweapon )
{
    new 
players[32], numindex
    get_players
(playersnum)
    
    for(new 
inumi++)
    {
        
index players[i]
        
        if(!
CanPickup[index])
            return 
HAM_SUPERCEDE// blocks function call
    
}
    
    return 
HAM_IGNORED

Nothing I've tried has worked. It's pissing me off.

PHP Code:
public HamItemDeployPreweapon )
{
    new 
players[32], num;
    
get_players(playersnum)
    
    for(new 
inumi++)
    {
        if( 
gLastRequest )
        {
            return 
HAM_SUPERCEDE;
        }
    }
    
    return 
HAM_IGNORED

__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-04-2010 , 22:41   Re: Weapon Pickup Block
Reply With Quote #5

Updated my post.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-04-2010 , 22:57   Re: Weapon Pickup Block
Reply With Quote #6

My bad on that. It was wrecked who coded it wrong from the start. This just fucked things up, lol. Sec, I'll see if I can find some other way.

Edit: Updated first post. Tested and works.
__________________

Last edited by DarkGod; 08-04-2010 at 23:03.
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 08-04-2010 , 23:12   Re: Weapon Pickup Block
Reply With Quote #7

Fixed it in the tutorial as well.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-05-2010 , 00:22   Re: Weapon Pickup Block
Reply With Quote #8

I've tried like 6 methods and it still hasn't worked. The bool doesn't have an index, but I'm sure thats not the problem. I have it set the bool to true whenever an LR(last request) is in progress. So it SHOULD block it if gLastRequest is true. I don't have a clue whats wrong.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-05-2010 , 00:23   Re: Weapon Pickup Block
Reply With Quote #9

Quote:
Originally Posted by GXLZPGX View Post
I've tried like 6 methods and it still hasn't worked. The bool doesn't have an index, but I'm sure thats not the problem. I have it set the bool to true whenever an LR(last request) is in progress. So it SHOULD block it if gLastRequest is true. I don't have a clue whats wrong.
I tested it myself and that last method definitely works.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-05-2010 , 00:28   Re: Weapon Pickup Block
Reply With Quote #10

Quote:
Originally Posted by DarkGod View Post
I tested it myself and that last method definitely works.
If you'd like I'll give you the whole code on pastebin. Hold on.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX 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 00:08.


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