xXMADEXx Posted February 19, 2013 Share 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) Link to comment
Castillo Posted February 19, 2013 Share Posted February 19, 2013 You are trying to get the occupant of a player, not from a vehicle. Link to comment
tosfera Posted February 19, 2013 Share Posted February 19, 2013 Just what Solid said: change local driver = getVehicleOccupant (player) to local driver = getVehicleOccupant(car) 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