DanielZ3RO Posted January 30, 2014 Share Posted January 30, 2014 Hola.. estoy haciendo un sistema de anuncios para cuando un admin escriba /anuncio (texto) salga el anuncio en la parte inferior de la pantalla, pero no tengo ni idea que es lo que no funciona :c Client-Side addEvent("Anuncios",true) addEventHandler("Anuncios",localPlayer, function Anuncios(message) message = message addEventHandler("onClientRender", getRootElement(), function () local sWidth, sHeight = guiGetScreenSize ( ) dxDrawRectangle(sWidth * 0,sHeight * 0.95,sWidth * 1,sHeight* 0.05, tocolor(0, 0, 0, 150), true) dxDrawText(message,sWidth * 1,sHeight * 0.933,sWidth * 0.05,sHeight * 1.01, tocolor(255, 255, 0, 255), 2.20, "default", "center", "center", false, false, true, false, false) end) ) end function remover() removeEventHandler("onClientRender", getRootElement(), drawText, drawRectangle) end setTimer ( remover, 5000, 1) Sever-Side function Anuncio1( thePlayer, commandName, ...) local usuario = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user.".. usuario, aclGetGroup ( "Admin" ) ) then local message = table.concat({...}," ") triggerClientEvent ( "onAnuncios", getRootElement(), message ) end end addCommandHandler( "anuncio", Anuncio1 ) Si me pueden ayudar todos se los agradeceria muchisimo Link to comment
Guest Posted January 30, 2014 Share Posted January 30, 2014 ¿Quieres usar dxDrawText o outputChatBox? Link to comment
MTA Team 0xCiBeR Posted January 31, 2014 MTA Team Share Posted January 31, 2014 Client: addEvent("onAnuncios",true) addEventHandler("onAnuncios",localPlayer, function (message) message = message addEventHandler("onClientRender", localPlayer,drawText) setTimer(removeEventHandler,5000,1,localPlayer,drawText) ) end sWidth, sHeight = guiGetScreenSize ( ) function drawText () dxDrawRectangle(sWidth * 0,sHeight * 0.95,sWidth * 1,sHeight* 0.05, tocolor(0, 0, 0, 150), true) dxDrawText(message,sWidth * 1,sHeight * 0.933,sWidth * 0.05,sHeight * 1.01, tocolor(255, 255, 0, 255), 2.20, "default", "center", "center", false, false, true, false, false) end Link to comment
DanielZ3RO Posted January 31, 2014 Author Share Posted January 31, 2014 Intentare Probarlo Haber Que Tal Sale Link to comment
DanielZ3RO Posted February 1, 2014 Author Share Posted February 1, 2014 No al fin no sirvio :c, intentare probar de otras formas Link to comment
DanielZ3RO Posted February 1, 2014 Author Share Posted February 1, 2014 me pueden ayudar porfa, ahora sale el cuadro antes de que ponga el anuncio, y pongo el anuncio y el cuadro sale por un segundo o menos :c (y pasa lo mismo cuando le cambio el tiempo del setTimer ) server function anuncios(player, cmd, ...) local accountname = getAccountName(getPlayerAccount(player)) if ( hasObjectPermissionTo ( player, "command.mute", true ) ) then for id, players in ipairs(getElementsByType("player")) do local message = table.concat({...}," ") local textChat = textCreateDisplay () local textItem = textCreateTextItem( message, 0.5, 0.971, 1.5, 255 ,255, 0, 255, 2.2, "center", "center") textDisplayAddText ( textChat, textItem ) textDisplayAddObserver ( textChat, players ) setTimer ( textDestroyTextItem, 3000, 1, textItem ) setTimer ( textDestroyDisplay, 3000, 1, textChat ) triggerClientEvent ( "onCuadro", getRootElement()) end end end addCommandHandler("anuncio", anuncios) client function cuadrito () local sWidth, sHeight = guiGetScreenSize () dxDrawRectangle(sWidth * 0,sHeight * 0.95,sWidth * 1,sHeight* 0.05, tocolor(0, 0, 0, 150), false) setTimer ( remover, 7000, 1, cuadro) end addEvent( "onCuadro", true ) addEventHandler( "onCuadro", getRootElement(), cuadrito ) addEventHandler("onClientRender", getRootElement(), cuadrito ) function remover() removeEventHandler("onClientRender", getRootElement(), cuadrito ) end Link to comment
Recommended Posts