Alexs Posted March 17, 2013 Share Posted March 17, 2013 drawText es efímero, dura 1 frame, utiliza addEventHandler y removeEventHandler junto a 'onClientRender'. Link to comment
Julian09123 Posted March 17, 2013 Author Share Posted March 17, 2013 No te entiendo Como? Link to comment
Alexs Posted March 17, 2013 Share Posted March 17, 2013 Mira el ejemplo de 'removeEventHandler': function drawText() -- A function to draw the text we want dxDrawText(text, 10,100) -- creates a dx text 10 pixels from left, 100 from top of the screen end function doText(command, ...) if command == "starttext" then -- if player wrote /starttext text = table.concat({...}," ") -- then we retrieve the text addEventHandler("onClientRender", getRootElement(), drawText) -- and since addEventHandler and removeEventHandler's syntax is the same, we just define the function we use later elseif command == "stoptext" then removeEventHandler("onClientRender", getRootElement(), drawText) -- this time we use removeEventHandler end end addCommandHandler("starttext", doText) -- add two command handlers to doText function addCommandHandler("stoptext", doText) Los Dx duran un frame (aproximadamente una Quincuagésima de segundo) así que debes hacer que se vuelva a mostrar en cada frame (onClientRender). Link to comment
Julian09123 Posted March 17, 2013 Author Share Posted March 17, 2013 Alex dice en la console cuando pongo /starttext dice addeventhandler `onclientrender` with this funtion is already handled Link to comment
Alexs Posted March 17, 2013 Share Posted March 17, 2013 Es el ejemplo de la Wiki, no es para que lo probaras ni es la solución a tu problema, solo es para que sepas como se hace. Link to comment
Recommended Posts