Snow-Man Posted December 9, 2013 Share Posted December 9, 2013 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
TrapLord Studios™ Posted December 9, 2013 Share Posted December 9, 2013 Make teams using tables for the jobs aswell, you have to create Markers and add onMarkerHit - if ( trucker ) and ( trucker ~= source ) then givePlayerMoney ( trucker, 1000 ) end Link to comment
Dealman Posted December 9, 2013 Share Posted December 9, 2013 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
Snow-Man Posted December 9, 2013 Author Share Posted December 9, 2013 i used onVehicleEnter before but i asking Function Name to Cancel enter Other vehicle Team not to remove Ped from vehicle Link to comment
Dealman Posted December 9, 2013 Share Posted December 9, 2013 cancelEvent will cancel that event. It will not let the player enter the vehicle and then kick him out. Link to comment
Snow-Man Posted December 9, 2013 Author Share Posted December 9, 2013 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
Snow-Man Posted December 10, 2013 Author Share Posted December 10, 2013 Warning : Trucker/server.lua:118: bad argument @ ' createBlipAttachedTo ' i using correct Function createBlipAttachedTo( Marker, 51) Warning : Trucker/ server.lua:129: Bad argument @ ' addEventHandler ' [Expected element at argument 2 , got table ] Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now