Checkpoint problems
#1

I have started to create a DMV script but im already having problems with the first checkpoint when the player enters the vehicle it should start the first checkpoint can you see anything wrong here:

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new CarCheck = GetPlayerVehicleID(playerid);
 if(CarCheck == DMV1 || CarCheck == DMV2 || CarCheck == DMV3)
 {
 if(PlayerInfo[playerid][DMV] == 1)
 {
SetPlayerCheckpoint(playerid, 1427.2813, -1613.6610, 13.0077, 10.0);
SendClientMessage(playerid,SYellow,"Please drive follow all the checkpoints, as you go alonge.");
return SendClientMessage(playerid,SYellow,"the weather may change, just keep calm and drive carefully.");
 }
 }

	return 1;
}
Reply
#2

So the checkpoint isn't appear and you don't get "Please drive follow all the checkpoints, as you go alonge." message?
If so you have to check "PlayerInfo[playerid][DMV]". Did you set it to "1" anywhere (Do you have "PlayerInfo[playerid][DMV] == 1" somewhere)?
Reply
#3

yes i set it to 1 here

Код:
case DIALOG_DMVCARTEST:
 		{
	 		if(response)
	 		{
	 		SendClientMessage(playerid, COLOUR_YELLOW, "Welcome to the DMV Licensing Center");
	 		SendClientMessage(playerid, COLOUR_YELLOW, "We will now start your test please head outside");
	 		SendClientMessage(playerid, COLOUR_YELLOW, "to the test car where we will begin the trip to getting");
	 		SendClientMessage(playerid, COLOUR_YELLOW, "You your driving license.");
	 		PlayerInfo[playerid][DMV] = 1;
	 		}
	   		else
	   		{
	        SendClientMessage(playerid, COLOUR_YELLOW, "Come back soon, You'll be getting fined if you drive without a license or");
	        SendClientMessage(playerid, COLOUR_YELLOW, "even a jail sentence.");
			}
   		}
Reply
#4

Try changing this line:

pawn Код:
if(CarCheck == DMV1 || CarCheck == DMV2 || CarCheck == DMV3)
To:

pawn Код:
if(vehicleid == DMV1 || vehicleid == DMV2 || vehicleid == DMV3)
Reply
#5

that worked cheers now that that checkpoint works how would i do another checkpoint after it would i just despawn that one and respawn another ye?
Reply
#6

https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint

You can create another checkpoint if player enter a checkpoint with defined are (IsPlayerIsRangeOfPoint)
Reply
#7

Or you can do this...

pawn Код:
//Add "CPID" to the player info enum.

//Under "OnPlayerConnect" add this line "PlayerInfo[playerid][CPID] = 0;" to reset the value.

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == DMV1 || vehicleid == DMV2 || vehicleid == DMV3)
    {
        if(PlayerInfo[playerid][DMV] == 1)
        {
            SetPlayerCheckpoint(playerid, 1427.2813, -1613.6610, 13.0077, 10.0);
            PlayerInfo[playerid][CPID] = 1;
            SendClientMessage(playerid,SYellow,"Please drive follow all the checkpoints, as you go alonge.");
            return SendClientMessage(playerid,SYellow,"the weather may change, just keep calm and drive carefully.");
        }
    }
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    switch(PlayerInfo[playerid][CPID])
    {
        case 1:
        {
            //After the player enters the first checkpoint...
            PlayerInfo[playerid][CPID] = 2;
            SetPlayerCheckpoint(playerid, 1427.2813, -1613.6610, 13.0077, 10.0); //Show the 2nd cp
        }
        case 2:
        {
            //After the player enters the 2nd checkpoint... continue this process.
        }
    }
    return 1;
}
Reply
#8

the first checkpoint wont work, do i have to make them racing checkpoints because im in a car? this is the code i have for the first checkpoint.

Код:
if(IsPlayerInRangeOfPoint(playerid, 4.0 ,1427.2813, -1613.6610, 13.0077))
	{
	DisablePlayerCheckpoint(playerid);
	SetPlayerCheckpoint(playerid, 1452.8339,-1290.6772,13.0073, 10.0);
    }
Reply
#9

Pot thanks alot your way worked =P thumbs up and thanks varth for the initial help =P both reped
Reply
#10

No problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)