25.02.2018, 13:22
How to check whether the player is performing any action ?
English my Bad. Sorry
English my Bad. Sorry
GetPlayerAnimationIndex for anims and GetPlayerSpecialAction for special actions.
|
cmd:mload(playerid, params[]) { if(GetPlayerAnimationIndex(playerid)) { SendClientMessageEx(playerid, -1, "You are using another action."); } return 1; }
Please show me the code you're using, this can't be used without checking for the exact anim.
|
cmd:fixcar(playerid, params[]) { if(PI[playerid][pJob] == MECHANIC_MAN) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessageEx(playerid, RED, "You can not repair your car while in the car."); return 1; } if(GetPlayerAnimationIndex(playerid)) { SendClientMessageEx(playerid, RED, "Please check that you are taking any action."); return 1; } if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_NONE) { SendClientMessageEx(playerid, RED, "Please check that you are taking any action."); return 1; } else { ApplyAnimation(playerid, "BD_FIRE", "wash_up", 4.0, 1, 0, 0, 0, 0, 1); SendClientMessageEx(playerid, GREEN, "You are starting to repair car."); return 1; } } return 1; }
Here is an example:
pawn Код:
|
if(HasAnimationApplied(playerid, "BD_FIRE", "wash_up"))
{
//They do.
}
else
{
//They don't.
}
I tried it but it failed.
I just stand still Although I do not use any action, it still fails. Код:
cmd:mload(playerid, params[]) { if(GetPlayerAnimationIndex(playerid)) { SendClientMessageEx(playerid, -1, "You are using another action."); } return 1; } |