JuniorMelo Posted June 11, 2013 Posted June 11, 2013 can help me with this script dxDrawColorText Appearing a message when the player enter the area, the problem it is the message appearing for All players can help to appear the message for only the player who joined the base sorry my english (I am Brazilian) local rootElement = getRootElement() local sw,sh = guiGetScreenSize() local localPlayer = getLocalPlayer ( ) local LOCAL_PLAYER = getLocalPlayer() function dx () dxDrawColorText("#ffffff~Base~",sw/15.2, sh/1.499, sw,sh,tocolor(0,0,0,255),2.0, "default-bold", "left", "top", false, false, false) dxDrawColorText("#D76609Area 51",sw/15.2, sh/1.399, sw,sh,tocolor(0,0,0,255),2.0, "default-bold", "left", "top", false, false, false) end addEvent ( "text", true ) addEventHandler ( "text", root, function () addEventHandler("onClientRender",rootElement, dx) end ) function exitarea () removeEventHandler("onClientRender",rootElement, dx) end addEventHandler("onClientColShapeLeave",getRootElement(),exitarea) function dxDrawColorText(str, ax, ay, bx, by, color, scale, font) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end ........... \__ ▄▂_ .........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂ ..__▂▄▅█████████▅▄▃▂ I███████████████████] ...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤ ░░░███████ ]▄▄▄▄▄▄▄▄ ▂▄▅████████▅▄▃▂ I███████████████████] ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
Castillo Posted June 11, 2013 Posted June 11, 2013 dxDrawColorText isn't required, MTA supports HEX colors for the dxDrawText function. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
JuniorMelo Posted June 11, 2013 Author Posted June 11, 2013 dxDrawColorText isn't required, MTA supports HEX colors for the dxDrawText function. no got it ........... \__ ▄▂_ .........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂ ..__▂▄▅█████████▅▄▃▂ I███████████████████] ...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤ ░░░███████ ]▄▄▄▄▄▄▄▄ ▂▄▅████████▅▄▃▂ I███████████████████] ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
PaiN^ Posted June 11, 2013 Posted June 11, 2013 Replace dxDrawColorText with dxDrawText and activate the HEX color code " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
JuniorMelo Posted June 11, 2013 Author Posted June 11, 2013 well ? local rootElement = getRootElement() local sw,sh = guiGetScreenSize() local localPlayer = getLocalPlayer ( ) local LOCAL_PLAYER = getLocalPlayer() function dx () dxDrawText("~Base~",sw/15.2, sh/1.499, sw,sh,tocolor(255,255,255,255),2.0, "default-bold", "left", "top", false, false, false) dxDrawText("Area 51",sw/15.2, sh/1.399, sw,sh,tocolor(0,255,0,255),2.0, "default-bold", "left", "top", false, false, false) end addEvent ( "text", true ) addEventHandler ( "text", root, function () addEventHandler("onClientRender",rootElement, dx) end ) function exitarea () removeEventHandler("onClientRender",rootElement, dx) end addEventHandler("onClientColShapeLeave",getRootElement(),exitarea) ........... \__ ▄▂_ .........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂ ..__▂▄▅█████████▅▄▃▂ I███████████████████] ...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤ ░░░███████ ]▄▄▄▄▄▄▄▄ ▂▄▅████████▅▄▃▂ I███████████████████] ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
iPrestege Posted June 11, 2013 Posted June 11, 2013 dxDrawText("~Base~",sw/15.2, sh/1.499, sw,sh,tocolor(255,255,255,255),2.0, "default-bold", "left", "top", false, false, false,true) dxDrawText("Area 51",sw/15.2, sh/1.399, sw,sh,tocolor(0,255,0,255),2.0, "default-bold", "left", "top", false, false, false,true) You can use a hex color code's .
Castillo Posted June 11, 2013 Posted June 11, 2013 You must enable the colorCoded argument too. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
JuniorMelo Posted June 11, 2013 Author Posted June 11, 2013 dxDrawText("~Base~",sw/15.2, sh/1.499, sw,sh,tocolor(255,255,255,255),2.0, "default-bold", "left", "top", false, false, false,true) dxDrawText("Area 51",sw/15.2, sh/1.399, sw,sh,tocolor(0,255,0,255),2.0, "default-bold", "left", "top", false, false, false,true) You can use a hex color code's . that way the message appears to the player that entered the base ? ........... \__ ▄▂_ .........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂ ..__▂▄▅█████████▅▄▃▂ I███████████████████] ...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤ ░░░███████ ]▄▄▄▄▄▄▄▄ ▂▄▅████████▅▄▃▂ I███████████████████] ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
iPrestege Posted June 11, 2013 Posted June 11, 2013 I don't know you have to set it for the player how enter the area i mean 'triggerClientEvent' . @ Solid : Already done .
JuniorMelo Posted June 11, 2013 Author Posted June 11, 2013 (edited) -- Edited June 12, 2013 by Guest ........... \__ ▄▂_ .........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂ ..__▂▄▅█████████▅▄▃▂ I███████████████████] ...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤ ░░░███████ ]▄▄▄▄▄▄▄▄ ▂▄▅████████▅▄▃▂ I███████████████████] ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
JuniorMelo Posted June 11, 2013 Author Posted June 11, 2013 The text will be shown for everyone . yes (I want to put to show only the player who enters the base) ........... \__ ▄▂_ .........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂ ..__▂▄▅█████████▅▄▃▂ I███████████████████] ...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤ ░░░███████ ]▄▄▄▄▄▄▄▄ ▂▄▅████████▅▄▃▂ I███████████████████] ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
iPrestege Posted June 11, 2013 Posted June 11, 2013 triggerClientEvent ( hitElement,"text", hitElement, "area" )
JuniorMelo Posted June 11, 2013 Author Posted June 11, 2013 working Thanks !!! ........... \__ ▄▂_ .........[█|||███████]▄▄▄▄▄▄▄▄▄▃▂ ..__▂▄▅█████████▅▄▃▂ I███████████████████] ...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤ ░░░███████ ]▄▄▄▄▄▄▄▄ ▂▄▅████████▅▄▃▂ I███████████████████] ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
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