jkub Posted May 9, 2009 Share Posted May 9, 2009 Hy again:) I don't really have enough ways to make money on my server and I was thinking about doing a small taxi script for players to get money by simply haveing a driver picking up people and driving them places. Ive gave this a try and Does not really seem to be affective... any thoughts? rootElement = getRootElement() function enterTaxi ( enteredPlayer ) -------------------------------------------------------------------------------- local veh = getPlayerOccupiedVehicle ( enteredPlayer ) local vehID = getVehicleID ( veh ) local vehName = getVehicleName ( veh ) ---- local taxiDriver = getVehicleController ( veh ) local passenger1 = getVehicleOccupant ( veh, 2 )--Back Seat left side local playerSeat = getPlayerOccupiedVehicleSeat ( enteredPlayer ) ---- local passenger1Wallet = getPlayerMoney ( passenger1 ) ---- if vehID == 420 then --If the vehicle is a taxi if playerSeat == 0 then --If the player entered the driver seat setElementData ( enteredPlayer, "taxiDriver", veh ) setElementData ( veh, "workingTaxi", enteredPlayer ) outputChatBox ( "TEST You are in the driver seat TEST", enteredPlayer ) elseif playerSeat == 2 then --If the player is in seat 2 setElementData ( enteredPlayer, "taxiPassenger", veh ) outputChatBox ( "TEST You are in the passenger seat TEST", enteredPlayer ) chargeFare ( passenger1, taxiDriver ) end end end function chargeFare ( passenger1, taxiDriver ) if ( taxiDriver ) then --If there is a Driver charge = setTimer ( setPlayerMoney, 1000, 0, passenger1, passenger1Wallet - 1 ) --Charge the passenger payment = setTimer ( setPlayerMoney, 1000, 0, taxiDriver, getPlayerMoney ( taxiController ) + 1 ) --Pay the Taxi Driver else outputChatBox ( "TEST There seems to be no driver TEST", passenger1 ) end end function killPayments ( thePlayer ) local veh = getPlayerOccupiedVehicle ( thePlayer ) if getElementData ( veh, "workingTaxi", true ) then --If this vehicle was a working taxi killTimer ( charge ) killTimer ( payment ) removeElementData ( enteredPlayer, "taxiPassenger" ) end end addEventHandler ( "onVehicleEnter", rootElement, enterTaxi ) addEventHandler ( "onVehicleExit", rootElement, killPayments ) addEventHandler ( "onVehicleExplode", rootElement, killPayments ) I want the cash flow to start up when a passenger enters the correct seat and to stop when either the driver or passenger leaves the vehicle and when the vehicles is destroyed? Link to comment
Thehookerkiller01 Posted May 12, 2009 Share Posted May 12, 2009 Try to use OutputChatbox and see what's going wrong, or good. Also try /debugscript 3 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