Little help attaching one only weapon ID. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little help attaching one only weapon ID. (
/showthread.php?tid=363312)
Little help attaching one only weapon ID. -
ricardo178 - 27.07.2012
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);
}
}
}
Re: Little help attaching one only weapon ID. -
Misiur - 27.07.2012
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
Re : Little help attaching one only weapon ID. -
ricardo178 - 27.07.2012
This solved. Thanks. I was confused about that.