BucketBull Posted January 4, 2017 Share Posted January 4, 2017 (edited) Hey guys. Im making a second hand carshop. I need your help! My varriables are in server side. How shall i trigger it? This is my client side function: function dxDraw3D() dxDraw3DText( name.."\n Nyitvatartás: "..open_hour..":"..open_minute.." - "..close_hour..":"..close_minute, 1951.80859375, -1875.513671875, 13.646875 ) end addEvent ( "dxDraw3D ", true ) addEventHandler ( "dxDraw3D ", getRootElement(), dxDraw3D ) Edited January 4, 2017 by BucketBull Link to comment
^iiEcoo'x_) Posted January 4, 2017 Share Posted January 4, 2017 This code is wrong because there are things that do not know Link to comment
BucketBull Posted January 4, 2017 Author Share Posted January 4, 2017 Then how should i fix it? Link to comment
^iiEcoo'x_) Posted January 4, 2017 Share Posted January 4, 2017 Then give me the codes or give me your idea of the script Link to comment
itHyperoX Posted January 4, 2017 Share Posted January 4, 2017 are you talking about like this? local x = 1951.80859375 local y = -1875.513671875 local z = 13.646875 addEventHandler("onClientRender",getRootElement(), function() local px,py,pz = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if distance <= 150 then local sx,sy = getScreenFromWorldPosition ( x, y, z+0.95, 0.06 ) if not sx then return end local scale = 1/(0.3 * (distance / 150)) dxDrawText (name.."\n Nyitvatartás: "..open_hour..":"..open_minute.." - "..close_hour..":"..close_minute"", sx, sy - 30, sx, sy - 30, tocolor(255,255,255,255), math.min ( 0.4*(150/distance)*1.4,4), "bankgothic", "center", "bottom", false, false, false ) end end ) Link to comment
BucketBull Posted January 4, 2017 Author Share Posted January 4, 2017 I have the varriables(name, open_hour, open_minute, close_hour, close_minute) on server side but i cant use dxdraw3dtext on server side. How should i trigger it? Link to comment
^iiEcoo'x_) Posted January 4, 2017 Share Posted January 4, 2017 Yes triggerClientEvent Link to comment
itHyperoX Posted January 4, 2017 Share Posted January 4, 2017 (edited) Trigger Edited January 4, 2017 by TheMOG ww Link to comment
^iiEcoo'x_) Posted January 4, 2017 Share Posted January 4, 2017 Or dis = textCreateDisplay() text = textCreateTextItem(""..open_hours. ."",0.2,0.4,"medium",255,0,0,255,3) textDisplayAddText(dis,text) Link to comment
^iiEcoo'x_) Posted January 5, 2017 Share Posted January 5, 2017 Or Example -- # Server Side local "..open_hour.." = m setElementData ( player , "ok", m ) -- # Client Side dxDrawText ("[ "..getElementData(localPlayer,"ok").." ]", sx, sy - 30, sx, sy - 30, tocolor(255,255,255,255), math.min ( 0.4*(150/distance)*1.4,4), "bankgothic", "center", "bottom", false, false, false ) 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