NPC position
#1

hi, i would like to know what is the best way to check npc position (like PlayerToPoint()).It should be onPlayerUpdate or maybe timer?Something else?
Reply
#2

You could try a checkpoint set for the NPC only. (Didn't test this, just an idea).

If this doesn't work, a timer would be the best. OnPlayerUpdate is called too often.
Reply
#3

Yes, i tried it, but it was alot cp with progress, but when i read your post i had an idea...thx
Reply
#4

Quote:
Originally Posted by marrcko
Посмотреть сообщение
Yes, i tried it, but it was alot cp with progress, but when i read your post i had an idea...thx
Alright. Good luck.
Reply
#5

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    DisablePlayerCheckpoint(playerid);
    if(IsPlayerNPC(playerid))
        {
        SendClientMessageToAll(MELSVA,"NPC ENTERED CP");
        if(IsPlayerInMission[playerid]==6)
            {
            IsNPCWinner=true;
            for(new p=0; p<MAX_PLAYERS; p++)
                {
                new names[26];
                GetPlayerName(p,names,sizeof(names));
                if(!strcmp(names,"NPC_Racer"))
                    {
                    SendClientMessageToAll(MELSVA,"NPC WINS RACES");
                    IsNPCInRace=false;
                    IsPlayerInMission[p]=0;
                    Kick(p);
                    ConnectNPC("NPC_Racer","steady");
                    }
                }
            }
        return 1;
        }
return 1;
}
Whats wrong, 'cause i don't get messages?
Oh, maybe this helps
pawn Код:
stock RaceStart(playerid)
    {
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~-~y~ 3 ~g~-",1000,3);
    TogglePlayerControllable(playerid,false);
    VehiclePlayerPos(playerid,-2274.1875,-120.1094,35.1253,272.8494);
    if(IsPlayerInRace[playerid]== 1)
        {
        for(new p=0; p<MAX_PLAYERS; p++)
            {
            new names[26];
            GetPlayerName(p,names,sizeof(names));
            if(!strcmp(names,"NPC_Racer"))
                {
                Kick(p);
                }
            }
        ConnectNPC("NPC_Racer","race1");
        for(new p=0; p<MAX_PLAYERS; p++)
            {
            new names[26];
            GetPlayerName(p,names,sizeof(names));
            if(!strcmp(names,"NPC_Racer"))
                {
                IsPlayerInMission[p]=6;
                SetPlayerCheckpoint(p,-1735.4344,-580.2195,16.0630,15);
                }
            }
        }
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)