[Question/Help] - FindPlayer command.
#1

I have question. I'm trying to create " /FindPlayer " command what will find Player (by his id) position and set checkpoint to Playerid.

But I want make it so if that player who's position we are searching, if he moves that you'll get other coords.
I know I need to use timer for that but I can't find the way to sync them.

I have done this code so far:
pawn Код:
Erm...
Any help?
Reply
#2

Pass two id's onto the timer, the playerid, and in your case "player" then in the function you are calling with the timer get the position of player and set the checkpoint for playerid, and maybe get the interior of both of you to cancel the timer if he get's into one. And you will need a command like /stopfindingplayer and with it you destroy the timer. Hope the rough explanation helped.
Reply
#3

Something like this?
pawn Код:
// Global array
new FindCPTimer[MAX_PLAYERS];
// Under Command
FindCPTimer[playerid] = SetTimerEx("SyncFindCP", 1000, true, "ii", playerid, player);

// Function under timer
public SyncFindCP(Looking, ToFind)
{
    if( IsPlayerConnected(ToFind) )
    {
        new Float:ToFindPos[3];
        GetPlayerPos(ToFind, ToFindPos[0], ToFindPos[1], ToFindPos[2]);
        SetPlayerCheckPoint(Looking, ToFindPos[0], ToFindPos[1], ToFindPos[2]);
    }
    else{
        DisablePlayerCheckPoint(Looking);
        KillTimer(FindCPTimer[playerid]);
    }
    return 1;
}
Reply
#4

Yeah!
Thanks for this -John- and TheXIII. I got it now, I was actually stuck when you need to SetTimer for player, but I worked that out and now works like a charm.
One more time - Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)