Little help attaching one only weapon ID.
#1

Hello. Well, looking Armed Body script that someone made, i arranged to move it into my script and put it how i wanted, but now a clue comes.. It actualy attaches groups(The gun slots, for example slot 5 is M4 and AK47), but i want it to only attach Katana, that is from group 1.

This is part of the code, to attach all the group 1 of weapons, where is Katana, Knife, Police NiteStick, and these.
I want to only attach katana...
If somebody can help me, i would be thankful cos i am not very familiar with attachments yet.

pawn Код:
new
        weaponid[13],weaponammo[13],pArmedWeapon;
        pArmedWeapon = GetPlayerWeapon(playerid);
        GetPlayerWeaponData(playerid,1,weaponid[1],weaponammo[1]);
        if(weaponid[1] && weaponammo[1] > 0)
        {
            if(pArmedWeapon != weaponid[1])
            {
                if(!IsPlayerAttachedObjectSlotUsed(playerid,9))
                {
                    SetPlayerAttachedObject(playerid,9,GetWeaponModel(weaponid[1]),1, 0.200000, -0.129999, -0.009999, 0.000000, 240.000000, 0.000000, 1.000000, 1.000000, 1.000000);
                }
            }
            else
            {
                if(IsPlayerAttachedObjectSlotUsed(playerid,9))
                {
                    RemovePlayerAttachedObject(playerid,9);
                }
            }
        }
Reply
#2

I don't quite get your problem, but I'll try helping you.

pawn Код:
if(!IsPlayerAttachedObjectSlotUsed(playerid,9))
//to
if(!IsPlayerAttachedObjectSlotUsed(playerid,9) && 8 == weaponid[1])
8 is katana id, and it'll set attached object only if the weapon is a katana
Reply
#3

This solved. Thanks. I was confused about that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)