Trucking mission help
#1

Hello, I am trying to make a mission system where you drive from a random location to another, I already made some locations to drive to but I don't know how to make it completly random :P Thanks!

BTW here is the coords:

Код:
new Float: random_destinations[][3] =
{
    771.1042,-1357.3729,13.5323,
    557.8225,-1265.6511,17.2422,
    1224.9829,-1829.7542,13.4032,
    1882.5809,-2281.4395,13.5469,
    1937.4445,-1776.8722,13.3828,
    2296.4216,-15.1040,26.3285,
    1364.9675,467.9350,20.1037,
    1345.6343,280.0660,19.5615,
    77.5986,1213.2402,18.8355,
    -293.9685,1052.0466,19.5886,
    -83.9216,1359.8287,10.3647,
    135.5094,1964.2729,19.4917,
    -302.6055,1523.6019,75.3594
}
Reply
#2

i am using something like this


pawn Код:
new Float: random_destinations[][] =
{
   {771.1042,-1357.3729,13.5323},
    {557.8225,-1265.6511,17.2422},
    {1224.9829,-1829.7542,13.4032},
    {1882.5809,-2281.4395,13.5469},
    {1937.4445,-1776.8722,13.3828},
    {2296.4216,-15.1040,26.3285},
    {1364.9675,467.9350,20.1037},
    {1345.6343,280.0660,19.5615},
    {77.5986,1213.2402,18.8355},
    {-293.9685,1052.0466,19.5886},
    {-83.9216,1359.8287,10.3647},
    {135.5094,1964.2729,19.4917},
    {-302.6055,1523.6019,75.3594}

};
Reply
#3

pawn Код:
new Float: random_destinations[][3] =
{
   {771.1042,-1357.3729,13.5323},
    {557.8225,-1265.6511,17.2422},
    {1224.9829,-1829.7542,13.4032},
    {1882.5809,-2281.4395,13.5469},
    {1937.4445,-1776.8722,13.3828},
    {2296.4216,-15.1040,26.3285},
    {1364.9675,467.9350,20.1037},
    {1345.6343,280.0660,19.5615},
    {77.5986,1213.2402,18.8355},
    {-293.9685,1052.0466,19.5886},
    {-83.9216,1359.8287,10.3647},
    {135.5094,1964.2729,19.4917},
    {-302.6055,1523.6019,75.3594}

};
pawn Код:
//put these lines under ur mission CMD
new Random=random(sizeof(random_destinations));

SetPlayerCheckPoint(playerid,random_destinations[Random][0],random_destinations[Random][1],random_destinations[Random][2]);
Reply
#4

For some reason it doesn't get the coordinates from the random_destinations :P
Reply
#5

Can you show what you have on the mission command? I could maybe have a look and help you out.
Reply
#6

Sorry for the l8 reply, been busy :P, here you go:

[CODE]COMMAND:work(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
else
{
new Random=random(sizeof(random_destinations));
SendClientMessage(playerid, COLOR_BLUE, "You are now working, head to the RED checkpoint for payment!");
SetPlayerRaceCheckpoint(playerid,random_destinatio ns[Random][0],random_destinations[Random][1],random_destinations[Random][2]);
return 1;
}
return 0;
}[CODE/]
Reply
#7

sorry for changing colors
pawn Код:
COMMAND:work(playerid, params[])

{
if(!IsPlayerInAnyVehicle(playerid))
{
 return SendClientMessage(playerid, -1, "You are not in a vehicle!");
}
else
{
new Random=random(sizeof(random_destinations));
SendClientMessage(playerid, -1, "You are now working, head to the RED checkpoint for payment!");
SetPlayerRaceCheckpoint(playerid,1,random_destinations[Random][0],random_destinations[Random][1],random_destinations[Random][2],random_destinations[Random][0],random_destinations[Random][1],random_destinations[Random][2],4);
return 1;
}
 }
Reply
#8

How could I make it go from on coord to another? :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)