iFoReX Posted August 3, 2012 Share Posted August 3, 2012 el texto ni el rectangulo aparecen function dxLogo() logo = dxDrawText("[PGS]BaseMode Server",632.0,7.0,765.0,22.0,tocolor(13,227,184,190),1.0,"default-bold","left","top",false,false,true) dxDrawRectangle(624.0,6.0,151.0,19.0,tocolor(0,0,0,170),false) setElementData(getLocalPlayer(),"text","logo") end function dxWebSite() website = dxDrawText("http://website.com",632.0,7.0,765.0,22.0,tocolor(13,227,184,190),1.0,"default-bold","left","top",false,false,true) dxDrawRectangle(624.0,6.0,151.0,19.0,tocolor(0,0,0,170),false) setElementData(getLocalPlayer(),"text","website") end function destruirLogo() destroyElement(logo) end function destruirWebSite() destroyElement(website) end function condiciones() if getElementData(getLocalPlayer(),"text") == "logo" then setTimer(destruirLogo(), 60000, 1) addEventHandler("onClientRender",root,dxLogo) removeEventHandler("onClientRender",root,dxWebSite) elseif getElementData(getLocalPlayer(),"text") == "website" then setTimer(destruirWebsite(),60000, 1) addEventHandler("onClientRender",root,dxWebSite) removeEventHandler("onClientRender",root,dxLogo) end end Link to comment
Alexs Posted August 3, 2012 Share Posted August 3, 2012 function dxLogo() logo = dxDrawText("[PGS]BaseMode Server",632.0,7.0,765.0,22.0,tocolor(13,227,184,190),1.0,"default-bold","left","top",false,false,true) dxDrawRectangle(624.0,6.0,151.0,19.0,tocolor(0,0,0,170),false) setElementData(getLocalPlayer(),"text","logo") end function dxWebSite() website = dxDrawText("http://website.com",632.0,7.0,765.0,22.0,tocolor(13,227,184,190),1.0,"default-bold","left","top",false,false,true) dxDrawRectangle(624.0,6.0,151.0,19.0,tocolor(0,0,0,170),false) setElementData(getLocalPlayer(),"text","website") end function destruirLogo() destroyElement(logo) end function destruirWebSite() destroyElement(website) end function condiciones() if getElementData(getLocalPlayer(),"text") == "logo" then setTimer(destruirLogo(), 60000, 1) addEventHandler("onClientRender",root,dxLogo) removeEventHandler("onClientRender",root,dxWebSite) elseif getElementData(getLocalPlayer(),"text") == "website" then setTimer(destruirWebsite(),60000, 1) addEventHandler("onClientRender",root,dxWebSite) removeEventHandler("onClientRender",root,dxLogo) end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),condiciones) Link to comment
Castillo Posted August 4, 2012 Share Posted August 4, 2012 Todo lo relacionado con DirectX ( dxDrawText etc ) no son elementos, no podes destruirlos, tenes que remover el evento de "onClientRender". function dxLogo ( ) logo = dxDrawText("[PGS]BaseMode Server",632.0,7.0,765.0,22.0,tocolor(13,227,184,190),1.0,"default-bold","left","top",false,false,true) dxDrawRectangle(624.0,6.0,151.0,19.0,tocolor(0,0,0,170),false) setElementData(getLocalPlayer(),"text","logo") end function dxWebSite() website = dxDrawText("http://website.com",632.0,7.0,765.0,22.0,tocolor(13,227,184,190),1.0,"default-bold","left","top",false,false,true) dxDrawRectangle(624.0,6.0,151.0,19.0,tocolor(0,0,0,170),false) setElementData(getLocalPlayer(),"text","website") end function destruirLogo ( ) removeEventHandler ( "onClientRender", root, dxLogo ) end function destruirWebSite ( ) removeEventHandler ( "onClientRender", root, dxWebSite ) end function condiciones ( ) if ( getElementData ( getLocalPlayer(), "text" ) == "logo" ) then setTimer ( destruirLogo, 60000, 1 ) addEventHandler ( "onClientRender", root,dxLogo ) removeEventHandler ( "onClientRender", root, dxWebSite ) elseif ( getElementData ( getLocalPlayer(), "text" ) == "website" ) then setTimer ( destruirWebsite, 60000, 1 ) addEventHandler ( "onClientRender", root, dxWebSite ) removeEventHandler ( "onClientRender", root, dxLogo ) end end Link to comment
Recommended Posts