Jump to content

Mechanic job debug error


Recommended Posts

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...