stefutz101 Posted November 30, 2015 Share Posted November 30, 2015 Hi i have a problem with this script . if tostring(getElementData(thePlayer, "gang")) ~= tostring(polyAccRule) then local exportX = getElementData(source, "exportX") local exportY = getElementData(source, "exportY") local exportZ = getElementData(source, "exportZ") setTimer(function(thePlayer, theZone) warpOutIfStillIn(thePlayer, theZone) end, 2000, 1, thePlayer, source) if isPedInVehicle(thePlayer) then if getSimplestTaskOf(thePlayer) == "TASK_SIMPLE_CAR_DRIVE" then if getElementModel(getPedOccupiedVehicle(thePlayer)) == 487 or getElementModel(getPedOccupiedVehicle(thePlayer)) == 497 then local px, py, pz = getElementPosition(thePlayer) setElementPosition(getPedOccupiedVehicle(thePlayer), exportX, exportY, exportZ + 25) setElementVelocity(getPedOccupiedVehicle(thePlayer), 0, 0, 0) else setElementPosition(getPedOccupiedVehicle(thePlayer), exportX, exportY, exportZ) setElementVelocity(getPedOccupiedVehicle(thePlayer), 0, 0, 0) end else removePedFromVehicle(thePlayer) setElementPosition(thePlayer, exportX, exportY, exportZ) outputChatBox(getSimplestTaskOf(thePlayer), thePlayer, 255, 155, 0) end else setElementPosition(thePlayer, exportX, exportY, exportZ) end else outputChatBox("Welcome back at home!", thePlayer, 255, 155, 0, true) end This script should teleport players what aren't in clan x to enter in base , and allow only members of clan x to enter . But i have a warning "if isPedInVehicle(thePlayer) then" "Bad argument @ 'isPedInVehicle" [Expected ped at argument 1,got vehicle] Link to comment
LoveFist Posted November 30, 2015 Share Posted November 30, 2015 You got a vehicle element inside thePlayer variable. Show the part where thePlayer where defined. Note that vehicles also an elements and they also can trigger events like onMarkerHit, etc. So you probably need to check the type of the element (getElementType). Link to comment
stefutz101 Posted November 30, 2015 Author Share Posted November 30, 2015 function handlePoly(thePlayer) local currentPoly = getElementData(source, "accId") or false if currentPoly then local polyAccType = getElementData(source, "accType") local polyAccRule = getElementData(source, "accRule") <> end Link to comment
LoveFist Posted December 1, 2015 Share Posted December 1, 2015 Try to add an additional check at the beginning of the function function handlePoly(thePlayer) if(getElementType(thePlayer) ~= "player") then return end -- only players can pass this check local currentPoly = getElementData(source, "accId") or false if currentPoly then local polyAccType = getElementData(source, "accType") local polyAccRule = getElementData(source, "accRule") <> end 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