PDA

View Full Version : Bus job


swell
18/09/2012, 03:29 PM
Hey everybody,

I want to make a bus job, but i don't know how. I can't find a good tutorial without a command.
I think it's not very difficult so i ask it here, than i know it for the rest of my life :)
so:

I have 6 buses:

AddStaticVehicleEx(431,848.90002441,-1196.19995117,17.20000076,178.00000000,-1,-1,15); //Bus 1
AddStaticVehicleEx(431,883.90002441,-1196.00000000,17.20000076,177.99499512,101,1,15); //Bus 2
AddStaticVehicleEx(431,917.90002441,-1196.30004883,17.20000076,177.99499512,101,1,15); //Bus 3
AddStaticVehicleEx(431,868.40002441,-1237.09997559,15.30000019,357.99487305,101,1,15); //Bus 4
AddStaticVehicleEx(431,914.59997559,-1230.09997559,17.20000076,267.98950195,101,1,15); //Bus 5


Those buses have to deliver people by diffrent bus stops in San Andreas.
This are the checkpoint cordinates:

372.0157,-2036.1799,7.3854 //firts stop
-1564.2279,-2743.7307,48.2481 // second stop
-2193.3167,-2266.2122,30.3334 // thirt stop
-2764.8013,-299.5383,6.7511 // stop 4
-1347.2574,-232.9522,13.8553 // stop 5
-1519.2874,921.4100,6.9004 // stop 6
-2261.8918,2300.1143,4.5637 //stop 7
-380.2293,2223.3311,41.8008 //stop 8
135.1081,1955.9368,19.1509 // stop 9
1504.4318,2240.3994,10.5300 // stop 10
1728.3821,1530.2593,10.3757 // stop 11
2040.0952,1342.0010,10.3888 // stop 12
1589.0879,-1293.7585,17.1447 // stop 13
894.2917,-1220.0970,16.6808 // end, back by base.


in every checkpoint they get 250 dollar.
Or at the end 3000 dollar.

I know it's something with:
- OnePlayerEnterVehicle
- SetplayerraceCheckpoint
- DisablePlayerRaceCheckpoint
- OnePlayerEnterRaceCheckpoint

But i don't know how i can make it.

can someone help me?

Kiba02
07/08/2019, 09:36 PM
i got problem with busses, i got about 5 or 7 busses and only 1 works.

example: player gets in 1 of 7 busses, now he want to start job. types /driver and it says: you're not
in the bus.`(error message)
player tries 6 busses, doesnt work.. (same error)
now he gets in the bus 7 and its working, and only that one is working very well.
rest of them are trash!

if you need a whole script, answer me. anyone has a solution, please?

also i got latest streamer and in server cfg puted: streamer.so and
error is about parameters, like except 11 but found 14.

thats 2 errors. please someone help???

Flamehaze7
08/08/2019, 02:06 AM
Hey everybody,

I want to make a bus job, but i don't know how. I can't find a good tutorial without a command.
I think it's not very difficult so i ask it here, than i know it for the rest of my life :)
so:

I have 6 buses:

AddStaticVehicleEx(431,848.90002441,-1196.19995117,17.20000076,178.00000000,-1,-1,15); //Bus 1
AddStaticVehicleEx(431,883.90002441,-1196.00000000,17.20000076,177.99499512,101,1,15); //Bus 2
AddStaticVehicleEx(431,917.90002441,-1196.30004883,17.20000076,177.99499512,101,1,15); //Bus 3
AddStaticVehicleEx(431,868.40002441,-1237.09997559,15.30000019,357.99487305,101,1,15); //Bus 4
AddStaticVehicleEx(431,914.59997559,-1230.09997559,17.20000076,267.98950195,101,1,15); //Bus 5


Those buses have to deliver people by diffrent bus stops in San Andreas.
This are the checkpoint cordinates:

372.0157,-2036.1799,7.3854 //firts stop
-1564.2279,-2743.7307,48.2481 // second stop
-2193.3167,-2266.2122,30.3334 // thirt stop
-2764.8013,-299.5383,6.7511 // stop 4
-1347.2574,-232.9522,13.8553 // stop 5
-1519.2874,921.4100,6.9004 // stop 6
-2261.8918,2300.1143,4.5637 //stop 7
-380.2293,2223.3311,41.8008 //stop 8
135.1081,1955.9368,19.1509 // stop 9
1504.4318,2240.3994,10.5300 // stop 10
1728.3821,1530.2593,10.3757 // stop 11
2040.0952,1342.0010,10.3888 // stop 12
1589.0879,-1293.7585,17.1447 // stop 13
894.2917,-1220.0970,16.6808 // end, back by base.


in every checkpoint they get 250 dollar.
Or at the end 3000 dollar.

I know it's something with:
- OnePlayerEnterVehicle
- SetplayerraceCheckpoint
- DisablePlayerRaceCheckpoint
- OnePlayerEnterRaceCheckpoint

But i don't know how i can make it.

can someone help me?

You have to define a vehicle id to be the "Job Bus" like:

new Bus = CreateVehicle(blablabla....)

Or you can simply take the bus ID from the wiki and inside OnPlayerEnterVehicle check whenever a player enters the numeric bus ID

define a variable that takes the playerid for the job on top of the script:

new BusJobActive[MAX_PLAYERS]

Create an array with the coordinates of your Bus checkpoints and repeat {Xcoord, Ycoord, Zcoord} with how many coordinates you'd like to do

new Float: RandomBusCheckpoints[][] = {
{Xcoord, Ycoord, Zcoord},
{Xcoord, Ycoord, Zcoord},
{Xcoord, Ycoord, Zcoord}
};

(You can name it however you want)

Now let's become a Bus Driver for example:

Let's make a simple command like /busdriver inside OnPlayerCommandText and let's become a Bus Driver

inside the command put the variable we created before:

BusJobActive[playerid] = 1;

Now all we have to do is check the vehicle the player is entering, if the vehicle ID is the same as our 'Bus' variable and the player has BusJobActive[playerid] as 1 then let's do something

if(vehicleid == Bus && BusJobActive[playerid] == 1)
{
new rand = random(sizeof(RandomBusCheckpoints));
SetPlayerCheckpoint(playerid, RandomBusCheckpoints[rand][0], RandomBusCheckpoints[rand][1], RandomBusCheckpoints[rand][2], 10.0);
}

You can customize it however you want

OnPlayerEnterCheckpoint

Now all we have to do is check the player whenever enters a checkpoint

inside OnPlayerEnterCheckpoint

if(BusJobActive[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
SetPlayerMoney(playerid, 250);
BusJobActive[playerid] == 0;
}

This should provide you everything to build your own Bus Job, i didn't make the full script, just gave you some parts to help you build it, obviously you have to customize it however you want and add the missing things that you need to make your own "bus job".

If you wish to make something like "10 random checkpoints and then get the random reward" you can use another variable that keeps track of the 'bus stops' and increments everytime you enter a checkpoint.

Flamehaze7
08/08/2019, 02:11 AM
i got problem with busses, i got about 5 or 7 busses and only 1 works.

example: player gets in 1 of 7 busses, now he want to start job. types /driver and it says: you're not
in the bus.`(error message)
player tries 6 busses, doesnt work.. (same error)
now he gets in the bus 7 and its working, and only that one is working very well.
rest of them are trash!

if you need a whole script, answer me. anyone has a solution, please?

also i got latest streamer and in server cfg puted: streamer.so and
error is about parameters, like except 11 but found 14.

thats 2 errors. please someone help???

This might be a problem with Bus id, it depends how you defined it, you can do it for every X bus or you can do for every bus in the game, just check your code.