From Pickup to Checkpoint...
#1

Hi, if you remember me, I had lots of problems making my driving missions for my server lately...

Since the pickup system didn't work out in any way I decided to go to a checkpoint system...

well here's the code:
Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new vehicle;
    vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
    
    if(IsPlayerInRangeOfPoint(playerid, 2, 669.7355,-1275.9504,13.4609)) //startwork
    {
        if(vehicle == 516)
   		{
    		SetPlayerMapIcon( playerid, 2, 334.4390,-1519.8026,35.7015, 55, 0, MAPICON_GLOBAL );
 		   	GameTextForPlayer(playerid,"~w~ Job Lvl 1~g~ :Travis Pastrana is going to participate the X-games",4000,3);
 		   	SendClientMessage(playerid, COLOR_YELLOW, "|- Check the map to see the point where to go. -|");
 		   	IsWorking[playerid] = 1;
 		   	FinishedTask1[playerid] = 1;//he entered the pickup

            DisablePlayerCheckpoint(playerid);

 		   	SetPlayerCheckpoint(playerid,334.4390,-1519.8026,35.7015,2); //next checkpoint obviously...

 		   	//De Textdraw
 		   	TextDrawShowForPlayer(playerid,Opdracht);
 		   	Opdracht = TextDrawCreate(4.000000,435.000000,"~w~Bring ~y~ Travis Pastrana ~w~ From ~b~His hotel~w~ To ~g~The stadium!");
			TextDrawFont(Opdracht,1);
			TextDrawColor(Opdracht,0xFFFFFFAA);
			TextDrawLetterSize(Opdracht,0.4,1);
			TextDrawSetOutline(Opdracht,1);
			TextDrawSetShadow(Opdracht,0);
			TextDrawSetProportional(Opdracht,1);
			TextDrawBackgroundColor(Opdracht,0x000000ff);
			TextDrawUseBox(Opdracht, 1);
			TextDrawBoxColor(Opdracht, 0x000000AA);
			
			if(IsPlayerInRangeOfPoint(playerid, 50, 334.4390,-1519.8026,35.7015)) 
        	{
        		SetPlayerCheckpoint(playerid,334.4390,-1519.8026,35.7015,2);
        	}
			return 1;
		}
		//code here
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2, 334.4390,-1519.8026,35.7015))
    {
        if(vehicle == 516)
   		{
    		SetPlayerMapIcon( playerid, 2, 334.4390,-1519.8026,35.7015, 55, 0, MAPICON_GLOBAL );
 		   	GameTextForPlayer(playerid,"~w~ Job Lvl 1~g~ :Travis Pastrana is going to participate the X-games",4000,3);
 		   	SendClientMessage(playerid, COLOR_YELLOW, "|- Check the map to see the point where to go. -|");
 		   	IsWorking[playerid] = 1;
 		   	FinishedTask2[playerid] = 1;//he entered the pickup

 		   	//De Textdraw
 		   	TextDrawShowForPlayer(playerid,Opdracht);
 		   	Opdracht = TextDrawCreate(4.000000,435.000000,"~w~Bring ~y~ Travis Pastrana ~w~ From ~b~His hotel~w~ To ~g~The stadium!");
			TextDrawFont(Opdracht,1);
			TextDrawColor(Opdracht,0xFFFFFFAA);
			TextDrawLetterSize(Opdracht,0.4,1);
			TextDrawSetOutline(Opdracht,1);
			TextDrawSetShadow(Opdracht,0);
			TextDrawSetProportional(Opdracht,1);
			TextDrawBackgroundColor(Opdracht,0x000000ff);
			TextDrawUseBox(Opdracht, 1);
			TextDrawBoxColor(Opdracht, 0x000000AA);
			return 1;
		}
    }
    return 1;
}
NOTE: normally I'm using 3 CP but now I only show 2 because the problem is in the second checkpoint...

more code
Код:
forward CheckpointCheck();
public CheckpointCheck()
{
  for(new i; i<MAX_PLAYERS; i++)// a loop that goes though all players
  {
    if(IsPlayerConnected(i))
    {
        if(IsPlayerInRangeOfPoint(i, 50, 669.7355,-1275.9504,13.4609)) //The first CP
        {
        	SetPlayerCheckpoint(i,669.7355,-1275.9504,13.4609,2); //First CP
        }
        else
        {
          DisablePlayerCheckpoint(i);
        }
    }
  }
  return 1;
}
Ok so the problem...

when I drive in the first checkpoint it works, and the textdraw and client messages appear...
then when I go to the location of CP number 2, there is no checkpoint...

I Don't really see what is the problem...
it might be caused because my code is not so clean and readable all the time,
but I got no errors...

Any Help?
Reply
#2

Why don't you use the streamer from incognito?
Reply
#3

uhm, i have his streamer installed but IDK how to work with a checkp streamer :/
Reply
#4

Quote:
Originally Posted by knackworst
Посмотреть сообщение
uhm, i have his streamer installed but IDK how to work with a checkp streamer :/
forward CheckpointCheck();
pawn Код:
public CheckpointCheck()
{
  for(new i; i<MAX_PLAYERS; i++)// a loop that goes though all players
  {
    if(IsPlayerConnected(i))
    {
        if(IsPlayerInRangeOfPoint(i, 50, 669.7355,-1275.9504,13.4609)) //The first CP
        {
            SetPlayerCheckpoint(i,669.7355,-1275.9504,13.4609,2); //First CP
        }
        else if(IsPlayerInRangeOfPoint(i,50,.........................)) // SECOND CP
        {
                SetPlayerCheckpoint(i,.......); // second cp
         }
        else
        {
          DisablePlayerCheckpoint(i);
        }
    }
  }
  return 1;
}
And I also recommend you to use the streamer by Incognito.
Reply
#5

