Weapon states
#1

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.
Reply
#2

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
Reply
#3

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

So, anybody else knows?
Reply
#4


Код:
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.
Reply
#5

But WEAPONSTATE_MORE_BULLETS gets when you have more then 1 bullet.
Reply
#6

So WEAPONSTATE_MORE_BULLETS checks if you have more than 1 bullet?

It's kinda useless because you can use GetPlayerAmmo?
Reply
#7

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.
Reply
#8

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.
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)