xXMADEXx Posted February 19, 2013 Posted February 19, 2013 Hey MTA community, i have made this mechanic script, but it keeps saying "This vehicle has no driver."... no idea why. function fix (player) local car = getPedOccupiedVehicle(player) local driver = getVehicleOccupant (player) local equation = 1500 - getElementHealth(car) if (getElementData(player,"Job")=="Mechanic") then if (getPedOccupiedVehicleSeat(player)==0) then outputChatBox("You cannot fix a vehicle, from the driver seat.",player,255,0,0) else if (driver) then if (getPlayerMoney(driver) > equation ) then takePlayerMoney(driver,equation) givePlayerMoney(player,equation) triggerClientEvent(driver,"message:addMessage",driver,"Mechanic: "..getPlayerName(player).." has fixed your vehicle for $"..equation.."!") triggerClientEvent(player,"message:addMessage",player,"Mechanic: You have fixed "..getPlayerName(driver).."'s vehicle for "..equation.."!") else outputChatBox("The driver dosn't have $"..equation.." to repair the vehicle!",player,255,0,0) outputChatBox("You don't have "..equation.." to repair this vehicle.",driver,255,0,0) end else outputChatBox("This vehicle has no driver.",player,255,0,0) end end end end addCommandHandler('fix',fix) The Ultimate Lua Tutorial! | MTA PHP SDK
Castillo Posted February 19, 2013 Posted February 19, 2013 You are trying to get the occupant of a player, not from a vehicle. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
tosfera Posted February 19, 2013 Posted February 19, 2013 Just what Solid said: change local driver = getVehicleOccupant (player) to local driver = getVehicleOccupant(car) If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
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