Posted Above removed
Reply
#6

THanks Wups
Reply
#7

Ok now I have this under OnPlayerEnterCheckpoint:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new vehicle;
    vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
   
    if(IsPlayerInRangeOfPoint(playerid, 2, 669.7355,-1275.9504,13.4609)) //startwork
    {
//==============================================================================
//Travis Job
//==============================================================================
        if(vehicle == 516)
        {
            if(IsWorking[playerid] == 0)
            {
                SetPlayerMapIcon( playerid, 2, 334.4390,-1519.8026,35.7015, 55, 0, MAPICON_GLOBAL );
                GameTextForPlayer(playerid,"~w~ Job Lvl 1~g~ :Travis Pastrana is going to participate the X-games",4000,3);
                SendClientMessage(playerid, COLOR_YELLOW, "|- Check the map to see the point where to go. -|");
                IsWorking[playerid] = 1;
                FinishedTask1[playerid] = 1;//he entered the pickup

                DisablePlayerCheckpoint(playerid);

                SetPlayerCheckpoint(playerid,334.4390,-1519.8026,35.7015,2);

                //De Textdraw
                TextDrawShowForPlayer(playerid,Opdracht);
                Opdracht = TextDrawCreate(4.000000,435.000000,"~w~Bring ~y~ Travis Pastrana ~w~ From ~b~His hotel~w~ To ~g~The stadium!");
                TextDrawFont(Opdracht,1);
                TextDrawColor(Opdracht,0xFFFFFFAA);
                TextDrawLetterSize(Opdracht,0.4,1);
                TextDrawSetOutline(Opdracht,1);
                TextDrawSetShadow(Opdracht,0);
                TextDrawSetProportional(Opdracht,1);
                TextDrawBackgroundColor(Opdracht,0x000000ff);
                TextDrawUseBox(Opdracht, 1);
                TextDrawBoxColor(Opdracht, 0x000000AA);
            }
           
            return 1;
        }
        //code here
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2, 334.4390,-1519.8026,35.7015))
    {
        if(vehicle == 516)
        {
            if(IsWorking[playerid] == 1)
            {
                SetPlayerMapIcon( playerid, 2, 334.4390,-1519.8026,35.7015, 55, 0, MAPICON_GLOBAL );
                GameTextForPlayer(playerid,"~w~ Job Lvl 1~g~ :Travis Pastrana is going to participate the X-games",4000,3);
                SendClientMessage(playerid, COLOR_YELLOW, "|- Check the map to see the point where to go. -|");
                IsWorking[playerid] = 1;
                FinishedTask2[playerid] = 1;//he entered the pickup

                DisablePlayerCheckpoint(playerid);
                SetPlayerCheckpoint(playerid,2732.6616,-1841.6346,9.9145,2);

                //De Textdraw
                TextDrawShowForPlayer(playerid,Opdracht);
                Opdracht = TextDrawCreate(4.000000,435.000000,"~w~Bring ~y~ Travis Pastrana ~w~ From ~b~His hotel~w~ To ~g~The stadium!");
                TextDrawFont(Opdracht,1);
                TextDrawColor(Opdracht,0xFFFFFFAA);
                TextDrawLetterSize(Opdracht,0.4,1);
                TextDrawSetOutline(Opdracht,1);
                TextDrawSetShadow(Opdracht,0);
                TextDrawSetProportional(Opdracht,1);
                TextDrawBackgroundColor(Opdracht,0x000000ff);
                TextDrawUseBox(Opdracht, 1);
                TextDrawBoxColor(Opdracht, 0x000000AA);
            }
            return 1;
        }
        //code here
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2, 2732.6616,-1841.6346,9.9145))
    {
        if(vehicle == 516)
        {
            if(IsWorking[playerid] == 1)
            {
                if(FinishedTask2[playerid] == 1)
                {
                    DestroyPickup(traviswork2);
                    new string[128];
                    GameTextForPlayer(playerid,"~w~ Mission accomplished!",4000,3);
                    SendClientMessage(playerid, COLOR_GREEN, "-U have been given $1500 for completing a level 1 mission.-");
                    RemovePlayerMapIcon( playerid, 2 );
                    TextDrawHideForPlayer(playerid, Opdracht);
                    GivePlayerMoney(playerid,1500);
                   
                    DisablePlayerCheckpoint(playerid);

                    FinishedTask2[playerid] = 0;
                    FinishedTask1[playerid] = 0;
                    IsWorking[playerid] = 0;
                    new mrand =random(500);
                    format(string,sizeof(string),"-Travis has given u $%d as a little bonus!-",mrand);
                    SendClientMessage(playerid,COLOR_GREEN,string);
                    GivePlayerMoney(playerid,mrand);

                    SendClientMessage(playerid, COLOR_SEXYGREEN, "-Mission accomplished, wanna go back to your base and do another mission? type /home.-");
                }
            }
            return 1;
        }
        //code here
    }
    return 1;
}
but the textdraw only appears when I enter the second CP and also the third map ICON does not appear aswell... so when I enter CP 2 the map icon stays at CP 2
...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)