Raised This Month: $ Target: $400
 0% 

If aim_ prefixed map give m4/ak on spawn?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blood2k
Senior Member
Join Date: Mar 2014
Old 02-09-2018 , 21:20   If aim_ prefixed map give m4/ak on spawn?
Reply With Quote #1

Figured it out. Nvm

Last edited by blood2k; 02-12-2018 at 02:23.
blood2k is offline
blood2k
Senior Member
Join Date: Mar 2014
Old 02-12-2018 , 02:23   Re: If aim_ prefixed map give m4/ak on spawn?
Reply With Quote #2

Figured it out. Nvm
blood2k is offline
seypa
Junior Member
Join Date: Dec 2016
Old 02-12-2018 , 10:55   Re: If aim_ prefixed map give m4/ak on spawn?
Reply With Quote #3

Quote:
Originally Posted by blood2k View Post
Figured it out. Nvm
PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <cstrike>

new const PRIMARY_WEAPONS_BITSUM = (1<<CSW_M4A1)|(1<<CSW_AK47);

public 
plugin_init()
{
    
RegisterHam(Ham_Spawn"player""Player_Spawn"1);
}
public 
plugin_cfg()
{
    if(!
check_map()) return;
}

public 
Player_Spawn(id){
    
    if(!
is_user_connected(id)) return ;
    
ammo_update(id,"weapon_ak47",90,1)
    
ammo_update(id,"weapon_m4a1",90,1)
    
}

stock check_map(){
    
    new 
sPref[] = {"aim_"};
    new 
map[32]; get_mapname(mapcharsmax(map));
    for(new 
isizeof sPrefi++)
    {
        if(
containi(mapsPref[i])){
            return 
PLUGIN_CONTINUE
        
}
    }
    return 
PLUGIN_HANDLED
}

stock ammo_update(id,currWeaponName[],ammoAmount,dropFlag=0)
{
    static    
weaponsList[32], weaponsNumcurrWeaponID;        
    
currWeaponID get_weaponid(currWeaponName);
    if(
dropFlag)
    {    
        
weaponsNum 0;
        
get_user_weapons(id,weaponsList,weaponsNum);
        for (new 
i;weaponsNum;i++)
        {
            if(((
<< currWeaponID) & PRIMARY_WEAPONS_BITSUM && (<< weaponsList[i]) & PRIMARY_WEAPONS_BITSUM) || ((<< currWeaponID)))
            {
                
give_item(id,currWeaponName);
                
cs_set_user_bpammo(id,currWeaponID,ammoAmount);
                
            }
        }
    }
    
    return 
1;

Not tested, you can try it

Last edited by seypa; 02-12-2018 at 10:55.
seypa 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 05:41.


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