AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Give full amo (https://forums.alliedmods.net/showthread.php?t=183361)

bazhenov93 04-20-2012 23:46

Give full amo
 
PHP Code:

if(is_user_alive(id))
            {
                for(new 
08i++)
                    if( !
user_has_weapon(idother_weapons[i]) )
                    {
                        new 
item;
                        
item give_item(idother_weapons_name[i] )
                        
cs_set_weapon_ammo(item0)
                        
                        if((
get_user_flags(id) & VIP ))
                        { 
                        
cs_set_weapon_ammo(item150)
                        }
                    } 

How to fill secondary ammo?

Bilal Pro 04-21-2012 09:52

Re: Give full amo
 
PHP Code:

cs_set_user_bpammo(idCSW_WEAPONNAMEAMMO


bazhenov93 04-22-2012 08:43

Re: Give full amo
 
Well, is working for CSW, but I need something like this

PHP Code:

cs_set_weapon_ammo(item100)
cs_set_user_bpammo(itemother_weapons_name[i], 20

Because this way is long:
PHP Code:

cs_set_user_bpammo(idCSW_SCOUT20)
cs_set_user_bpammo(idCSW_P9020)
cs_set_user_bpammo(idCSW_FAMAS20)
cs_set_user_bpammo(idCSW_SG55220)
cs_set_user_bpammo(idCSW_M4A120)
cs_set_user_bpammo(idCSW_M24920)
cs_set_user_bpammo(idCSW_AWP20)
cs_set_user_bpammo(idCSW_AK4720


claudiuhks 04-22-2012 08:54

Re: Give full amo
 
PHP Code:

const BAD_WEAPONS = ( << CSW_KNIFE ) | ( << CSW_C4 ) | ( << CSW_HEGRENADE ) | ( << CSW_FLASHBANG ) | ( << CSW_SMOKEGRENADE );

static 
iWeapons32 ], iNumiiNum 0;
get_weaponsiPlayeriWeaponsiNum );
for( 
0iNumi++ )
{
  if( !( ( 
<< iWeapons] ) & BAD_WEAPONS ) )
    
cs_set_user_bpammoiPlayeriWeapons], 9999 );



Bilal Pro 04-22-2012 09:40

Re: Give full amo
 
Quote:

Originally Posted by BadJoke (Post 1694375)
dami add pe mes fratica


Stop talking another language in every topic ur talking on please

bazhenov93 04-22-2012 09:40

Re: Give full amo
 
Stop spamming and english only.

rak 04-25-2012 02:40

Re: Give full amo
 
it's solved? if not.. show me other_weapons_name[]

bazhenov93 04-25-2012 13:35

Re: Give full amo
 
PHP Code:

new const other_weapons[8] = 
{
    
CSW_SCOUTCSW_P90CSW_FAMASCSW_SG552,
    
CSW_M4A1CSW_M249CSW_AK47CSW_AWP
}

new const 
other_weapons_name[8][] = 
{
    
"weapon_scout""weapon_p90""weapon_famas""weapon_sg552",
    
"weapon_m4a1""weapon_m249""weapon_ak47""weapon_awp"



rak 04-25-2012 15:41

Re: Give full amo
 
Quote:

Originally Posted by bazhenov93 (Post 1696284)
PHP Code:

new const other_weapons[8] = 
{
    
CSW_SCOUTCSW_P90CSW_FAMASCSW_SG552,
    
CSW_M4A1CSW_M249CSW_AK47CSW_AWP
}

new const 
other_weapons_name[8][] = 
{
    
"weapon_scout""weapon_p90""weapon_famas""weapon_sg552",
    
"weapon_m4a1""weapon_m249""weapon_ak47""weapon_awp"



i like it more

PHP Code:

enum _:WeaponData {
    
WPN_NAME[32],
    
WPN_CONST
}

new const 
other_weapons_name[][WeaponData] = {
    { 
"weapon_scout"CSW_SCOUT }, 
    { 
"weapon_p90"CSW_P90 }, 
    { 
"weapon_famas"CSW_FAMAS },
    { 
"weapon_sg552"CSW_SG552 },
    { 
"weapon_m4a1"CSW_M4A1 }, 
    { 
"weapon_m249"CSW_M249 }, 
    { 
"weapon_ak47"CSW_AK47 },
    { 
"weapon_awp"CSW_AWP }


example to use

PHP Code:

#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "[R]ak"

enum _:WeaponData {
    
WPN_NAME[32],
    
WPN_CONST
}

new const 
other_weapons_name[][WeaponData] = {
    { 
"weapon_scout"CSW_SCOUT }, 
    { 
"weapon_p90"CSW_P90 }, 
    { 
"weapon_famas"CSW_FAMAS },
    { 
"weapon_sg552"CSW_SG552 },
    { 
"weapon_m4a1"CSW_M4A1 }, 
    { 
"weapon_m249"CSW_M249 }, 
    { 
"weapon_ak47"CSW_AK47 },
    { 
"weapon_awp"CSW_AWP }
}

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    for(new 
sizeof other_weapons_namei++)
        
console_print(0"WPN Name: %s WPN Const: %d"other_weapons_name[i][WPN_NAME], other_weapons_name[i][WPN_CONST])



Doc-Holiday 04-25-2012 15:58

Re: Give full amo
 
Just use the native that gets the weapon name to csw

no need to create more work for your self in creating an array like that.


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

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