Restricting weapon slots
#3

Any 3 slots or specific ones? If specific then check this:

pawn Код:
// a stock to check whether a weapon id is valid or invalid
stock IsValidWeaponID(weaponid)
{
    if((weaponid > 0 && weaponid < 19) || (weaponid > 21 && weaponid < 47))
        return 1; // it's valid weapon id so return 1

    return 0; // Invalid return 0
}

stock AllowOnlyThreeSlotsForPlayer(playerid, slotid1, slotid2, slotid3) //
{
    new wepid[13], ammo[13];
    for(new i = 0; i < 13; i++)
    {
        GetPlayerWeaponData(playerid, i, wepid[i], ammo[i]);
        // the following code is supposed to check if a player has a wepaon in another slot than the three allowed slots
        // IsValidWeaponID(weapid[i]) == 1 - to check if a player has a weapon in this slot (i 0-13)
        // (i != slotid1 && i != slotid2 && i != slotid3) - if the slot id of the weapon ^  is not equal to any of the three slots
        if(IsValidWeaponID(weapid[i]) == 1 && (i != slotid1 && i != slotid2 && i != slotid3))
        {
            GivePlayerWeapon(playerid, weapid[i], -ammo[i]); // not sure if this would remove the weapon but it should
        }
    }
    return 1;
}
then you can put the AllowOnlyThreeSlotsForPlayer into a player for loop inside a repeatedly timer.
Reply


Messages In This Thread
Restricting weapon slots - by Nicholas. - 02.08.2012, 03:13
Re: Restricting weapon slots - by Luis- - 02.08.2012, 03:39
Re: Restricting weapon slots - by [KHK]Khalid - 02.08.2012, 04:11
Re: Restricting weapon slots - by Nicholas. - 02.08.2012, 04:18

Forum Jump:


Users browsing this thread: 1 Guest(s)