Adissonboy11 Posted April 30, 2015 Share Posted April 30, 2015 (edited) Eu preciso que quando ligar o Night, ou o Infrared, aparecer uma certa imagem na tela, só que... Ela aparece e some muito rápido, preciso que ela fique ate eu desativar o Night/Infrared novamente. function playerZoom (key,keyState) local screenW, screenH = guiGetScreenSize() if (key == "n") then if (getElementData(getLocalPlayer(),"Night Vision Goggles") > 0) then if nightvision then nightvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") else nightvision = true dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "IMAGE.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "nightvision") end end elseif (key == "i") then if (getElementData(getLocalPlayer(),"Infrared Goggles") > 0) then if infaredvision then infaredvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") else infaredvision = true dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "IMAGE.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "thermalvision") end end end end bindKey("n","down",playerZoom) bindKey("i","up",playerZoom) Edited April 30, 2015 by Guest Link to comment
[M]ister Posted April 30, 2015 Share Posted April 30, 2015 (edited) Tente: function playerZoom (key,keyState) screenW, screenH = guiGetScreenSize() if (key == "n") then if (getElementData(getLocalPlayer(),"Night Vision Goggles") > 0) then if nightvision then nightvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") removeEventHandler("onClientRender", root, image) else nightvision = true addEventHandler("onClientRender", root, image) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "nightvision") end end elseif (key == "i") then if (getElementData(getLocalPlayer(),"Infrared Goggles") > 0) then if infaredvision then infaredvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") removeEventHandler("onClientRender", root, image) else infaredvision = true addEventHandler("onClientRender", root, image) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "thermalvision") end end end end bindKey("n","down",playerZoom) bindKey("i","up",playerZoom) function image() dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "IMAGE.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end Edited April 30, 2015 by Guest Link to comment
n3wage Posted April 30, 2015 Share Posted April 30, 2015 (edited) Isso é porque as funções dx devem ficar em um evento render para serem mostradas constantemente, o codigo do malignos deve funcionar. Edited April 30, 2015 by Guest Link to comment
Adissonboy11 Posted April 30, 2015 Author Share Posted April 30, 2015 Tente: function playerZoom (key,keyState) local screenW, screenH = guiGetScreenSize() if (key == "n") then if (getElementData(getLocalPlayer(),"Night Vision Goggles") > 0) then if nightvision then nightvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") removeEventHandler("onClientRender", root, image) else nightvision = true addEventHandler("onClientRender", root, image) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "nightvision") end end elseif (key == "i") then if (getElementData(getLocalPlayer(),"Infrared Goggles") > 0) then if infaredvision then infaredvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") removeEventHandler("onClientRender", root, image) else infaredvision = true addEventHandler("onClientRender", root, image) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "thermalvision") end end end end bindKey("n","down",playerZoom) bindKey("i","up",playerZoom) function image() dxDrawImage(screenW * 0.0000, screenH * 0.0000, screenW * 1.0000, screenH * 1.0000, "IMAGE.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end Tentei, não aconteceu nada, ficou normal, não renderiza nenhuma imagem. Link to comment
[M]ister Posted April 30, 2015 Share Posted April 30, 2015 Copie o código novamente, é que as variáveis: screenW e screenH eram locais da função playerZoom, dai deu erro quando tentei chama-las em outra função. Link to comment
TioTiago Posted April 30, 2015 Share Posted April 30, 2015 (edited) function playerZoom (key,keyState) local screenW, screenH = guiGetScreenSize() if (key == "n") then if (getElementData(getLocalPlayer(),"Night Vision Goggles") > 0) then if nightvision then nightvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") removeEventHandler("onClientRender", root, image) else nightvision = true addEventHandler("onClientRender", root, image) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "nightvision") end end elseif (key == "i") then if (getElementData(getLocalPlayer(),"Infrared Goggles") > 0) then if infaredvision then infaredvision = false setPedAnimation(getLocalPlayer()) setCameraGoggleEffect("normal") removeEventHandler("onClientRender", root, image) else infaredvision = true addEventHandler("onClientRender", root, image) setTimer(setPedAnimation, 150, 1,getLocalPlayer(),"goggles","goggles_put_on",650,true,false,false,false) setTimer(setCameraGoggleEffect, 700, 1, "thermalvision") end end end end bindKey("n","down",playerZoom) bindKey("i","up",playerZoom) function image() dxDrawImage(screenW *0, screenH *0, screenW *1, screenH * 1, "nightvision.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end Edited June 5, 2015 by Guest Link to comment
Adissonboy11 Posted April 30, 2015 Author Share Posted April 30, 2015 Copie o código novamente, é que as variáveis: screenW e screenH eram locais da função playerZoom, dai deu erro quando tentei chama-las em outra função. Obrigado amigo, agora funcionou, obrigado mesmo. 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