New Checkpoint
#1

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!
Reply
#2

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;
}
Reply
#3

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;
}
Reply
#4

@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;
}
Reply
#5

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
Reply
#6

Use my way its more faster..
Reply
#7

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

Show the line where you get that error..
Reply
#9

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;
Reply
#10

yeas ... but where you put that code?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)