marona Posted June 21, 2014 Posted June 21, 2014 Hey there, i have a problem with my script here is it only the dxRectangle is there but the text isn´t there here Client: function infobox ( message,color1,color2,color3,size) message = message dxDrawRectangle(0, 0, 1366, 145, tocolor(0, 0, 0, 119), true) dxDrawText("It says:"..message.."", 0, 0, 1366, 145, tocolor(color1, color2, color3, 255), size, "bankgothic", "left", "top", false, false, true, false, false) addEventHandler("onClientRender",getRootElement(),infobox) setTimer(destroyInfobox,3000,1) end addEvent("infobox",true) addEventHandler("infobox",getRootElement(),infobox) function destroyInfobox () removeEventHandler("onClientRender",getRootElement(),infobox) end Server: triggerClientEvent(source,"infobox",getRootElement(),"Hey there!",150,150,150,2)
Moderators IIYAMA Posted June 21, 2014 Moderators Posted June 21, 2014 Try this: local messageData local infoboxHandler = false local infobox = function () dxDrawRectangle(0, 0, 1366, 145, tocolor(0, 0, 0, 119), true) dxDrawText("It says:"..messageData["text"].."", 0, 0, 1366, 145, tocolor(messageData["R"], messageData["G"], messageData["B"], 255), messageData["size"], "bankgothic", "left", "top", false, false, true, false, false) end local destroyInfobox = function () removeEventHandler("onClientRender",root,infobox) infoboxHandler = false end addEvent("infobox",true) addEventHandler("infobox",root, function ( messageData2) messageData = messageData2 if not infoboxHandler then addEventHandler("onClientRender",root,infobox) setTimer(destroyInfobox,3000,1) infoboxHandler = true end end) local messageData = { ["text"]="Hey there!", ["R"]=150, ["G"]=150, ["B"]=150, ["size"]=2 } triggerClientEvent(source,"infobox",root,messageData) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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