AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Multi-dimensional fix (https://forums.alliedmods.net/showthread.php?t=105476)

DruGzOG 10-04-2009 21:59

[Help] Multi-dimensional fix
 
PHP Code:

new const weapons_primary[WEAPONS_PRIMARY][] = {
    
"weapon_m4a1",
    
"weapon_ak47",
    
"weapon_awp",
    
"weapon_m3",
    
"weapon_mp5navy",
    
"weapon_famas"
}

new const 
weapons_primary_names[WEAPONS_PRIMARY][] = {
    
"Maverick",
    
"AK-47",
    
"AWP",
    
"ShotGun",
    
"MP5 Navy",
    
"Famas"


Code:



Error: Multi-dimensional arrays must be fully initialized on line 21
Error: Multi-dimensional arrays must be fully initialized on line 30
2 Errors.

How to fix this?

Exolent[jNr] 10-04-2009 22:36

Re: [Help] Multi-dimensional fix
 
Show the line where WEAPONS_PRIMARY is created.

DruGzOG 10-04-2009 22:45

Re: [Help] Multi-dimensional fix
 
Quote:

Originally Posted by Exolent[jNr] (Post 952687)
Show the line where WEAPONS_PRIMARY is created.


Ahh I see my mistake, thanks lol.

DruGzOG 10-05-2009 15:27

Re: [Help] Multi-dimensional fix
 
PHP Code:

public set_ammo(id)
{
    static 
weapons[32], numi
    get_user_weapons
(idweaponsnum)
    for(
0numi++)
    {
        if(
weapons[i] != 29)
            
cs_set_user_bpammo(idweapons[i], 100)        
}
    } 

I've added this to the code but when the weapon is selected, the ammo is not given.

Any Suggestions?

Exolent[jNr] 10-05-2009 15:36

Re: [Help] Multi-dimensional fix
 
PHP Code:

#define PISTOL_WEAPONS_BIT (1<<CSW_GLOCK18|1<<CSW_USP|1<<CSW_P228|1<<CSW_DEAGLE|1<<CSW_FIVESEVEN|1<<CSW_ELITE)
#define SHOTGUN_WEAPONS_BIT (1<<CSW_M3|1<<CSW_XM1014)
#define SUBMACHINE_WEAPONS_BIT (1<<CSW_TMP|1<<CSW_MAC10|1<<CSW_MP5NAVY|1<<CSW_UMP45|1<<CSW_P90)
#define RIFLE_WEAPONS_BIT (1<<CSW_FAMAS|1<<CSW_GALIL|1<<CSW_AK47|1<<CSW_SCOUT|1<<CSW_M4A1|1<<CSW_SG550|1<<CSW_SG552|1<<CSW_AUG|1<<CSW_AWP|1<<CSW_G3SG1)
#define MACHINE_WEAPONS_BIT (1<<CSW_M249)

#define ALL_GUNS_BIT ( PISTOL_WEAPONS_BIT | SHOTGUN_WEAPONS_BIT | SUBMACHINE_WEAPONS_BIT | RIFLE_WEAPONS_BIT | MACHINE_WEAPONS_BIT )

#define WeaponHasAmmo(%1) ( ( 1 << %1 ) & ALL_GUNS_BIT )

public set_ammo(id)
{
    static 
weapons[32], numiweapon
    get_user_weapons
(idweaponsnum)
    for(
0numi++)
    {
        
weapon weapons[i]
        if(
WeaponHasAmmo(weapon))
            
cs_set_user_bpammo(idweapon100)
    }




All times are GMT -4. The time now is 22:40.

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