SA-MP Forums Archive
3 problems... - 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: 3 problems... (/showthread.php?tid=290314)



3 problems... - lukas567 - 15.10.2011

Hey!
I need some help...
1. When i come closer to NPC, it chases me and when it gets more closer me it attacks, but Animation is still running even i added to Timer SetFacing Functions to Kill timer Chase and Apply animation to fight...

Код:
if(IsPlayerNPC(npcid))
{
if(IsPlayerInRangeOfPoint(i,2,npcx,npcy,npcz))
{
timer2 = SetTimerEx("SetFacing", 1000, 1, "iff", npcid, AttackRadius, Accuracy);// It makes him attack me
}
if(IsPlayerInRangeOfPoint(i, 10, npcx, npcy, npcz))
{
timer1 = SetTimerEx("Chase",100,1,"i",npcid);// It makes him Chase
}
2. NPC runs very laggy... Maybe i need to set another time to timer?

Код:
if(IsPlayerNPC(npcid))
{
if(IsPlayerInRangeOfPoint(i,2,npcx,npcy,npcz))
{
timer2 = SetTimerEx("SetFacing", 1000, 1, "iff", npcid, AttackRadius, Accuracy);// It makes him attack me
}
if(IsPlayerInRangeOfPoint(i, 10, npcx, npcy, npcz))
{
timer1 = SetTimerEx("Chase",100,1,"i",npcid);// It makes him Chase
}
3. When i die from ,,NPC's hand" i die 2 times...

Код:
new Float:health;
   GetPlayerHealth(i, health);
   health -= 1.0;
   //if(health <= 0.0) health = 0.0;
   SetPlayerHealth(i, health);
Giving Reputation for answers!


Re: 3 problems... - TheLazySloth - 16.10.2011

1. We need the function with the animations.

2. NPCs are recorded to run, not functioned to run... Unless there was an update on them that I didn't know about.

3. Try it without that function... Meybe if NPC's hit players (since their like players) it already inflicts damage on the player.