SA-MP Forums Archive
Uhm checkpoints? [+rep] - 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: Uhm checkpoints? [+rep] (/showthread.php?tid=310542)



Uhm checkpoints? [+rep] - Twinki1993 - 12.01.2012

Well I am trying to make a simple mission, it's going well but I have a problem now.. I want to make that when player comes to the vehicle that it's shown as checkpoint he will loose the 1st checkpoint (working) but, the thing is that after it he will get 2nd checkpoint which is not working...

So what is really happening is that he gets into the 1st checkpoint he gets awarded... But what it needs to happend is that when he reached 1st checkpoint there should be 2nd checkpoint added. So ...

-Player reached 1st checkpoint gets message and new chechpoint
-Player reaches second checkpoint get's rewarded.

What happends now?
He reaches the 1st checkpoint and he doesnt get the 2nd one...

Код HTML:
if (strcmp("/startmission", cmdtext, true) == 0)
    {
        if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid, COLOR_RED, "<!>You are not an admin!");
            return 1;
        }
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(GetPlayerTeam(i) == 1)
                {
                    SendClientMessage(i, COLOR_LIGHTBLUE, "<!>Mission: Defend the boat!");
                    SendClientMessage(i, COLOR_LIGHTBLUE, "<!>Mission: Boat is located next to the base in the big hangar!");
                    return 1;
                }
                if(GetPlayerTeam(i) == 2)
                {
                    SetPlayerCheckpoint(i,-1426.2220,425.9849,-0.1836,5); //FIRST CHECKPOINT
                    SendClientMessage(i, COLOR_LIGHTBLUE, "<!>Mission: Get the truck and deliver it at the base!");
                    return 1;
                }
                AddStaticVehicle(Missioncar, -1426.2220,425.9849,-0.1836,268.6744,46,26);
                return 1;
            }
        }
    }
	return 0;
}
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(vehicleid == Missioncar)
 	{
  		if(GetPlayerTeam(playerid) == 2)
    	{
			SendClientMessage(playerid, COLOR_WHITE, "<!>Head to the marker which is added to your minimap!");
			SendClientMessage(playerid, COLOR_WHITE, "<!>If you succed in the mission you will be awarded!");
			SetPlayerCheckpoint(playerid, -1569.1794,1264.1982,0.4914,5); //SECOND checkpoint
			return 1;
		}
		if(GetPlayerTeam(playerid) == 1)
		{
		    SendClientMessage(playerid, COLOR_WHITE, "<!>You must be USA team to drive this vehicle!");
		    RemovePlayerFromVehicle(playerid);
		    return 1;
		}
	}
	return 1;
}
Код HTML:
public OnPlayerEnterCheckpoint(playerid)
{
    if (IsPlayerInCheckpoint(playerid))
    {
		SendClientMessage(playerid, COLOR_WHITE, "<!>Congradulations! You have succeded! You have been awarded with 500$, 100HP and 250armour!");
	}
    if (IsPlayerInCheckpoint(playerid))
	{
  		SendClientMessage(playerid, COLOR_RED, "Get into the boat and follow the instructions!");
  		DisablePlayerCheckpoint(playerid);
	}
	return 1;
}