Weapons - 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: Weapons (
/showthread.php?tid=294727)
Weapons -
BaubaS - 03.11.2011
This is very annoyning: for example, I have a shotgun with 500 bullets. Then, I get 1 sawn-off bullet et voila - I have 501 sawn off bullets. Any solutions? I think its something to do with weap slots :3
Re: Weapons -
Medardo4Life - 03.11.2011
change the amount of ammo when giving new weapon, and if you have to subtract from current ammo.
Re: Weapons -
nmader - 03.11.2011
Well, if you mean that you are wanting 500 spawn off bullets after switching from a standard shotgun, it is rather simple...
This should work, although I have no tested it...
Код:
{
ResetPlayerWeapons(playerid);
return 1;
}
{
AC_GivePlayerWeapon(playerid, 26, 500);
return 1;
}
Re: Weapons -
BaubaS - 03.11.2011
Quote:
Originally Posted by nmader
Well, if you mean that you are wanting 500 spawn off bullets after switching from a standard shotgun, it is rather simple...
This should work, although I have no tested it...
Код:
{
ResetPlayerWeapons(playerid);
return 1;
}
{
AC_GivePlayerWeapon(playerid, 26, 500);
return 1;
}
|
NONO, you didn't understood what do I need :^
Medardo4Life: Can't understand :3
Re: Weapons -
nmader - 03.11.2011
Well then, specify further what you need?
Re: Weapons -
BaubaS - 03.11.2011
Okay, there's "better" example:
I have 500 AK-47 bullets. Then, by using GivePlayerWeapon I get 1 M4 bullet. After that, instead of having 1 M4 bullet, I have 501 M4 bullets = its mixing?.. So, I need a "function" which would fix that, I mean in this situation I would have 1 m4 bullet, not 501
Re: Weapons -
CyNiC - 03.11.2011
Use this:
pawn Код:
Real_GivePlayerWeapon(playerid, weaponid, ammo)
{
new weapons[2][13];
for(new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, weapons[0][i], weapons[1][i]);
if(weapons[0][i] == weaponid)
{
GivePlayerWeapon(playerid, weaponid, -weapons[1][i]);
GivePlayerWeapon(playerid, weaponid, ammo);
return 1;
}
}
GivePlayerWeapon(playerid, weaponid, ammo);
return 1;
}