AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon check (https://forums.alliedmods.net/showthread.php?t=206925)

razermamba 01-27-2013 13:56

Weapon check
 
Hello I just need a piece of code where will be check for player that he can have just one primary and secondary weapon. I have a plugin that spawns weapon but when player get the weapon he can get like 7 primary weapons. So im very greateful if anyone could post here code for blocking this thing.

Thank you :)

wickedd 01-27-2013 14:18

Re: Weapon check
 
What you mean by "spawn weapons"? Do you mean, you give players a new weapon at the start of a new round or do you spawn the weapon on the ground and then the player picks it up?

razermamba 01-27-2013 14:31

Re: Weapon check
 
Weapon is spawned on the ground and player pick it up

Neeeeeeeeeel.- 01-27-2013 16:07

Re: Weapon check
 
He spawn a weapon with this code
PHP Code:

enum _:Weapons {
    
Classname32 ],
    
Model32 ],
    
WeaponID,
    
AmmoAmount
};

new const 
WeaponList[ ][ Weapons ] = { 
    { 
"weapon_glock18""w_glock18.mdl"CSW_GLOCK18120 },
    { 
"weapon_usp""w_usp.mdl"CSW_USP100 },
    { 
"weapon_deagle""w_deagle.mdl"CSW_DEAGLE35 },
    { 
"weapon_ak47""w_ak47.mdl"CSW_AK4790 },
    { 
"weapon_m4a1""w_m4a1.mdl"CSW_M4A190 },
    { 
"weapon_famas""w_famas.mdl"CSW_FAMAS90 },
    { 
"weapon_galil""w_galil.mdl"CSW_GALIL90 },
    { 
"weapon_awp""w_awp.mdl"CSW_AWP30 },
    { 
"weapon_mp5navy""w_mp5.mdl"CSW_MP5NAVY120 },
    { 
"weapon_mac10""w_mac10.mdl"CSW_MAC10100 }
};

spawn_weaponweaponidoriginid )
{
    static const 
weaponbox[] = "weaponbox";
    
    static 
iWeaponBox;
    
iWeaponBox create_entityweaponbox );
    
    new 
szModel64 ];
    
    if( 
pev_validiWeaponBox ) )
    {
        
set_peviWeaponBoxpev_iuser3WPNBX_CUSTOM );
        
set_peviWeaponBoxWEAPON_IDweaponid );
        
        static 
Float:origin];
        
origin] = Float:ArrayGetCellspawn_points_Xoriginid );
        
origin] = Float:ArrayGetCellspawn_points_Yoriginid );
        
origin] = Float:ArrayGetCellspawn_points_Zoriginid );
        
        
engfuncEngFunc_SetOriginiWeaponBoxorigin );
        
        static 
Float:angles];
        
        
set_peviWeaponBoxpev_anglesangles );
        
ExecuteHamBHam_SpawniWeaponBox );
        
        static 
Float:flWpnBxVelocity];
        
flWpnBxVelocity] = random_float( -250.0250.0 );
        
flWpnBxVelocity] = random_float( -250.0250.0 );
        
        
set_peviWeaponBoxpev_velocityflWpnBxVelocity );
            
        
formatexszModelcharsmaxszModel ), "models/%s"WeaponListweaponid ][ Model ] );
        
        
entity_set_modeliWeaponBoxszModel );
        
        
engfuncEngFunc_DropToFlooriWeaponBox );
    }
    
    return 
iWeaponBox;
}

public 
weaponbox_touchenttoucher )
{
    static 
weaponid;
    
weaponid peventWEAPON_ID );
    
    
give_itemtoucherWeaponListweaponid ][ Classname ] );
    
cs_set_user_bpammotoucherWeaponListweaponid ][ WeaponID ], WeaponListweaponid ][ AmmoAmount ] );


The problem with this is that you can pickup all weapons you want... he needs to fix that.


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

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