Issue with an Array related to separating valid weapons from invalid ones
#2

Hi!

You have to write it like this:
PHP код:
RemoveWeaponFromPlayer(playerid,weaponid)
{
    new 
Ammo;
    
SetPlayerArmedWeapon(playerid,weaponid);
    
Ammo GetPlayerAmmo(playerid);
    for(new 
i;i<sizeof(e_ValidWeapon);i++)
    {
        if(
weaponid != e_ValidWeapon[i])continue;
        print(
"Executed.");
        
GivePlayerWeapon(playerid,weaponid,-Ammo);
        break;
    }
    return 
1;

When you take your version, it would look like this:
PHP код:
weaponid 43 
PHP код:
if(weaponid != e_ValidWeapon[weaponid]) return false
PHP код:
if(43 != e_ValidWeapon[43])return false
PHP код:
new e_ValidWeapon[] =
{
    
0//1
    
3//2
    
4//3
    
5//4
    
8//5
    
9//6
    
15//7
    
22//8
    
23//9
    
24//10
    
25//11
    
27//12
    
28//13
    
29//14
    
30//15
    
31//16
    
32//17
    
33//18
    
34//19
    
41//20
    
42//21
    
43 //...
            // 43
}; 
The field 43 is nothing. I hope you understand how I mean it.
Reply


Messages In This Thread
Issue with an Array related to separating valid weapons from invalid ones - by DarkLored - 26.03.2016, 18:41
Re: Issue with an Array related to separating valid weapons from invalid ones - by Mencent - 26.03.2016, 18:47
Re: Issue with an Array related to separating valid weapons from invalid ones - by DarkLored - 26.03.2016, 19:10
Re: Issue with an Array related to separating valid weapons from invalid ones - by SickAttack - 26.03.2016, 19:45

Forum Jump:


Users browsing this thread: 2 Guest(s)