26.09.2012, 18:23
I want to find if a player has an AK47 (not in hand, with GetPlayerWeapon) in inventory.
Can someone help me ?
Can someone help me ?
new weapons[13][2]; for (new i = 0; i < 13; i++) { GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]); }
if(weapons[input the weapon slot here][0] == weapon id) { //do something }
new gun[2];
GetPlayerWeaponData(playerid, 5, gun[0], gun[1]);
if(gun[0] == 30) SendClientMessage(playerid,-1,"You Have AK-47"); //your code here
PlayerHasWeapon(playerid)
{
new playerWeaponData[2][13];
for(new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, playerWeaponData[0][i], playerWeaponData[1][i]);
if(playerWeaponData[0][i] > 0)
{
return 1;
}
}
return 0;
}