SA-MP Forums Archive
Weapon states - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Weapon states (/showthread.php?tid=152038)



Weapon states - Packadore - 02.06.2010

Hello, i found this on wiki:

https://sampwiki.blast.hk/wiki/Weapon_States

They're all obvius except one: WEAPONSTATE_MORE_BULLETS

Could somebody explain what this does?

Thank you.


Re: Weapon states - RichyB - 02.06.2010

Well if you look at it, to me it gives me some sorta of idea.

WEAPONSTATE_UNKNOWN - Don't know this!
WEAPONSTATE_NO_BULLETS - When a Player has a weapon with No Bullets
WEAPONSTATE_LAST_BULLET - When a Player has a weapon with only One Bullet left.
WEAPONSTATE_MORE_BULLETS - Don't know this!
WEAPONSTATE_RELOADING - When a Player is reloading his weapon!

If you set a timer for WEAPONSTATE_LAST_BULLET
You could have it give the player X amounts of bullets.
This would be an alternative instead of setting the players Ammo to 999999 or whatever!

But, I am only a Nub Scriptz0r, so don't go by what I say xD


Re: Weapon states - Packadore - 02.06.2010

Lol, i said there are all pretty obvius i just asked about WEAPONSTATE_MORE_BULLETS.

So, anybody else knows?


Re: Weapon states - WackoX - 02.06.2010


Код:
new WeaponState[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
  if(GetPlayerWeaponState(playerid) != WeaponState[playerid])
  {
    OnPlayerWeaponStateChange(playerid, WeaponState[playerid], GetPlayerWeaponState(playerid));
    WeaponState[playerid] = GetPlayerWeaponState(playerid);
  }
  return 1;
}

OnPlayerWeaponStateChange(playerid, oldstate, newstate)
{
  new string[64];
  format(string, sizeof(string), "You changed your weapon state from %d to %d", oldstate, newstate);
  SendClientMessage(playerid, 0x102030FF, string);
  return 1;
}
Try this code, then you know when it's called.


Re: Weapon states - WackoX - 02.06.2010

But WEAPONSTATE_MORE_BULLETS gets when you have more then 1 bullet.


Re: Weapon states - Packadore - 02.06.2010

So WEAPONSTATE_MORE_BULLETS checks if you have more than 1 bullet?

It's kinda useless because you can use GetPlayerAmmo?


Re: Weapon states - WackoX - 03.06.2010

Quote:
Originally Posted by Packadore
So WEAPONSTATE_MORE_BULLETS checks if you have more than 1 bullet?

It's kinda useless because you can use GetPlayerAmmo?
No, because then you would get like -1 or 65535 with First and such weapons.


Re: Weapon states - IcyBlight - 03.06.2010

I'm just guessing, but maybe MORE_BULLETS is when you have more than the count can show?(like, no ammo, it goes blank)

That, or more than 1.

As I said, just guessing.


Re: Weapon states - Daren_Jacobson - 30.07.2010

no ammo (knife): always calls no ammo
single shot (shotgun, grenade): always calls last bullet (unless out of ammo), and calls reloading after a shot.
multi-shot (deagle, MP5): calls more bullets if you have > 1 in the current clip last bullet if == 1 in clip and reloading if == 0 in clip && >= 1 in ammo. calls No bullets if you just shot the last one.

pawn Код:
stock WeaponTypeHasAmmo(weaponid)
{
    switch(weaponid)
    {
        case 0 .. 15, 40, 44 .. 46: return 0; // no ammo
        case 22 .. 24, 26 .. 32, 37 .. 39, 41 .. 43: return 1; // multi shot, reload.
        case 16 .. 18, 25, 33 .. 36:return 2; // single shot, reload.
    }
    return 0;
}
I love thinking out loud.