ODutii Posted October 28, 2019 Share Posted October 28, 2019 Gente como faço para cancelar um trigger client? Esse script vai fazer com que quando o jogador entre no veículo apareça a mensagem que eu fiz no client, QUAL o script para quando ele sair do veículo eu cancelo esse trigger? function entrouv (thePlayer, seat, jacked) triggerClientEvent(thePlayer, "PCinto", thePlayer) end addEventHandler ( "onVehicleEnter", getRootElement(), entrouv ) (QUERO O SCRIPT PARA CANCELAR ESSE TRIGGER OU ME ENCINAREM, por favor. Link to comment
DNL291 Posted October 28, 2019 Share Posted October 28, 2019 onVehicleExit Faz o trigger nesse evento e para 'remover o dx' use removeEventHandler "onClientRender" Esse código também poderia ser feito clientside com onClientVehicleEnter e onClientVehicleExit. Link to comment
ODutii Posted October 28, 2019 Author Share Posted October 28, 2019 Client-Side: function Dxcinto() dxDrawText("Oi", screenW * 0.3873, screenH * 0.8060, screenW * 0.6186, screenH * 0.8503, tocolor(254, 209, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) end function Pcinto () if getElementData(client, "Cinto") == false then addEventHandler("onClientRender", root, Dxcinto) elseif getElementData(client,"Cinto") == true then removeEventHandler("onClientRender", root, Dxcinto) end end addEvent("PCinto", true) addEventHandler("PCinto", root, Pcinto) Fiz assim e não funcionou, oq falta?+ Link to comment
DNL291 Posted October 28, 2019 Share Posted October 28, 2019 client é uma variável predefinida que só é usada no lado server. Tente isto: function Dxcinto() dxDrawText("Oi", screenW * 0.3873, screenH * 0.8060, screenW * 0.6186, screenH * 0.8503, tocolor(254, 209, 0, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) end function Pcinto (bool) if bool and getElementData(source, "Cinto") == false then if dxVisivle ~= true then addEventHandler("onClientRender", root, Dxcinto) dxVisivle = true end elseif bool ~= true and getElementData(source,"Cinto") then if dxVisivle then removeEventHandler("onClientRender", root, Dxcinto) dxVisivle = false end end end addEvent("PCinto", true) addEventHandler("PCinto", root, Pcinto) Server: function entrouv (thePlayer, seat, jacked) triggerClientEvent(thePlayer, "PCinto", thePlayer, eventName == "onVehicleEnter") end addEventHandler ( "onVehicleEnter", getRootElement(), entrouv ) addEventHandler ( "onVehicleExit", getRootElement(), entrouv ) 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