Miika Posted March 15, 2015 Share Posted March 15, 2015 Small error that need's a fix. 5: Bad Argument @'getPedOccupiedVehicle [expected ped at argument, got vehicle]' [server] allowLeaveVehicle = true col = createColSphere(-1904.5953369141, 275.81134033203, 41.046875, 1.5 ) function openDoor(thePlayer) local veh = getPedOccupiedVehicle(thePlayer) if not ( source ~= vehicle ) then setGarageOpen(18, true) allowLeaveVehicle = true else return end end addEventHandler("onColShapeHit", col, openDoor) Link to comment
Castillo Posted March 15, 2015 Share Posted March 15, 2015 You need to check if the element that hit the colshape is a player using getElementType. Link to comment
Miika Posted March 15, 2015 Author Share Posted March 15, 2015 You need to check if the element that hit the colshape is a player using getElementType. allowLeaveVehicle = true col = createColSphere(-1904.5953369141, 275.81134033203, 41.046875, 1.5 ) function openDoor(thePlayer) if getElementModel ( thePlayer ) == Player then local veh = getPedOccupiedVehicle(thePlayer) if not ( source ~= vehicle ) then setGarageOpen(18, true) allowLeaveVehicle = true else return end end end addEventHandler("onColShapeHit", col, openDoor) Doesn't work Link to comment
xeon17 Posted March 15, 2015 Share Posted March 15, 2015 allowLeaveVehicle = true col = createColSphere(-1904.5953369141, 275.81134033203, 41.046875, 1.5 ) function openDoor(thePlayer) if getElementType ( thePlayer ) == "player" then local veh = getPedOccupiedVehicle(thePlayer) if not ( source ~= vehicle ) then setGarageOpen(18, true) allowLeaveVehicle = true else return end end end addEventHandler("onColShapeHit", col, openDoor) Link to comment
Miika Posted March 15, 2015 Author Share Posted March 15, 2015 Same problem. 6: Bad Argument @'getPedOccupiedVehicle' [expected ped at argument, got vehicle' allowLeaveVehicle = true col = createColSphere(-1904.5953369141, 275.81134033203, 41.046875, 1.5 ) function openDoor(thePlayer) if getElementType ( thePlayer ) == "player" or getElementType ( thePlayer ) == "vehicle" then local vehicle = getPedOccupiedVehicle(thePlayer) if not ( source ~= vehicle ) then setGarageOpen(18, true) allowLeaveVehicle = true else return end else outputChatBox("Output if doesn't work") return end end addEventHandler("onColShapeHit", col, openDoor) Link to comment
Castillo Posted March 15, 2015 Share Posted March 15, 2015 Of course you'll have the same problem, you edited the code Xeon gave you. if getElementType ( thePlayer ) == "player" or getElementType ( thePlayer ) == "vehicle" then It has to be: if getElementType ( thePlayer ) == "player" then Link to comment
Miika Posted March 15, 2015 Author Share Posted March 15, 2015 Of course you'll have the same problem, you edited the code Xeon gave you.if getElementType ( thePlayer ) == "player" or getElementType ( thePlayer ) == "vehicle" then It has to be: if getElementType ( thePlayer ) == "player" then I tested it, but it output's else message: "Output if doesn't work" Link to comment
TAPL Posted March 16, 2015 Share Posted March 16, 2015 allowLeaveVehicle = true col = createColSphere(-1904.5953369141, 275.81134033203, 41.046875, 1.5) function openDoor(player) if getElementType(player) == "player" then local veh = getPedOccupiedVehicle(player) if veh then setGarageOpen(18, true) allowLeaveVehicle = true end end end addEventHandler("onColShapeHit", col, openDoor) Link to comment
Miika Posted March 16, 2015 Author Share Posted March 16, 2015 allowLeaveVehicle = true col = createColSphere(-1904.5953369141, 275.81134033203, 41.046875, 1.5) function openDoor(player) if getElementType(player) == "player" then local veh = getPedOccupiedVehicle(player) if veh then setGarageOpen(18, true) allowLeaveVehicle = true end end end addEventHandler("onColShapeHit", col, openDoor) Oh! I found the problem. Wrong garage id 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