NPC's Timer help. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: NPC's Timer help. (
/showthread.php?tid=255182)
NPC's Timer help. -
Rule111 - 14.05.2011
Hello... I'm developing a filterscript with NPC's, (With CNPC by Alex009) and my question is the next,
when a npc get damage (OnNPCGetDamage) a timer actives, (AttackNPC) who make the npc get the real position of the player is shooting her, and the position is update. Like this:
Код:
public AttackNPC(npcid, giveplayerid)
{
new Float:pos[3];
GetPlayerPos(GetPlayerClosestPlayer(npcid),pos[0],pos[1],pos[2]);
NPC_ShotAt(npcid,pos[0],pos[1],pos[2]);
return 1;
}
But, timer's running over 50 NPC's is not a good idea.
What would be the best way of do this?
Thank's!
Re: NPC's Timer help. -
boelie - 14.05.2011
make a loop through all players and make it check wich players are NPC
offtopic: cnpc doesnt realy work on the newest samp version does it ?
Respuesta: NPC's Timer help. -
Rule111 - 14.05.2011
As might be what you mean? If you explain a little more, thank you!
I'm burning my head thinking and thinking :/
Off: At least for my it's works, i've 0.3c
Cheers!
Re: NPC's Timer help. -
boelie - 14.05.2011
here is a link about loops
https://sampwiki.blast.hk/wiki/Loops
i think yours would look something like this;
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerNPC(i)) //i think in cnpc you need to use if(IsValidNPC(i)) or something
{
// your stuff here
}
}
do you have homehost ? i wanna have fun with those old cnpc's XD
Respuesta: NPC's Timer help. -
Rule111 - 14.05.2011
Ah! Right

.
Yes, i've. Send you pm with the adress