wesleywillems17 Posted May 21, 2016 Share Posted May 21, 2016 Hello, I have a mechanic job in my server but it gives me error's when i enter a random vehicle. even when i'm not in the mechanic team. How could i fix this? function fix () car = getPedOccupiedVehicle(source) if allowedTeams[getTeamName(getPlayerTeam(source))] and getElementHealth(car) < 999 then price = 1001 - getElementHealth(car) givePlayerMoney(source, price*2) fixVehicle(car) outputChatBox("You have repair Brooken Stuff of this car", source, 0, 255, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), fix) Debug: Warning: [gameplay]\(SARS)Mechanic\server.lua:54 Bad argument @ 'getTeamName' [Expected team at argument 1, got boolean] — Line preview: if allowedTeams[getTeamName(getPlayerTeam(source))] and getElementHealth(car) < 999 then (lijn 3 ligt gelijk aan lijn 54) Link to comment
Urban_West Posted May 21, 2016 Share Posted May 21, 2016 You should check so that the player is in a team at all or cancel the function. If he's not in a team then you can't get the name of that team at all. Link to comment
Saml1er Posted May 21, 2016 Share Posted May 21, 2016 Hello,I have a mechanic job in my server but it gives me error's when i enter a random vehicle. even when i'm not in the mechanic team. How could i fix this? function fix () car = getPedOccupiedVehicle(source) if allowedTeams[getTeamName(getPlayerTeam(source))] and getElementHealth(car) < 999 then price = 1001 - getElementHealth(car) givePlayerMoney(source, price*2) fixVehicle(car) outputChatBox("You have repair Brooken Stuff of this car", source, 0, 255, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), fix) Debug: Warning: [gameplay]\(SARS)Mechanic\server.lua:54 Bad argument @ 'getTeamName' [Expected team at argument 1, got boolean] — Line preview: if allowedTeams[getTeamName(getPlayerTeam(source))] and getElementHealth(car) < 999 then (lijn 3 ligt gelijk aan lijn 54) if getPlayerTeam ( source ) and allowedTeams[getTeamName(getPlayerTeam(source))] and getElementHealth(car) < 999 then 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