Weapons on back
#1

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!
Reply
#2

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 -
}
Reply
#3

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

Alright guys thanks I will give it a try now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)