Thread: Deagle plugin
View Single Post
joaokb
Junior Member
Join Date: Apr 2021
Location: brazil
Old 04-23-2021 , 17:39   Re: Deagle plugin
Reply With Quote #6

Quote:
Originally Posted by Nutu_ View Post
oh, i forgot about that, try now
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util> 
#include <hamsandwich>
#include <fun> 

#define PLUGIN "Spawn Weapons"
#define VERSION "1.0"
#define AUTHOR "nutu"

new bool:HasC4[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""Inceput_runda"1);
}
public 
Inceput_runda(id
{
    if(
is_user_alive(id)) 
    {
        
give_item(id"weapon_knife");
        
WeaponMenu(id);
    }
}

public 
WeaponMenu(id) {
    if(
get_user_team(id) == CS_TEAM_CT
    {
        
cs_drop_user_weapon(id"weapon_usp"1);
        
give_item(id,"weapon_knife");
        
give_item(id"weapon_deagle");
        
cs_set_user_bpammo(idCSW_DEAGLE,35);
    }
    else if (
get_user_team(id) == CS_TEAM_T
    {
        if (
user_has_weapon(idCSW_C4) && get_user_team(id) == 1)
            
HasC4[id] = true;
        else
            
HasC4[id] = false;
        
cs_drop_user_weapon(id"weapon_glock18"1);
        
give_item(id,"weapon_knife");
        
give_item(id"weapon_deagle");
        
cs_set_user_bpammo(idCSW_DEAGLE,35);
        if (
HasC4[id])
        {
            
give_item(id"weapon_c4");
            
cs_set_user_plantid );
        }
    }
}
stock cs_drop_user_weapon(const id, const szWeaponName[]="", const bStrip=0
{    
    new 
wEnt = -WeaponId get_weaponidszWeaponName );  
    const 
NadeBits = ( ( << CSW_HEGRENADE ) | ( << CSW_FLASHBANG ) | ( << CSW_SMOKEGRENADE ) ); 
    if( ( 
WeaponId 30 ) && is_user_aliveid ) && user_has_weaponidWeaponId ) ) 
    { 
        if( 
bStrip 
        {     
            while( ( 
wEnt engfuncEngFunc_FindEntityByString wEnt "classname" szWeaponName ) ) && pevwEnt pev_owner ) != id ) {} 
            
            if( !
wEnt )  
                return -
1
            
            
ExecuteHamBHam_Weapon_RetireWeapon wEnt); 
            
            if( !
ExecuteHamBHam_RemovePlayerItem id wEnt ) )  
                return -
1
            
            
ExecuteHamBHam_Item_Kill wEnt ); 
            
            
// this is for 'Grenades'. 
            
if( WeaponId == CSW_C4 
            { 
                
cs_set_user_plantid ); 
                
cs_set_user_bpammoid CSW_C4 ); 
            } 
            
            else if ( 
NadeBits & ( << WeaponId ) ) 
                
cs_set_user_bpammo(id,WeaponId,0); 
        } 
        else 
            
engclient_cmdid"drop"szWeaponName ); 
        
// thanks to Connor here: 
        
user_has_weaponidWeaponId); 
    }         
    return 
wEnt
}  

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/ 

how can i do to this plugin only work in "de_" and "cs_" maps?
__________________
⠀⠀⠀⠀⠀⠀
⠀⠀kabest
joaokb is offline