Jump to content

[Help] Trucker Job


Snow-Man

Recommended Posts

i making Trucker Job but i need some help with :

1) how can i make when player enter Markers with truck and Trailer Will get money

2) how can i make only Trucker allowed to Enter Vehicle

please give me a full Example about that

i used This Table Markers

deliveries = { 
{ 2178.0307617188, -2302.7624511719, 12.546875}, 
{2102.935546875, -2062.6228027344, 12.554370880127}, 
{1792.5656738281, -2639.1782226563, 12.546875}, 
{ 2078.041015625, -2388.8349609375, 12.546875}, 
{370.93551635742, 2039.3133544922, 6.671875}, 
{-55.150390625, -1568.4388427734, 1.6171875}, 
{-1548.6502685547, 135.21551513672, 2.5546875}, 
} 
  

Link to comment

Question 1;

There are various ways you could do this. However, I would make use of those functions;

onMarkerHit 
getElementType 
getVehicleTowedByVehicle 

Check if the element that hit the marker was a vehicle. Then check if that vehicle is a truck. Then you can use getVehicleTowedByVehicle to check if and what it is towing. If it is towing something, you can make sure it's towing the appropriate trailer as well.

Question 2;

To check if the player is a Trucker, you can make use of Account Data which is saved even if the player disconnects from the server.

setAccountData 
getAccountData 

Simply make a check for the returned value. If it's the right one, go ahead and give them the money. If not, don't give them money.

And then to make it so only Truckers can enter vehicles, you can use the above functions together with those;

onVehicleEnter 
cancelEvent 

When a player tries to enter a vehicle, onVehicleEnter is triggered and returns the player element. Use this player element to get their account, check their account data to see if that player is a Trucker. If true, then do nothing - allow them to enter.

If false, cancel the event using cancelEvent. This will prevent them from entering.

Link to comment
Question 1;

There are various ways you could do this. However, I would make use of those functions;

onMarkerHit 
getElementType 
getVehicleTowedByVehicle 

Check if the element that hit the marker was a vehicle. Then check if that vehicle is a truck. Then you can use getVehicleTowedByVehicle to check if and what it is towing. If it is towing something, you can make sure it's towing the appropriate trailer as well.

Question 2;

To check if the player is a Trucker, you can make use of Account Data which is saved even if the player disconnects from the server.

setAccountData 
getAccountData 

Simply make a check for the returned value. If it's the right one, go ahead and give them the money. If not, don't give them money.

And then to make it so only Truckers can enter vehicles, you can use the above functions together with those;

onVehicleEnter 
cancelEvent 

When a player tries to enter a vehicle, onVehicleEnter is triggered and returns the player element. Use this player element to get their account, check their account data to see if that player is a Trucker. If true, then do nothing - allow them to enter.

If false, cancel the event using cancelEvent. This will prevent them from entering.

how can i use getElementType in Script ?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...