AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] No Weapon Buy (https://forums.alliedmods.net/showthread.php?t=117677)

reinert 02-03-2010 12:47

[HELP] No Weapon Buy
 
Hi there, could some1 say me how could i do, that noone can buy AWP, except the VIP players. Weapon Restriction Won't Work!

i need something like

PHP Code:

    if(get_user_flags(id) & ADMIN_LEVEL_H)
    {
        return 
PLUGIN_CONTINUE;
        } else {
            
//* RESTRICTION HERE (THIS IS WHAT I NEED) *\\
            
client_print(idprint_chat"Only VIP Can buy AWP");
        }
        return 
PLUGIN_CONTINUE;
    } 


Exolent[jNr] 02-03-2010 12:55

Re: [HELP] No Weapon Buy
 
Code:
#include < amxmodx > #include < fakemeta > #include < hamsandwich > const m_iId = 43; public plugin_init( ) {     RegisterHam( Ham_AddPlayerItem, "player", "FwdAddPlayerItem" ); } public FwdAddPlayerItem( iPlayer, iEntity ) {     return ( is_user_alive( iPlayer )         && !( get_user_flags( iPlayer ) & ADMIN_LEVEL_H )         && get_pdata_int( iEntity, m_iId ) == CSW_AWP ) ?             HAM_SUPERCEDE : HAM_IGNORED; }

ConnorMcLeod 02-03-2010 12:57

Re: [HELP] No Weapon Buy
 
Exolent code gonna take player's money.

reinert 02-03-2010 12:58

Re: [HELP] No Weapon Buy
 
but i dont want that :(

and it won't work for me :( have you tested it?

Bugsy 02-03-2010 18:13

Re: [HELP] No Weapon Buy
 
ill post the code when I get home from work

Bugsy 02-03-2010 23:26

Re: [HELP] No Weapon Buy
 
If you are planning on adding restrictions for other weapons let me know.

Edit: Updated code using cstrike module instead of fakemeta
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <cstrike>

#define FLAG_ALLOW        ADMIN_LEVEL_H

public plugin_init() 
{
    
register_plugin"Block AWP Purchase" "0.1" "bugsy" );
    
    
RegisterHamHam_AddPlayerItem ,"player" ,"fw_AddPlayerItem" );
}

public 
fw_AddPlayerItemiPlayer iItem )
{
    if ( 
get_user_flagsiPlayer ) & FLAG_ALLOW )
        return 
HAM_IGNORED;

    if ( 
cs_get_weapon_idiItem ) == CSW_AWP )
    {    
        
set_task0.15 "ReimburseMoney" iPlayer );
        
client_printiPlayer print_chat "* You are restricted from using AWP!" );
        
SetHamReturnInteger); 
        
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}

public 
ReimburseMoneyid )
{
    
cs_set_user_moneyid clamp( ( cs_get_user_moneyid ) + 4750 ) , 4750 16000 ) , );



ConnorMcLeod 02-04-2010 00:47

Re: [HELP] No Weapon Buy
 
Won't this give players $4750 when they try to pick up a weapon from the ground ?

Bugsy 02-04-2010 08:08

Re: [HELP] No Weapon Buy
 
Quote:

Originally Posted by ConnorMcLeod (Post 1077820)
Won't this give players $4750 when they try to pick up a weapon from the ground ?

This is in addition to his existing code which already prevents awp pickup.

reinert 02-04-2010 08:55

Re: [HELP] No Weapon Buy
 
won't work for me, can you test it? it works? :(

Seta00 02-04-2010 09:10

Re: [HELP] No Weapon Buy
 
And what's the reason for:
PHP Code:

write_byte( !!flash ); 

????


All times are GMT -4. The time now is 07:24.

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