25.02.2016, 14:09
Update.
Hopefully the two new callbacks will be useful for scripters. Manually detecting those two things is a pain in the ass. Here's some examples:
- Fixed OnPlayerFall.
- Optimized some code.
- Added OnPlayerSprint.
- Removed "PLAYER_ACTION_JUMPING" and added a callback to make jumping easier to detect (OnPlayerJump).
- Removed "GetTickCount" and added a new method of calculating ticks - NetStats_GetConnectedTime.
pawn Код:
// Called when a player jumps by pressing the jump key.
public OnPlayerJump(playerid);
// Called when a player starts or stops sprinting.
public OnPlayerSprint(playerid, status);
pawn Код:
// Returns 1 if the player is jumping.
native IsPlayerJumping(playerid);
// Returns 1 if the player is sprinting.
native IsPlayerSprinting(playerid);
pawn Код:
public OnPlayerJump(playerid)
{
if(playerLegBroken[playerid])
{
ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff", 4.1, 0, 1, 1, 0, 0);
}
return 1;
}
pawn Код:
public OnPlayerSprint(playerid, status)
{
if(status)
{
if(random(100) < 10) // 10 percent chance of the player randomly tripping from sprinting.
{
ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff", 4.1, 0, 1, 1, 0, 0);
GameTextForPlayer(playerid, "~r~You tripped and fell!", 3000, 3);
}
}
return 1;
}