SA-MP Forums Archive
Reload after one shot. - 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: Reload after one shot. (/showthread.php?tid=484422)



Reload after one shot. - zClaw - 30.12.2013

Hello, I need some help.

When I shoot with a country rifle (Weapon ID 33), I want to make a reload animation after the shot. When the animation is over the player will be able to shoot once again, and reload and then shoot and so on.

I was trying it with OnPlayerKeyStateChange, but I failed somehow.

Could someone provide me the code with an explanation?

Thanks in advance!


Re: Reload after one shot. - SilentSoul - 30.12.2013

Try that not sure about that animation but i will test it.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)//If he clicked LCTRL / LMB (Left Mouse Button)
    {
        if(GetPlayerWeapon(playerid) == 33)//if he got country rifle
        {
        ApplyAnimation(playerid,"BUDDY","buddy_reload",4.1,1,1,1,1,1000,1);//applying animation with time (1 second)
        }
    }
    return 1;
}



Re: Reload after one shot. - zClaw - 30.12.2013

Looking good, also makes sense.

REP+!