public OnPlayerTargetActor(playerid, newtarget, oldtarget) { if (newtarget == prostitutebot) { ApplyActorAnimation(newtarget, "PED", "handsup", 4.1, 0, 0, 0, 1, 0); if(GetPVarInt(playerid,"RobTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"Please wait 5 minutes before another robbery."); if(gTeam[playerid] == TEAM_COP) return SendClientMessage(playerid, red, "Cops cannot rob stores"); pRobTimerID[playerid] = SetTimerEx("pRobTimer", 1000, true, "i", playerid); pRobCount[playerid] = 31; SetPVarInt(playerid,"RobTime",GetTickCount()+300000); } if (oldtarget != INVALID_ACTOR_ID) { ClearActorAnimations(oldtarget); } }
stock IsPAiming(playerid)
{
new playeranim = GetPlayerAnimationIndex(playerid);
if (((playeranim >= 1160) && (playeranim <= 1163)) || (playeranim == 1167) || (playeranim == 1365) ||
(playeranim == 1643) || (playeranim == 1453) || (playeranim == 220)) return 1;
return 0;
}
Off topic: what the fuck lmao i didn't even know that this callback exists i always used getplayertargetactor under onplayerupdate or a fixed timer lol!
On topic: you can set a timer for 3-5 seconds and check if isplayeraiming = rob else = return 0; if you want the player aiming function here it is: PHP код:
|
if (oldtarget != INVALID_ACTOR_ID) { ClearActorAnimations(oldtarget); if(IsRobbing[playerid] == 1) { SendClientMessage(playerid,0xFF0000FF,"You lowered your gun and abandoned the robbery."); GameTextForPlayer(playerid, "~r~Robbery Failed", 3000, 5); IsRobbing[playerid] =0; pRobCount[playerid] = 0; KillTimer(pRobTimerID[playerid]); robmoney[playerid] = 1; } }