10.11.2018, 12:45
Hello friends, I have a problem that when I use FCNPC_AimAtPlayer does not stop shooting the player (even if you die), I have set a 33-second SetTimer with the function FCNPC_StopAim (npcid) but it does not stop firing either. Do you know why this happens? what is my error?
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new Float:ax,Float:ay,Float:az;
GetPlayerPos(bot1,ax,ay,az);
if(IsPlayerInRangeOfPoint(playerid,15,ax,ay,az))
{
if(PRESSED(KEY_FIRE))
{
SetTimerEx("Shot",1000,false, "i", playerid);
}}
return 1;
}
public Shot(playerid)
{
FCNPC_GoToPlayer(bot1, playerid, FCNPC_MOVE_TYPE_AUTO, FCNPC_MOVE_TYPE_AUTO, true, 0.0, true, 0.0, 1.5, 250);
FCNPC_AimAtPlayer(bot1, playerid, true, -1, true, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
SetTimer("Stop", 33000, false);
return 1;
}
public Stop()
{
FCNPC_StopAim(bot1); // <------- Dont work, why?
}