gghvcffcv Posted March 25, 2014 Share Posted March 25, 2014 I got an error with this, If mechanic is in Driver Seat he wins money and fix the car. only fix car and win money if he is in Passenger seat and there's another player in driver seat local allowedTeams = { ["Mechanics"] = true, ["Mechanic"] = true, ["Staff"] = true, ["Admins"] = true, } function fix () car = getPedOccupiedVehicle(source) if allowedTeams[getTeamName(getPlayerTeam(source))] and getElementHealth(car) < 999 then price = 1001 - getElementHealth(car) givePlayerMoney(source, price*20) fixVehicle(car) outputChatBox("You have fixed this car", source, 0, 255, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), fix) Link to comment
DNL291 Posted March 25, 2014 Share Posted March 25, 2014 Try this: local allowedTeams = { ["Mechanics"] = true, ["Mechanic"] = true, ["Staff"] = true, ["Admins"] = true, } function fix (theVehicle, seat, jacked) if seat ~= 0 then local driver = getVehicleController(theVehicle) if (getElementType(driver) == "player") then if allowedTeams[getTeamName(getPlayerTeam(source))] and getElementHealth(theVehicle) < 999 then local price = 1001 - getElementHealth(theVehicle) givePlayerMoney(source, price*20) fixVehicle(theVehicle) outputChatBox("You have fixed this car", source, 0, 255, 0) end end end end addEventHandler("onPlayerVehicleEnter", getRootElement(), fix) Link to comment
gghvcffcv Posted March 25, 2014 Author Share Posted March 25, 2014 Try this: local allowedTeams = { ["Mechanics"] = true, ["Mechanic"] = true, ["Staff"] = true, ["Admins"] = true, } function fix (theVehicle, seat, jacked) if seat ~= 0 then local driver = getVehicleController(theVehicle) if (getElementType(driver) == "player") then if allowedTeams[getTeamName(getPlayerTeam(source))] and getElementHealth(theVehicle) < 999 then local price = 1001 - getElementHealth(theVehicle) givePlayerMoney(source, price*20) Thanks you fixVehicle(theVehicle) outputChatBox("You have fixed this car", source, 0, 255, 0) end end end end addEventHandler("onPlayerVehicleEnter", getRootElement(), fix) 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