[SOLVED] Pick A Random Checkpoint For Mission?
#1

What will I have to add to this script in order for it to choose a random checkpoint for the mission. Do I need an array of all the co-ordinates or something?

Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
	new JOBpName[MAX_PLAYER_NAME];
  new JOBCOMPLstring[100];
  GetPlayerName(playerid, JOBpName, sizeof(JOBpName));
  format(JOBCOMPLstring, sizeof(JOBCOMPLstring), "%s Has Successfully Completed A Delivery Mission! + $10000", JOBpName);
  SendClientMessageToAll(COLOUR_YELLOW, JOBCOMPLstring);
  GivePlayerMoney(playerid, 10000);
 	GameTextForPlayer(playerid, "~y~Mission Complete~n~~w~$10000",2000,1);
	DisablePlayerRaceCheckpoint(playerid);
  return 1;
}
//-----------------------------------------------------------------------------------
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if (pickupid == StartDeliveryJobPickup)
  {
    new JOBstrtpName[MAX_PLAYER_NAME];
	  new jobstrtstring[100];
	  GetPlayerName(playerid, JOBstrtpName, sizeof(JOBstrtpName));
	  format(jobstrtstring, sizeof(jobstrtstring), "%s Has Started A Delivery Mission!", JOBstrtpName);
    SendClientMessageToAll(COLOUR_YELLOW, jobstrtstring);
    SendClientMessage(playerid,COLOUR_YELLOW, "Deliver The Package To The Red Marker. Type /endmission To Exit.");
		SetPlayerRaceCheckpoint(playerid,2,-565.2077,-1055.7922,23.8036,0,0,0,5.0);
  }
}
The coordinates I would like to be available are
Код:
-379.9200,2223.7539,42.0938
-901.1568,1998.0510,60.9141 
1713.6024,1605.5175,10.0156 
2597.7217,2269.4827,10.8133 
-523.5439,2590.9675,53.4141 
-1485.0864,2539.3105,55.8359 
-2260.9390,2314.3367,4.8125 
-2619.0334,1398.3802,7.1016
Reply
#2

pawn Код:
new Float: checkpoints[][3] =
{
  { 379.9200,2223.7539,42.0938},
  { 901.1568,1998.0510,60.9141 },
  { 1713.6024,1605.5175,10.0156 },
  { 2597.7217,2269.4827,10.8133 },
  { 523.5439,2590.9675,53.4141 },
  { 1485.0864,2539.3105,55.8359 },
  { 2260.9390,2314.3367,4.8125 },
  { 2619.0334,1398.3802,7.1016 }
};

new rand = random(sizeof(checkpoints));
SetPlayerRaceCheckpoint(playerid,2,checkpoints[rand][0],checkpoints[rand][1],checkpoints[rand][2],0,0,0,5.0);
something like that should work
Reply
#3

THANKS! It worked fine
Reply
#4

when i try using this it seams to crash pawno
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)