SA-MP Forums Archive
Help: FCNPC_StopAim dont work for me - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help: FCNPC_StopAim dont work for me (/showthread.php?tid=660681)



Help: FCNPC_StopAim dont work for me - bookknp - 10.11.2018

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(playeridnewkeysoldkeys)
{
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(bot1playeridFCNPC_MOVE_TYPE_AUTOFCNPC_MOVE_TYPE_AUTOtrue0.0true0.01.5250);
    
FCNPC_AimAtPlayer(bot1playeridtrue, -1true0.00.00.00.00.00.0);
     
SetTimer("Stop"33000false);
     
    return 
1;
}
public 
Stop()
{
    
FCNPC_StopAim(bot1); // <------- Dont work, why?




Re: Help: FCNPC_StopAim dont work for me - NaS - 10.11.2018

You'll need to use StopShoot too iirc.
Otherwise try to reset the NPC's keys by doing

Код:
FCNPC_SetKeys(bot1, 0, 0, 0);
FCNPC sets the keys automatically when using AimAt/ShootAt etc. So resetting them will also make the NPC stop what he's currently doing.


Re: Help: FCNPC_StopAim dont work for me - bookknp - 10.11.2018

Quote:
Originally Posted by NaS
Посмотреть сообщение
You'll need to use StopShoot too iirc.
Otherwise try to reset the NPC's keys by doing

Код:
FCNPC_SetKeys(bot1, 0, 0, 0);
FCNPC sets the keys automatically when using AimAt/ShootAt etc. So resetting them will also make the NPC stop what he's currently doing.
EDIT: oh sorry, yes it stop!!! +rep