SA-MP Forums Archive
Make checkpoints on players? - 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: Make checkpoints on players? (/showthread.php?tid=442257)



Make checkpoints on players? - xXitsgodzillaXx - 06.06.2013

Okay So I've started working on a job filterscript and I'm starting out with making a taxi service job, and I was curious on how to make it so when a player will type a certain command and it will then create a check point for the players that are in the taxi job, on the player that typed the specific command?


Re: Make checkpoints on players? - Goldilox - 06.06.2013

pawn Код:
CMD:taxi(playerid,params)
{
// ShowPlayerCheckPoint here!
}



Re: Make checkpoints on players? - MP2 - 06.06.2013

GetPlayerPos.


Re: Make checkpoints on players? - xXitsgodzillaXx - 06.06.2013

Hmm, okay I'll get back to you guys later when I get some progress made.


Re: Make checkpoints on players? - xXitsgodzillaXx - 06.06.2013

Okay so sofar I have this

pawn Код:
CMD:call(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SetPlayerCheckpoint(playerid, x, y, z, 3.0);
    new string[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    GivePlayerMoney(playerid, 100);
    format(string,sizeof string, "%s Is requesting a taxi!",pName);
    SendClientMessageToAll(0x059EBEFF,string);
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(taxijob[playerid] == 1)
    {
        DisablePlayerCheckpoint(playerid);
        return 1;
    }
    return 0;
}
How would I make it so that someone in the job can accept the call and only they can see the check point. and then what functions could i use to make it so when the player enters the taxi they just called, it will pay the driver cab fare? I know i would use the "onplayerentervehcile" callback right?


Re: Make checkpoints on players? - Vince - 06.06.2013

First you need a variable that holds the job the player has.
pawn Код:
enum
{
    JOB_NONE,
    JOB_TAXI_DRIVER,
    JOB_POLICE,
    JOB_MEDIC,
}

new pJob[MAX_PLAYERS];
Then you need a loop.
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
    if(pJob[i] == JOB_TAXI_DRIVER)
    {
        SetPlayerCheckpoint(i, x, y, z, 1.5);
    }
}
Though, if you're also using checkpoints for other things then I'd recommend looking at the Streamer plugin.


Re: Make checkpoints on players? - xXitsgodzillaXx - 06.06.2013

Okay well I'm using incognitos object streamer, What would i use to do that and another question for you, How would I set a players job using what you showed me.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_TAXI)
    {
        if(response)
        {
            for(new i; i < MAX_PLAYERS; i++)
            if(pJob[i] == JOB_NONE)
            {
                //What would go here?
                SendClientMessage(playerid, COLOR_LIGHTRED, "JOB INFO: {FFFFFF}You have accepted the job, please get in a Taxi.");
            }
            else if(!response)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "JOB INFO: {FFFFFF}You have rejected the job");
            }
        }
        return 1;
    }
    return 0;
}
refer to the code to see what i mean.