Not setting checkpoint
#1

Hi

I am making a job and it loads the first checkpoint and second checkpoint but on the last chckpoint it does everything its suppose todo but it doesnt set the player checkpoint back to HQ

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	//Fedex Job
	if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
	{
		if(FEDEXCPT[playerid] == 1)
		{
			ShowPlayerDialog(playerid, DIALOG_FEDEXD, DIALOG_STYLE_LIST, "Fedex Delivery", " Car Parts \n              24/7 Items \n Crop Seeds", "Select", "Cancel");
			FreezePlayer(playerid, 1);
		}
	    //Car Parts
	    if(FEDEXCPT[playerid] == 2)
	    {
	        FEDEXCPT[playerid] = 3;
	        SetPlayerCheckpoint(playerid, -2132.1865, -125.8788, 35.5553, 10);
		FreezePlayer(playerid, 5);
	        new string[18];
		format(string, sizeof(string), "Unloading van");
    		GameTextForPlayer(playerid, string, 3000, 3);
	        SendClientMessage(playerid, 0x0090F2FF, "Head back to HQ to get your pay!");
		return 1;
	    }	
	    if(FEDEXCPT[playerid] == 3)
	    {
			FEDEXCPT[playerid] = 0;
			DisablePlayerCheckpoint(playerid);
   			new cash = random(6000);
			GivePlayerMoney(playerid, cash);
			new string[128];
			format(string,sizeof(string),"Congradulations, you just finished the car parts route and received  $%d", cash);
			SendClientMessage(playerid, 0x0090F2FF, string);
			return 1;
		}
	}	
	return 1;
}
This is were it isnt setting the player checkpoint... It freezes the player and says "Head back to HQ" but doesnt set the checkpoint
Код:
  if(FEDEXCPT[playerid] == 2)
	    {
	        FEDEXCPT[playerid] = 3;
	        SetPlayerCheckpoint(playerid, -2132.1865, -125.8788, 35.5553, 10);
		FreezePlayer(playerid, 5);
	        new string[18];
		format(string, sizeof(string), "Unloading van");
    		GameTextForPlayer(playerid, string, 3000, 3);
	        SendClientMessage(playerid, 0x0090F2FF, "Head back to HQ to get your pay!");
		return 1;
		}
Please help me !
Reply
#2

Quote:
Originally Posted by Blademaster680
Посмотреть сообщение
Hi

I am making a job and it loads the first checkpoint and second checkpoint but on the last chckpoint it does everything its suppose todo but it doesnt set the player checkpoint back to HQ

Код:
public OnPlayerEnterCheckpoint(playerid)
{
	//Fedex Job
	if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
	{
		if(FEDEXCPT[playerid] == 1)
		{
			ShowPlayerDialog(playerid, DIALOG_FEDEXD, DIALOG_STYLE_LIST, "Fedex Delivery", " Car Parts \n              24/7 Items \n Crop Seeds", "Select", "Cancel");
			FreezePlayer(playerid, 1);
		}
	    //Car Parts
	    if(FEDEXCPT[playerid] == 2)
	    {
	        FEDEXCPT[playerid] = 3;
	        SetPlayerCheckpoint(playerid, -2132.1865, -125.8788, 35.5553, 10);
		FreezePlayer(playerid, 5);
	        new string[18];
		format(string, sizeof(string), "Unloading van");
    		GameTextForPlayer(playerid, string, 3000, 3);
	        SendClientMessage(playerid, 0x0090F2FF, "Head back to HQ to get your pay!");
		return 1;
	    }	
	    if(FEDEXCPT[playerid] == 3)
	    {
			FEDEXCPT[playerid] = 0;
			DisablePlayerCheckpoint(playerid);
   			new cash = random(6000);
			GivePlayerMoney(playerid, cash);
			new string[128];
			format(string,sizeof(string),"Congradulations, you just finished the car parts route and received  $%d", cash);
			SendClientMessage(playerid, 0x0090F2FF, string);
			return 1;
		}
	}	
	return 1;
}
This is were it isnt setting the player checkpoint... It freezes the player and says "Head back to HQ" but doesnt set the checkpoint
Код:
  if(FEDEXCPT[playerid] == 2)
	    {
	        FEDEXCPT[playerid] = 3;
	        SetPlayerCheckpoint(playerid, -2132.1865, -125.8788, 35.5553, 10);
		FreezePlayer(playerid, 5);
	        new string[18];
		format(string, sizeof(string), "Unloading van");
    		GameTextForPlayer(playerid, string, 3000, 3);
	        SendClientMessage(playerid, 0x0090F2FF, "Head back to HQ to get your pay!");
		return 1;
		}
Please help me !
You should firstly do

pawn Код:
DisablePlayerCheckpoint(playerid);
And then do the SetPlayerCheckpoint. That's first, and second, I don't see a timer where it unfreezes a player, is there one?
Reply
#3

Yes there is a timer to unfreeze the player FreezePlayer(playerid, 5); that 5 is the amount of seconds till he unfreezes.

I put DisablePlayerCheckpoint(playerid); before the SetPlayerCheckpoint and it still didnt reset the checkpoint to the next place

What happens is as I get into the checkpoint the checkpoint clears and it freezes me. it then says "Head back to HQ to get your pay!" and then unfreezes me but it skips right past the SetPlayerCheckpoint
Reply
#4

Oh, yeah I see your problem, remove the return 1s from the checkpoint, there should only be one return at the end of the Public OnPlayerEnterCheckpoint (or whatever you're using).
Reply
#5

Nope it wont work if the return 1; are gone because then when you go into the first checkpoint it will load all 3 at the same time

Full code
http://pastebin.com/PJr7zjD8
Reply
#6

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
        //Fedex Job
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
        {
                if(FEDEXCPT[playerid] == 1)
                {
                        ShowPlayerDialog(playerid, DIALOG_FEDEXD, DIALOG_STYLE_LIST, "Fedex Delivery", " Car Parts \n 24/7 Items \n Crop Seeds", "Select", "Cancel");
                        FreezePlayer(playerid, 1);
                }
            //Car Parts
           else if(FEDEXCPT[playerid] == 2)
            {
         
                        FreezePlayer(playerid, 5);
                new string[18];
                        format(string, sizeof(string), "Unloading van");
                GameTextForPlayer(playerid, string, 3000, 3);
                SendClientMessage(playerid, 0x0090F2FF, "Head back to HQ to get your pay!");
                DisablePlayerCheckpoint(playerid);
                FEDEXCPT[playerid] = 3;
                SetPlayerCheckpoint(playerid, -2132.1865, -125.8788, 35.5553, 10);                
               }      
               else if(FEDEXCPT[playerid] == 3)
            {
                       
                        new cash = random(6000);
                        GivePlayerMoney(playerid, cash);
                        new string[128];
                        format(string,sizeof(string),"Congradulations, you just finished the car parts route and received $%d", cash);
                        SendClientMessage(playerid, 0x0090F2FF, string);
                        FEDEXCPT[playerid] = 0;
                        DisablePlayerCheckpoint(playerid);
                }
        }      
        return 1;
}
Try it now.

EDIT: I also hope you're taking in mind the loose intendation stuff, because as you can see this isn't copied neatly here.
Reply
#7

Nope it still isnt setting the next checkpoint back to HQ

Its doing everything except setting the checkpoint back to HQ
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)