WeeD1 Posted January 26, 2019 Posted January 26, 2019 Estou com um problema em um mod de car-lock, já vi vários tópicos relacionados a esse mesmo mod, mas nenhum conseguiu me ajudar, ele acusa esses erros: WARNING: [Mod]-CarLock\server.lua:78: Bad argument @ 'getElementData' [Expected element at argument 1] WARNING: [Mod]-CarLock\server.lua:98: Bad argument @ 'getElementData' [Expected element at argument 1] WARNING: [Mod]-CarLock\server.lua:102: Bad argument @ 'setElementData' [Expected element at argument 1] WARNING: [Mod]-CarLock\server.lua:103: Bad argument @ 'setVehicleLocked' [Expected element at argument 1] WARNING: [Mod]-CarLock\server.lua:105: Bad argument @ 'getVehicleController' [Expected vehicle at argument 1] Alguém que possa me ajudar a resolver isso? Se for preciso estou disposto a pagar. function initCarLocks () local players = getElementsByType ( "player" ) for k,p in ipairs(players) do removeElementData ( p, "cl_ownedvehicle" ) bindKey ( p, "l", "down", doToggleLocked ) end local vehicles = getElementsByType ( "vehicle" ) for k,v in ipairs(vehicles) do removeElementData ( v, "cl_vehicleowner" ) removeElementData ( v, "cl_vehiclelocked" ) setVehicleLocked ( v, false ) end end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), initCarLocks ) addEventHandler ( "onResourceStop", getResourceRootElement ( getThisResource () ), initCarLocks ) function cl_PlayerJoin ( ) bindKey ( source, "l", "down", doToggleLocked ) end addEventHandler ( "onPlayerJoin", getRootElement(), cl_PlayerJoin ) function cl_VehicleStartEnter ( enteringPlayer, seat, jacked ) local theVehicle = source local theOwner if ( getElementData ( theVehicle, "cl_vehiclelocked" ) == true ) then theOwner = getElementData ( theVehicle, "cl_vehicleowner" ) if theOwner ~= false and theOwner ~= enteringPlayer then end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), cl_VehicleStartEnter ) function cl_PlayerDriveVehicle ( player, seat, jacked ) if ( seat == 0 ) then oldVehicle = getElementData ( player, "cl_ownedvehicle" ) if ( (cl_VehicleLocked(source) == true) and (cl_VehicleOwner(source) ~= player) ) then removePedFromVehicle( player ) outputChatBox ("#ff0000Veículo Trancado.", source, 255, 255, 255, true) return false end cl_SetVehicleOwner ( source, player ) end return true end addEventHandler ( "onVehicleEnter", getRootElement(), cl_PlayerDriveVehicle ) function cl_SetVehicleOwner ( theVehicle, thePlayer ) local oldVehicle = getElementData ( thePlayer, "cl_ownedvehicle" ) if ( oldVehicle ~= false ) then end setElementData ( theVehicle, "cl_vehicleowner", thePlayer ) setElementData ( theVehicle, "cl_vehiclelocked", false ) setElementData ( thePlayer, "cl_ownedvehicle", theVehicle ) end function cl_VehicleOwner ( theVehicle ) return getElementData( theVehicle, "cl_vehicleowner" ) end function cl_VehicleLocked ( theVehicle ) return getElementData( theVehicle, "cl_vehiclelocked" ) end function doToggleLocked ( source ) local theVehicle , strout if ( getElementType(source) == "vehicle" ) then theVehicle = source end if ( getElementType(source) == "player" ) then theVehicle = getElementData ( source, "cl_ownedvehicle" ) end if ( theVehicle ) then if ( getElementData ( theVehicle, "cl_vehiclelocked") == true ) then doUnlockVehicle ( source ) else doLockVehicle ( source ) end else end end function doLockVehicle ( source ) local theVehicle , strout if ( getElementType(source) == "vehicle" ) then theVehicle = source end if ( getElementType(source) == "player" ) then theVehicle = getElementData ( source, "cl_ownedvehicle" ) end if ( theVehicle ) then if ( getElementData ( theVehicle, "cl_vehiclelocked") == true ) then strout = "*Seu Veiculo ja esta Trancado." Err_Msg(strout, source) else setElementData ( theVehicle, "cl_vehiclelocked", true) setVehicleLocked ( theVehicle, true ) outputChatBox ("#ff0000Seu Veículo foi Trancado.", source, 255, 255, 255, true) if ( getVehicleController ( theVehicle ) == false ) then end end end end function doUnlockVehicle ( source ) local theVehicle, strout if ( getElementType(source) == "vehicle" ) then theVehicle = source end if ( getElementType(source) == "player" ) then theVehicle = getElementData ( source, "cl_ownedvehicle" ) end if ( theVehicle ) then if ( getElementData ( theVehicle, "cl_vehiclelocked") == false ) then else setElementData ( theVehicle, "cl_vehiclelocked", false) setVehicleLocked ( theVehicle, false ) outputChatBox ("#ff0000Seu Veículo foi Destrancado.", source, 255, 255, 255, true) if ( getVehicleController ( theVehicle ) == false ) then end end end end
DNL291 Posted January 26, 2019 Posted January 26, 2019 Código tá tudo mal feito. Mas se for só aviso e não esteja impedindo o funcionamento, você pode corrigir adicionando isElement(theVehicle) nas linhas: 76, 96 e 119 Please do not PM me with scripting related question nor support, use the forums instead.
WeeD1 Posted January 26, 2019 Author Posted January 26, 2019 38 minutes ago, DNL291 said: Código tá tudo mal feito. Mas se for só aviso e não esteja impedindo o funcionamento, você pode corrigir adicionando isElement(theVehicle) nas linhas: 76, 96 e 119 Ok, valeu pela ajuda!
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