NPC + IsPlayerInRangeOfPoint
#1

Hi guys, i'm using OnPlayerUdpate with IsPlayerInRangeOfPoint to check if a player is close of a certain NPC, but it lag : /

It also make problem with SendClientMessage*

pawn Код:
public OnPlayerUpdate(playerid)
{
    new npcname[MAX_PLAYER_NAME];

    if(IsPlayerNPC(playerid))
    {
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Target7_Bot", true)) GetPlayerPos(playerid, TargetX, TargetY, TargetZ);
        return 1;
    }
   
    if(TargetChase[playerid]==7)
    {
        if(IsPlayerInRangeOfPoint(playerid, 20.0, TargetX, TargetY, TargetZ))
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                GetPlayerName(i, npcname, sizeof(npcname));
                if(!strcmp(npcname, "Target7_Bot", true))
                {
                    Kick(i);
                    TargetChase[playerid]=0;
                    SendClientMessage(playerid, RED, ">> "WHITE"Mission fail, too close!");
                }
            }
        }
    }
    return 1;
}
*The "Mission fail" message is send like 50 times...


Someone can tell me an alternative ? (Without using OnPlayerUdpate)
Reply


Messages In This Thread
NPC + IsPlayerInRangeOfPoint - by Shoko Lacho - 11.03.2011, 04:10

Forum Jump:


Users browsing this thread: 2 Guest(s)