Estevam2d Posted February 2, 2015 Share Posted February 2, 2015 I am creating the taxi driver working , I get money but not remove the passenger someone help me ? side-server function test(client) local vehicle = getPedOccupiedVehicle( client ) local driver = getVehicleController( vehicle ) timer = setTimer(function() givePlayerMoney( driver, 1) takePlayerMoney ( vehicle, 1 ) -- not cut passenger money end,2000,0) end addEventHandler("onVehicleStartEnter",getRootElement(),test) Link to comment
Dealman Posted February 2, 2015 Share Posted February 2, 2015 Well obviously it won't, you're trying to take money away from the vehicle element. You need to specify the player element. You can use getVehicleOccupant or getVehicleOccupants to find what other players are in the vehicle. Seat ID 0 should be the driver, go from there. Link to comment
Estevam2d Posted February 2, 2015 Author Share Posted February 2, 2015 was, it is true, thank you function test(player) if isPedInVehicle( player ) then if getElementType ( player ) == "player" then local vehicle = getPedOccupiedVehicle ( player ) teste = getVehicleController ( source ) if vehicle then Controller = setTimer(takePlayerMoney, 2000, 0, player, 1) Passageiro = setTimer(givePlayerMoney, 2000, 0, teste, 1) end end end end addEventHandler("onVehicleStartEnter",getRootElement(),test) Link to comment
Jaysds1 Posted February 2, 2015 Share Posted February 2, 2015 Fixed it up for you: function cabi(player) if isPedInVehicle( player ) then if getElementType ( player ) == "player" then local vehicle = getPedOccupiedVehicle ( player ) if vehicle then local driver = getVehicleController ( vehicle ) Controller = setTimer(takePlayerMoney, 2000, 0, player, 1) Passageiro = setTimer(givePlayerMoney, 2000, 0, driver, 1) end end end end addEventHandler("onVehicleStartEnter",getRootElement(),cabi) Link to comment
Estevam2d Posted February 2, 2015 Author Share Posted February 2, 2015 Thanks again, ta very best this script, thank it. I'm glad you guys help me. 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