NPC's Timer help.
#1

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!
Reply
#2

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 ?
Reply
#3

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!
Reply
#4

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
Reply
#5

Ah! Right .
Yes, i've. Send you pm with the adress
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)