if(GetPlayerWeapon(playerid) != 25)
{
// attaches the shotgun to players back
}
stock gCheckPlayerWeapon(playerid, _weaponid)
{
const MAX_WEAPONS_SLOTS = 13;
static ammo, weaponid;
for (new i; i != MAX_WEAPONS_SLOTS; i++)
{
if (GetPlayerWeaponData(playerid, i, weaponid, ammo) == 0)
return 0;
if (weaponid == _weaponid)
return 1;
}
return 0;
}
if(gCheckPlayerWeapon(playerid, putweaponidhere)) //put the id of the weapon that you desire
{
//attach shotgun code
}
|
Put this at the end of the gamemode.
Код:
stock gCheckPlayerWeapon(playerid, _weaponid)
{
const MAX_WEAPONS_SLOTS = 13;
static ammo, weaponid;
for (new i; i != MAX_WEAPONS_SLOTS; i++)
{
if (GetPlayerWeaponData(playerid, i, weaponid, ammo) == 0)
return 0;
if (weaponid == _weaponid)
return 1;
}
return 0;
}
Код:
if(gCheckPlayerWeapon(playerid, putweaponidhere)) //put the id of the weapon that you desire
{
//attach shotgun code
}
|
|
Doesn't work, I spawn the weapon and it doesn't place gun on my back
|
if(gCheckPlayerWeapon(playerid, putweaponidhere)) //put the id of the weapon that you desire
{
//attach shotgun code <<<<<<<<<<<<<<<<<<<<<<<<< HERE
}
SetPlayerAttachedObject(playerid, 4,349,1,-0.102073, -0.200483, 0.094914, 15.186383, 61.980533, 357.054473);
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);
}
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
}