SA-MP Forums Archive
Keeping a marker on a player. - 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)
+--- Thread: Keeping a marker on a player. (/showthread.php?tid=310984)



Keeping a marker on a player. - BleverCastard - 14.01.2012

Hello,
I'm thinking of Making a CMD:follow [id] for the ID 1 and 5. But I dunno how to keep the Marker on a Player, Help?


Re: Keeping a marker on a player. - iGetty - 14.01.2012

Do you mean, with a checkpoint?

For instance, I could have this:

pawn Код:
//Under OnGameModeInit()

SetTimer("CheckpointTimer", 1000, 1);
pawn Код:
//at the top of the script:

Following[MAX_PLAYERS];
BeingFollowed[MAX_PLAYERS];
pawn Код:
//Under on player connect:

Following[playerid] = 0;
BeingFollowed[playerid] = 0;
pawn Код:
command(follow, playerid, params[])
{
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, GREY, "Server: /follow [playerid/name]");
    {
        new Float:x, Float:y, Float:z;
        GetPlayerPos(id, x, y, z);
        SetPlayerCheckpoint(playerid, x, y, z, 5);
        Following[playerid] = 1;
        BeingFollowed[id] = 1;
    }
    return 1;
}
pawn Код:
Above the command:

forward CheckpointTimer();
public CheckpointTimer()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(BeingFollowed[i] == 1)
        {
             new Float:x, Float:y, Float:z;
             GetPlayerPos(i, x, y, z);
             if(Following[i] == 1)
             {
                 SetPlayerCheckpoint(i, x, y, z, 5);
             }
         }
    }
    return 1;
}



Re: Keeping a marker on a player. - BleverCastard - 14.01.2012

Yeah, a Red circle thing.


Re: Keeping a marker on a player. - iGetty - 14.01.2012

Check my previous post again, edited.


Re: Keeping a marker on a player. - BleverCastard - 14.01.2012

Alright, Thanks. +1.