HunT Posted January 15, 2012 Share Posted January 15, 2012 (edited) Hi Guys. I have the epic problem for call the element from database (number rank) and set in nametags (image client). Example rank number 0 = rank0.png (type last job in scoreboard . . .remember? ) type : local nameimage = "rank" local rank = -- this is my problem, for call the rank number from database dxDrawImage(drawX-1, drawY-1, width+2, height+2, "img/"..nameimage..rank..".png" ) The function server side for call the number + triggerClientEvent i test every time . . . .every Fail. S.O.S Edited January 20, 2012 by Guest Link to comment
Castillo Posted January 15, 2012 Share Posted January 15, 2012 I would use setElementData to save the image and then getElementData in the client side. Link to comment
HunT Posted January 15, 2012 Author Share Posted January 15, 2012 I would use setElementData to save the image and then getElementData in the client side. oh yep . . .but i never use setElementData and the wiki no help me about this argument. Link to comment
HunT Posted January 16, 2012 Author Share Posted January 16, 2012 Maybe i need the "alternative" nametags. Type original nametag for name and bar,and nametag2 for image,why is impossible import the element from db in original nametags. Server side for call the elements with event onPlayerSpawn and trigg for dx image. Mhh . . .is hard i hate dx function Link to comment
HunT Posted January 16, 2012 Author Share Posted January 16, 2012 Maybe : local nameimage = "rank" local rank = triggerServerEvent -- Maybe no dxDrawImage(drawX-1, drawY-1, width+2, height+2, "img/"..nameimage..rank..".png" ) Link to comment
FatalTerror Posted January 16, 2012 Share Posted January 16, 2012 Like that ? Client-side: local nameimage = "rank" addEvent("yourEvent", true) addEventHandler("yourEvent", getRootElement(), function(rank) if rank then addEventHandler("onClientRender", getRootElement(), function() dxDrawImage(drawX-1, drawY-1, width+2, height+2, "img/"..nameimage..rank..".png" ) end) end end) Server side: triggerClientEvent("yourEvent", getRootElement(), rank) Link to comment
HunT Posted January 16, 2012 Author Share Posted January 16, 2012 Like that ?Client-side: local nameimage = "rank" addEvent("yourEvent", true) addEventHandler("yourEvent", getRootElement(), function(rank) if rank then addEventHandler("onClientRender", getRootElement(), function() dxDrawImage(drawX-1, drawY-1, width+2, height+2, "img/"..nameimage..rank..".png" ) end) end end) Server side: triggerClientEvent("yourEvent", getRootElement(), rank) Tnx for this but i need the element server in nametags. Anyway i make this patetich soluction and now the debugscript 3 is live Maybe the server number is ok but the dxDrawImage sure is fail . . . why i'm very nab in dx Function nametag client : if NAMETAG_BAR_FRAME == 1 then local nameimage = "rank" local rank = triggerServerEvent ("rankTab",getLocalPlayer()) dxDrawImage(drawX-1, drawY-1, width+2, height+2, tostring(":race\\img\\"..nameimage..rank..".png" )) end server side event : addEvent("rankTab", true) addEventHandler("rankTab", rootElement, function(rank) local account = getPlayerAccount(source) local rank = getAccountData(account, "rank") end ) Debugscript 3 report : attempt to concatenate local 'rank' (a boolean value) -- from dx string client Link to comment
HunT Posted January 17, 2012 Author Share Posted January 17, 2012 /push post Sorry for push but i very need help I never use the dx functions. The problem is the string dx or rank = trigg Tnx P.S. I'm not wait the code,i want only the info. Link to comment
FatalTerror Posted January 17, 2012 Share Posted January 17, 2012 Men the trigger don't return string or int value Returns true if the event trigger has been sent, false if invalid arguments were specified. Link to comment
HunT Posted January 17, 2012 Author Share Posted January 17, 2012 But debugscript report me the error in dxDrawImage ,maybe the script run and the dx don't check the png. Link to comment
FatalTerror Posted January 17, 2012 Share Posted January 17, 2012 dxDrawImage(drawX-1, drawY-1, width+2, height+2, tostring(":race/img/rank"..rank..".png" )) I think it's that and... triggerServerEvent return only a bool value Link to comment
HunT Posted January 17, 2012 Author Share Posted January 17, 2012 No work . . Maybe is impossible Link to comment
Castillo Posted January 17, 2012 Share Posted January 17, 2012 -- client side: triggerServerEvent ("rankTab",getLocalPlayer()) -- This will trigger so it get's the rank and set element data, don't trigger it in the event "onClientRender", it must be outside. if NAMETAG_BAR_FRAME == 1 then local nameimage = "rank" local rank = getElementData(localPlayer,"rank") if (not fileExists(":race/img/"..rank..".png")) then return end dxDrawImage(drawX-1, drawY-1, width+2, height+2, ":race/img/"..rank..".png") end -- server side: addEvent("rankTab", true) addEventHandler("rankTab", root, function() local account = getPlayerAccount(source) local rank = getAccountData(account, "rank") setElementData(source,"rank",tostring(rank)) end ) Link to comment
HunT Posted January 18, 2012 Author Share Posted January 18, 2012 -- client side: triggerServerEvent ("rankTab",getLocalPlayer()) -- This will trigger so it get's the rank and set element data, don't trigger it in the event "onClientRender", it must be outside. if NAMETAG_BAR_FRAME == 1 then local nameimage = "rank" local rank = getElementData(localPlayer,"rank") if (not fileExists(":race/img/"..rank..".png")) then return end dxDrawImage(drawX-1, drawY-1, width+2, height+2, ":race/img/"..rank..".png") end -- server side: addEvent("rankTab", true) addEventHandler("rankTab", root, function() local account = getPlayerAccount(source) local rank = getAccountData(account, "rank") setElementData(source,"rank",tostring(rank)) end ) Tnx Castillo later test,now i can't But u forget the ..nameimage.. In dxDrawImage? Or no need this now? Anyway later test Link to comment
HunT Posted January 18, 2012 Author Share Posted January 18, 2012 Debug Say : attempt to concatenate local 'rank' (a boolean value) on dxDrawImage dxDrawImage(drawX-1, drawY-1, width+2, height+2, ":race/img/"..rank..".png") i have the image rank0.png in race/img . . . and rank 0 in stats Where is the problem Link to comment
HunT Posted January 20, 2012 Author Share Posted January 20, 2012 Castillo the set/get elementData need the event or the botton,why i call the r,g,b and r1,g1,b1 for change the color dxname tag and dxrectangle whit colorPicker and work. For rank number i need the botton in panel or event onPlayerSpawn Event server side Get account data Set element data with tonumber Client Get element data whth tonumber dxDrawImage ..rank..".png" else Default.png Tnx for info about element data 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