shooting disable bug
#1

So i wan't to disable shooting in safe zone.

pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerShoting(playerid) && IsPlayerInSafeZone(playerid)){SetPlayerArmedWeapon(playerid, 0);ClearAnimations(playerid);}
return 1;

}
pawn Код:
stock IsPlayerShoting(playerid)
{
        new anim = GetPlayerAnimationIndex(playerid);
        if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) || (anim == 1643) || (anim == 1453) || (anim == 220) || (anim == 1333) || (anim == 1333) || (anim ==1167) || (anim ==1365) || (anim ==1643) || (anim ==1453) || (anim ==220)) return 1;
        return 0;
}
If i simply press shooting button shooting won't work, but if i hold shooting button with no gun and then change to any gun while holding it forks fine. How to disable shooting on that hold+change bug?
Reply
#2

Use OnPlayerKeyStateChange.

Use
pawn Код:
if(PRESSED(KEY_NAME))
Then use
pawn Код:
if(HOLDING(KEY_NAME))
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#3

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInSafeZone(playerid) && PRESSED(KEY_FIRE))
    {
        if(HOLDING(KEY_FIRE)) SetPlayerArmedWeapon(playerid, 0);
    }
}
I can still shoot . Any other suggestions?
Reply
#4

Try it like this?

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(HOLDING(KEY_FIRE))
    {
        if(IsPlayerInSafeZone(playerid)
        {
            SetPlayerArmedWeapon(playerid, 0);
            ClearAnimations(playerid);
        }
    }
    if(PRESSED(KEY_FIRE))
    {
        if(IsPlayerInSafeZone(playerid)
        {
            SetPlayerArmedWeapon(playerid,0);
            ClearAnimations(playerid);
        }
    }
    return 1;
}
Reply
#5

still no problem to shoot
Reply
#6

any other suggestions?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)