Posts: 68
Threads: 7
Joined: Oct 2014
Quote:
Originally Posted by Swarn
Doesn't work, I spawn the weapon and it doesn't place gun on my back
|
Maybe you have to put
Код:
if(gCheckPlayerWeapon(playerid, putweaponidhere)) //put the id of the weapon that you desire
{
//attach shotgun code <<<<<<<<<<<<<<<<<<<<<<<<< HERE
}
Your attach code hm (?)
Posts: 68
Threads: 7
Joined: Oct 2014
Okay, then put this:
Код:
if(gCheckPlayerWeapon(playerid, putweaponidhere)) //put the id of the weapon that you desire
{
SetPlayerAttachedObject(playerid, 4,349,1,-0.102073, -0.200483, 0.094914, 15.186383, 61.980533, 357.054473);
}
in OnPlayerUpdate and test it
Posts: 134
Threads: 23
Joined: Sep 2015
Reputation:
0
Yeah, that works, thanks.
But slight problem
When the player shoots all the ammo out, the weapon stays on his back, how to fix?
Posts: 68
Threads: 7
Joined: Oct 2014
Код:
new wep[2];
GetPlayerWeaponData(playerid, i, wep[0], wep[1]); // wep[0] = weapon ID - wep[1] = ammo of the weapon
if(gCheckPlayerWeapon(playerid, putweaponidhere))
{
if(wep[0] == IDWEAP && wep[1] == 0) RemovePlayerAttachedObject(playerid, 4);
SetPlayerAttachedObject(playerid, 4, 349,1,-0.102073, -0.200483, 0.094914, 15.186383, 61.980533, 357.054473); // Here put the attach of the weapon that you want
}
Try with this
Posts: 3,934
Threads: 353
Joined: Jan 2010
Reputation:
0
I wouldn't recommend putting it on OnPlayerUpdate, put it in a timer.