So this is a simple dodge system.
Code:
#include <a_samp>
#define KEY_AIM (128)
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
PreloadAnimLib(playerid, animlib[])
{
ApplyAnimation(playerid,animlib,"null",0.0,0,0,0,0,0);
}
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Simple dodge system by !Pumpkin reloaded");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
print("\n--------------------------------------");
print(" Simple dodge system by !Pumpkin unloaded");
print("--------------------------------------\n");
return 1;
}
public OnPlayerSpawn(playerid)
{
PreloadAnimLib(playerid,"PED");
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new playerState = GetPlayerState(playerid); // Get the killer's state
if(playerState == PLAYER_STATE_ONFOOT) // If the killer was in a vehicle
{
if (PRESSED( KEY_CROUCH | KEY_AIM ))
{
ApplyAnimation(playerid, "PED", "EV_dive", 4.1, 0, 1, 1, 1, 5, 1);
}
}
return 1;
}