-.Paradox.- Posted August 5, 2013 Author Posted August 5, 2013 ..... dxDrawImage in Nametag.lua not the server side script.
golanu21 Posted August 5, 2013 Posted August 5, 2013 addEventHandler("onPlayerLogin", root, function ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementData(source, "Classicon", tostring(":experience\class\classicon_admin.png" )) end if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Moderator" ) ) then setElementData(source, "Classicon", tostring(":experience\class\classicon_mod.png" )) end if isGuestAccount ( account ) then setElementData(source, "Classicon",":experience\class\classicon_player.png") end end this script is not in server side ?
-.Paradox.- Posted August 6, 2013 Author Posted August 6, 2013 Help please, I tried to make it but won't work can somebody fix it?
WASSIm. Posted August 6, 2013 Posted August 6, 2013 (edited) local distmax = 30 local width = 50 local hight = 50 addEventHandler( "onClientRender",root, function( ) local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = getDistanceBetweenPoints3D ( tx, ty, tz, px, py, pz ) if dist < distmax then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.3 ) local w = width local h = hight local class = getElementData(v, "reputation.class") if x and y and w and h then dxDrawImage ( x, y, h, w, ":reputation/class/classicon_"..class..".png", 0, 0, 0, tocolor(255, 255, 255), false ) end end end end end ) Edited August 6, 2013 by Guest
Blaawee Posted August 6, 2013 Posted August 6, 2013 Try this i didn't test it Client: addEventHandler( 'onClientRender', root, function ( ) for i,v in ipairs( getElementsByType( "player" ) ) do local x, y, z = getElementPosition( v ); local cx, cy, cz = getCameraMatrix( ); if getDistanceBetweenPoints3D( cx, cy, cz, x, y, z ) <= 15 then local px,py = getScreenFromWorldPosition( x, y, z + 1.3, 0.06 ); if px and py then dxDrawImage( px, py, px, py, getElementData( v, "Classicon" ), 0, 0, 0, tocolor( 255, 255, 255, 255 ) ); end end end end ); Server: addEventHandler( 'onPlayerLogin', root, function ( ) local account = getPlayerAccount( source ) if account and not isGuestAccount( account ) then local accountName = getAccountName( account ); if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then setElementData( source, "Classicon", tostring( ":experience/class/classicon_admin.png" ) ); elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then setElementData( source, "Classicon", tostring( ":experience/class/classicon_mod.png" ) ); else setElementData( source, "Classicon", tostring( ":experience/class/classicon_player.png" ) ); end end end );
EstrategiaGTA Posted August 10, 2013 Posted August 10, 2013 Could you tell us what does debugscript 3 say?
golanu21 Posted August 11, 2013 Posted August 11, 2013 (edited) function renderIng( ) for key, player in ipairs ( getElementsByType( "player" ) ) do if getElementDimension( player ) == dimension then local px, py, pz = getElementPosition( player ) local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z ) if distance <= 20 then local text = getElementData( player, "Classicon" ) if text and ( distance < 2 or isLineOfSightClear( x, y, z, px, py, pz + 1.1, true, true, true, true, false, false, true, localPlayer ) ) then local sx, sy = getScreenFromWorldPosition( px, py, pz + 1.1 ) if sx and sy then dxDrawImage( px, py, px, py, text, 0, 0, 0, tocolor( 255, 255, 255, 255 ) ); end end end end end end addEventHandler( "onClientRender", getRootElement( ),renderIng) addEventHandler( 'onPlayerLogin', root, function ( ) local account = getPlayerAccount( source ) if account and not isGuestAccount( account ) then local accountName = getAccountName( account ); if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then setElementData( source, "Classicon", tostring( ":experience/class/classicon_admin.png" ) ); elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then setElementData( source, "Classicon", tostring( ":experience/class/classicon_mod.png" ) ); else setElementData( source, "Classicon", tostring( ":experience/class/classicon_player.png" ) ); end end end ); Edited August 11, 2013 by Guest
ixjf Posted August 11, 2013 Posted August 11, 2013 setElementData( source, "Classicon", tostring( ":experience/class/classicon_mod.png" ) ); What's the purpose of converting a string into a string?
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