scienziato-pazzo Posted January 15, 2014 Share Posted January 15, 2014 Why this function doesn't work? showPlayerHudComponent("clock", false) function updateHud() --outputChatBox("function test") -- It works local screenWidth, screenHeight = guiGetScreenSize() local sx, sy = screenWidth/1400, screenHeight/900 local realtime = getRealTime() local hour = realtime.hour local minute = realtime.minute local timestring = string.format("%i:%i", hour, minute) dxDrawText(timestring, 1229*sx, 56*sy, 140*sx, 148*sy, 0xFFFFFF, 140*sx, 148*sy) end function timeHudF() --outputChatBox("culo") -- It works addEventHandler("onClientRender", getRootElement(), updateHud) end addEvent("timeHud", true) addEventHandler("timeHud", getRootElement(), timeHudF) The function timeHud is called from the server, and all works, but if I add the last 3 parameters to dxDrawText, it doesn't work. I wanna set the font bigger than how is presented by default. Link to comment
MTA Team 0xCiBeR Posted January 15, 2014 MTA Team Share Posted January 15, 2014 You should read the wiki variables before asking here. Anyway this is the fix.: showPlayerHudComponent("clock", false) function updateHud() --outputChatBox("function test") -- It works local screenWidth, screenHeight = guiGetScreenSize() local sx, sy = screenWidth/1400, screenHeight/900 local realtime = getRealTime() local hour = realtime.hour local minute = realtime.minute local timestring = string.format("%i:%i", hour, minute) dxDrawText(timestring, 1229*sx, 56*sy, 140*sx, 148*sy, tocolor(255,255,255,255), 2, "default") end function timeHudF() --outputChatBox("culo") -- It works addEventHandler("onClientRender", getRootElement(), updateHud) end addEvent("timeHud", true) addEventHandler("timeHud", getRootElement(), timeHudF) Link to comment
scienziato-pazzo Posted January 15, 2014 Author Share Posted January 15, 2014 You should read the wiki variables before asking here. Anyway this is the fix.: showPlayerHudComponent("clock", false) function updateHud() --outputChatBox("function test") -- It works local screenWidth, screenHeight = guiGetScreenSize() local sx, sy = screenWidth/1400, screenHeight/900 local realtime = getRealTime() local hour = realtime.hour local minute = realtime.minute local timestring = string.format("%i:%i", hour, minute) dxDrawText(timestring, 1229*sx, 56*sy, 140*sx, 148*sy, tocolor(255,255,255,255), 2, "default") end function timeHudF() --outputChatBox("culo") -- It works addEventHandler("onClientRender", getRootElement(), updateHud) end addEvent("timeHud", true) addEventHandler("timeHud", getRootElement(), timeHudF) Thanks, it works. Link to comment
MTA Team 0xCiBeR Posted January 15, 2014 MTA Team Share Posted January 15, 2014 You'r welcome. 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