Search the Community
Showing results for tags 'dxdraw3dtext'.
-
So. i have little problem with client side. Console and debugmonitor3 dosen't say anything. Server Side: local onDuty = {} addCommandHandler('duty',function(player,cmd) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup('user.'..accName,aclGetGroup('Admin')) then if not onDuty[player] or onDuty[player] == false then onDuty[player] = true outputChatBox("#F10404[ADMINISTRATOR] #FF8B00 "..getPlayerName(player)..' #04F42Cis now on duty!', getRootElement(), 255, 255, 255, true) triggerClientEvent(player,"onDuty",getRootElement()) timer1 = setTimer(function() setElementAlpha(player, 0) setElementData(player,'brokenbone',false) setElementData(player,'bleeding',false) setElementData(player,'pain',false) setElementData(player,'cold',false) setElementData(player,'temperature',36.5) setElementData(player,'blood',12000) setElementData(player,'food',100) setElementData(player,'thirst',75) end,50,0) else onDuty[player] = false setElementAlpha(player, 255) outputChatBox("#F10404[ADMINISTRATOR] #FF8B00 "..getPlayerName(player)..' #3600FF is now off duty!', getRootElement(), 255, 255, 255, true) if isTimer(timer1) then killTimer(timer1) end end end end) Client Side: addEvent ( "onDuty", true ) function duty() if getElementData(source,"duty") == true then timer = setTimer ( function() setElementData(source,"onDuty",true) local x, y, z = getElementPosition(source ) local playerName = getPlayerName(source ) local theText = dxDraw3DText( "Admin On Duty [NO DM]", x, y, z+1,05,"default",255,0,0,200) setTimer ( function() destroyElement(theText) end, 59, 1) end, 60, 0 ) else if isTimer(timer) then killTimer(timer) end setElementData(source,"duty",true) end end addEventHandler ( "onDuty", root, duty) Do anyone have solution?
- 3 replies
-
- dxdraw3dtext
- dayz
- (and 4 more)
-
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 )
-
Hey guys. It says attempt to cal global "dxDraw3DText"(a nil value). Do you have any opinion why isnt it working? function kocsitext() local veh = getPedOccupiedVehicle(localPlayer) local jarmuid = getElementModel(veh) local x,y,z = getElementPosition(veh) local text = dxDraw3DText("Tipus: #800000",x,y,z,2,"arial",255,255,255,4) end
-
addEvent ( "onaduty", true ) function aduty() if getElementData(getLocalPlayer( ),"aduty") == true then timer = setTimer ( function() setElementData(getLocalPlayer( ),"onaduty",true) local x, y, z = getElementPosition( getLocalPlayer( ) ) local playerName = getPlayerName( getLocalPlayer( ) ) local theText = dxDraw3DText( "Admin On duty [DONT SHOOT]", x, y, z+1,05,"default",255,0,0,200) setTimer ( function() destroyElement(theText) end, 59, 1) end, 60, 0 ) else if isTimer(timer) then killTimer(timer) end setElementData(getLocalPlayer( ),"aduty",true) end end addEventHandler ( "onaduty", getRootElement(), aduty) addCommandHandler("duty",aduty) Text.lua Here is problem. I see the text but another players don't! goduty.lua function aduty ( player ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then outputChatBox(" Administrator "..getPlayerName(player).." Is Now OnDuty!",getRootElement(),255,0,0) outputChatBox("",getRootElement(),255,0,0) outputServerLog(" Administrator "..getPlayerName(player).." Is Now OnDuty!") setElementData( player, "blood", 99999999999999999999999 ) heal = "9999999999999999999999999999" end end addCommandHandler("duty",aduty) function offaduty ( player ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then outputChatBox(" Administrator "..getPlayerName(player).." Is No Longer OnDuty!",getRootElement(),255,0,0) outputChatBox("",getRootElement(),255,0,0) outputServerLog(" Administrator "..getPlayerName(player).." Is No Longer OnDuty!") setElementData( player, "blood", 12000 ) end end addCommandHandler("offaduty",offaduty) function heal_func ( player ) local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then if heal == "an" then setElementData( player, "food", 250 ) setElementData( player, "thirst", 250 ) end end end setTimer(heal_func, 60000, 0) 3dtext.lua local fonts = { [ "default" ] = true, [ "default-bold" ] = true,[ "clear" ] = true,[ "arial" ] = true,[ "sans" ] = true, [ "pricedown" ] = true, [ "bankgothic" ] = true,[ "diploma" ] = true,[ "beckett" ] = true }; function dxDraw3DText( text, x, y, z, scale, font, r, g, b, maxDistance ) assert( type( text ) == "string", "Bad argument @ dxDraw3DText" ); assert( type( x ) == "number", "Bad argument @ dxDraw3DText" ); assert( type( y ) == "number", "Bad argument @ dxDraw3DText" ); assert( type( z ) == "number", "Bad argument @ dxDraw3DText" ); if not scale or type( scale ) ~= "number" or scale <= 0 then scale = 2 end if not font or type( font ) ~= "string" or not fonts[ font ] then font = "default" end if not r or type( r ) ~= "number" or r < 0 or r > 255 then r = 255 end if not g or type( g ) ~= "number" or g < 0 or g > 255 then g = 255 end if not b or type( b ) ~= "number" or b < 0 or b > 255 then b = 255 end if not maxDistance or type( maxDistance ) ~= "number" or maxDistance <= 1 then maxDistance = 12 end local textElement = createElement( "text" ); if textElement then setElementData( textElement, "text", text ); setElementData( textElement, "x", x ); setElementData( textElement, "y", y ); setElementData( textElement, "z", z ); setElementData( textElement, "scale", scale ); setElementData( textElement, "font", font ); setElementData( textElement, "rgba", { r, g, b, 255 } ); setElementData( textElement, "maxDistance", maxDistance ); return textElement end return false end addEventHandler( "onClientRender", root, function( ) local texts = getElementsByType( "text" ); if #texts > 0 then local pX, pY, pZ = getElementPosition( localPlayer ); for i = 1, #texts do local text = getElementData( texts[i], "text" ); local tX, tY, tZ = getElementData( texts[i], "x" ), getElementData( texts[i], "y" ), getElementData( texts[i], "z" ); local font = getElementData( texts[i], "font" ); local scale = getElementData( texts[i], "scale" ); local color = getElementData( texts[i], "rgba" ); local maxDistance = getElementData( texts[i], "maxDistance" ); if not text or not tX or not tY or not tZ then return end if not font then font = "default" end if not scale then scale = 2 end if not color or type( color ) ~= "table" then color = { 255, 255, 255, 255 }; end if not maxDistance then maxDistance = 12 end local distance = getDistanceBetweenPoints3D( pX, pY, pZ, tX, tY, tZ ); if distance <= maxDistance then local x, y = getScreenFromWorldPosition( tX, tY, tZ ); if x and y then dxDrawText( text, x, y, _, _, tocolor( color[1], color[2], color[3], color[4] ), scale, font, "center", "center" ); end end end end end ); NEED HELP!!