GivePlayerWeaponData does not work correctly - 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: GivePlayerWeaponData does not work correctly (
/showthread.php?tid=616168)
GivePlayerWeaponData does not work correctly -
ax1 - 01.09.2016
Код:
CMD:gub(playerid)
{
new ammo2, weapon=0;
GetPlayerWeaponData(playerid, 2, weapon, ammo2);
if(weapon!=22 && weapon!=23 && weapon!=24)
{
GivePlayerWeapon(playerid, 24, 3);
}
else
{
new string[99];
format(string, sizeof(string), "Weapon slot taken %i", weapon);
SendClientMessage(playerid, -1, string);
}
return 1;
}
I type /gub I get deagle. I empty the mag and gun dissappears. Then I type /gub again and I get message "Weapon slot taken 24" (24 = deagle) even thought I don't have a deagle since I shoot all the bullets and it dissappeared
Re: GivePlayerWeaponData does not work correctly -
DarkSkull - 01.09.2016
Try this:
PHP код:
CMD:gub(playerid)
{
new ammo2, weapon=0;
GetPlayerWeaponData(playerid, 2, weapon, ammo2);
if((weapon !=22 && weapon !=23 && weapon !=24) || ammo2 == 0)
{
GivePlayerWeapon(playerid, 24, 3);
}
else
{
new string[99];
format(string, sizeof(string), "Weapon slot taken %i", weapon);
SendClientMessage(playerid, -1, string);
}
return 1;
}
Re: GivePlayerWeaponData does not work correctly -
ax1 - 01.09.2016
Quote:
Originally Posted by DarkSkull
Try this:
PHP код:
CMD:gub(playerid)
{
new ammo2, weapon=0;
GetPlayerWeaponData(playerid, 2, weapon, ammo2);
if((weapon !=22 && weapon !=23 && weapon !=24) || ammo2 == 0)
{
GivePlayerWeapon(playerid, 24, 3);
}
else
{
new string[99];
format(string, sizeof(string), "Weapon slot taken %i", weapon);
SendClientMessage(playerid, -1, string);
}
return 1;
}
|
Thanks, havent thought about this