SA-MP Forums Archive
New Checkpoint - 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: New Checkpoint (/showthread.php?tid=446507)



New Checkpoint - DJRebis - 26.06.2013

Hi, doing some checkpoints but how to add 2nd (new) checkpoint here?
Код:
public OnPlayerEnterCheckpoint(playerid)
{
    DisablePlayerCheckpoint(playerid);
    SendClientMessage(playerid,COLOR_ORANGE,"Drive back to docks!");
    SetPlayerCheckpoint(playerid,2462.9810,-2097.6760,13.5469, 5.0);
	return 1;
}
What i need to do? second i want like this
Код:
DisablePlayerCheckpoint(playerid);
	GivePlayerMoney(playerid,1000);
	SendClientMessage(playerid,COLOR_ORANGE,"You have finished delivery!");
	DestroyVehicle(GetPlayerVehicleID(playerid));
Tell/show me pls!


AW: New Checkpoint - Skimmer - 26.06.2013

For this you should use either streamer or IsPlayerInRangeOfPoint function.

Example

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z))
    {
        DisablePlayerCheckpoint(playerid);
        SendClientMessage(playerid,COLOR_ORANGE,"Drive back to docks!");
        SetPlayerCheckpoint(playerid,2462.9810,-2097.6760,13.5469, 5.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z))
    {
        DisablePlayerCheckpoint(playerid);
        GivePlayerMoney(playerid,1000);
        SendClientMessage(playerid,COLOR_ORANGE,"You have finished delivery!");
        DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}



Re: New Checkpoint - iJumbo - 26.06.2013

Define a new array
pawn Код:
new Checkpoint[MAX_PLAYERS];
Where you create the frist checkpoint
pawn Код:
SetPlayerCheckpoint(playerid,your frist checkpoint settings..
Checkpoint[playerid] = 1;

In OnPlayerEnterCheckpoint(playerid)

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(Checkpoint[playerid] == 1) {
        DisablePlayerCheckpoint(playerid);
        SendClientMessage(playerid,COLOR_ORANGE,"Drive back to docks!");
        SetPlayerCheckpoint(playerid,2462.9810,-2097.6760,13.5469, 5.0);
        Checkpoint[playerid] = 2;
    } else if(Checkpoint[playerid] == 2) {
        DisablePlayerCheckpoint(playerid);
        GivePlayerMoney(playerid,1000);
        SendClientMessage(playerid,COLOR_ORANGE,"You have finished delivery!");
        DestroyVehicle(GetPlayerVehicleID(playerid));
        Checkpoint[playerid] = 0;
    }
    return 1;
}



AW: New Checkpoint - Skimmer - 26.06.2013

@iJumbo 's ones is also good, but you need create this everywhere, where you create a checkpoint. I recommend to use stock-function.

pawn Код:
stock SetPlayerCheckpointEx(playerid, Float:x, Float:y, Float:z, Float:range, id)
{
    SetPlayerCheckpoint(playerid, x, y, z, range);
    Checkpoint[playerid] = id;
}



Re: AW: New Checkpoint - DJRebis - 26.06.2013

Quote:
Originally Posted by Skimmer
Посмотреть сообщение
For this you should use either streamer or IsPlayerInRangeOfPoint function.

Example

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z))
    {
        DisablePlayerCheckpoint(playerid);
        SendClientMessage(playerid,COLOR_ORANGE,"Drive back to docks!");
        SetPlayerCheckpoint(playerid,2462.9810,-2097.6760,13.5469, 5.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z))
    {
        DisablePlayerCheckpoint(playerid);
        GivePlayerMoney(playerid,1000);
        SendClientMessage(playerid,COLOR_ORANGE,"You have finished delivery!");
        DestroyVehicle(GetPlayerVehicleID(playerid));
    }
    return 1;
}
Emm i got 2 errors: error 036: empty statement


Re: New Checkpoint - iJumbo - 26.06.2013

Use my way its more faster..


Re: New Checkpoint - DJRebis - 26.06.2013

OK, but i have 2 errors again! This time: error 017: undefined symbol "playerid"


Re: New Checkpoint - iJumbo - 26.06.2013

Show the line where you get that error..


Re: New Checkpoint - DJRebis - 26.06.2013

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
Show the line where you get that error..
This i think
Код:
  SetPlayerCheckpoint(playerid,-49.0372,-1150.6403,1.0781, 5.0);
    Checkpoint[playerid] = 1;



Re: New Checkpoint - iJumbo - 26.06.2013

yeas ... but where you put that code?