SA-MP Forums Archive
Weapons on back - 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: Weapons on back (/showthread.php?tid=446942)



Weapons on back - AdamCooper - 28.06.2013

I have this code -
pawn Код:
SetPlayerAttachedObject( playerid, 0, 356, 1, -0.236845, -0.152927, 0.067450, 355.142028, 17.515201, 8.209364, 0.875876, 1.053802, 0.757611 ); // m4 -
This is M4 object players back.

How can I do so if the player has M4 it appears on his back?

And how can I remove it when he is using the weapon?

Any ideas will be appreciated!


Re: Weapons on back - Jefff - 28.06.2013

Something like that in OnPlayerUpdate or your own Timer

pawn Код:
new CurrentWeapon = GetPlayerWeapon(playerid);
if(CurrentWeapon == WEAPON_M4)
{
    if(IsPlayerAttachedObjectSlotUsed(playerid, YOUR_SLOT_FOR_M4))
        RemovePlayerAttachedObject(playerid, YOUR_SLOT_FOR_M4);
}else{
    if(!IsPlayerAttachedObjectSlotUsed(playerid, YOUR_SLOT_FOR_M4))
        SetPlayerAttachedObject( playerid, YOUR_SLOT_FOR_M4, 356, 1, -0.236845, -0.152927, 0.067450, 355.142028, 17.515201, 8.209364, 0.875876, 1.053802, 0.757611 ); // m4 -
}



Re: Weapons on back - [ABK]Antonio - 28.06.2013

Also, make sure you add a check to check if they have one in their weapon data


Re: Weapons on back - AdamCooper - 28.06.2013

Alright guys thanks I will give it a try now