Jump to content

dxDrawText


abu5lf

Recommended Posts

Server

function wla(thePlayer, commandName,...) 
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" ) ) then 
        local veve = {...} 
        local message = table.concat(veve, " ") 
        triggerClientEvent("new", getRootElement(),message) 
    end 
end 
addCommandHandler("AM", wla) 

Clinet

function start(message) 
    removeEventHandler ( "onClientRender", getRootElement(), as ) 
    function as() 
        dxDrawText("Admin :",17.0,189.0,61.0,206.0,tocolor(255,0,0,255),1.0,"default-bold","top","left",false,false,false) 
        dxDrawText(message,61.0,189.0,264.0,226.0,tocolor(255,255,255,255),1.0,"default-bold","top","left",false,false,false) 
    end 
    addEventHandler("onClientRender", getRootElement(), as) 
end 
addEvent("new", true ) 
addEventHandler("new", getRootElement(), start) 
function yana(msgmsg) 
    outputChatBox(msgmsg,getRootElement(),255,0,0,true) 
end 
addEvent("yanas", true ) 
addEventHandler("yanas", getRootElement(), yana) 
bindKey("u", "down", "chatbox","AM") 

It does not work

Edited by Guest
Link to comment

Client

addEvent( 'new',    true ) 
addEvent( "yanas",  true ) 
  
local sMessage = '' 
  
function fStart( sText ) 
    sMessage = sText 
end 
  
function fDraw( ) 
    if sMessage ~= '' then 
        dxDrawText( "Admin :",17.0,189.0,61.0,206.0,tocolor( 255,0,0,255 ),1.0,"default-bold","top","left",false,false,false ) 
        dxDrawText( sMessage,61.0,189.0,264.0,226.0,tocolor( 255,255,255,255 ),1.0,"default-bold","top","left",false,false,false ) 
    end 
end 
  
function fNa( msgmsg ) 
    outputChatBox( msgmsg,255,0,0,true ) 
end 
  
  
bindKey( "u", "down", "chatbox","AM" ) 
  
addEventHandler( 'new', root, fStart            ) 
addEventHandler( 'onClientRender', root, fDraw  ) 
addEventHandler( "yanas", root, fNa             ) 
  
  

Link to comment

meta.xml

    "X" name="AdminMsg" type="script" version="1.0.0" /> 
    

This is repeated several times fast

[2012-03-04 15:43:07] WARNING: adminmsg\client.lua:12: Bad argument @ 'dxDrawText' [Expected horizontal-align at argument 9, got string 'top']

[2012-03-04 15:43:07] WARNING: adminmsg\client.lua:13: Bad argument @ 'dxDrawText' [Expected horizontal-align at argument 9, got string 'top']

Link to comment
addEvent( 'new',    true ) 
addEvent( "yanas",  true ) 
  
local sMessage = '' 
  
function fStart( sText ) 
    sMessage = sText 
end 
  
function fDraw( ) 
    if sMessage ~= '' then 
        dxDrawText ( "Admin :", 17.0, 189.0, 61.0, 206.0, tocolor( 255,0,0,255 ), 1.0, "default-bold", "left", "top", false, false, false ) 
        dxDrawText ( sMessage, 61.0, 189.0, 264.0, 226.0, tocolor( 255,225,225,255 ), 1.0, "default-bold", "left", "top", false, false, false )        
    end 
end 
  
function fNa( msgmsg ) 
    outputChatBox( msgmsg,255,0,0,true ) 
end 
  
  
bindKey( "u", "down", "chatbox","AM" ) 
  
addEventHandler( 'new', root, fStart            ) 
addEventHandler( 'onClientRender', root, fDraw  ) 
addEventHandler( "yanas", root, fNa             ) 
  
  

Because you use 9 argument in function dxDrawText 'top', but it argument not exists.

alignX: horizontal alignment of the text within the bounding box. Can be "left", "center" or "right".
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...