MisterQuestions Posted June 3, 2014 Posted June 3, 2014 (edited) Delete please. Edited June 27, 2014 by Guest
.:HyPeX:. Posted June 3, 2014 Posted June 3, 2014 InterTimer = setTimer(function() if val1 == 50 then val1 = 100 val2 = 50 else val1 = 50 val2 = 100 end end, 500, 0) local x,y = guiGetScreenSize() addEventHandler ( "onClientRender", getRootElement ( ), function ( ) local PlayerX, PlayerY, PlayerZ = getElementPosition ( getLocalPlayer ( ) ) for i, v in ipairs ( getElementsByType("player") ) do if v == getLocalPlayer() then else local PedX, PedY, PedZ = getElementPosition ( v ) local dist = getDistanceBetweenPoints3D ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ ) local PX, PY, PZ = getElementPosition ( getLocalPlayer ( ) ) local PeX, PeY, PeZ = getElementPosition(v) local Rot = findRotation(PeX, PeY, PX, PY) if dist <= 40 then local scx, scy = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1.2, -50, true ) if isLineOfSightClear ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ, true, false, false, false ) and scx and scy then local alpha = 200 local r = 0 local g = 150 local b = 200 local scale = 2 local scale3d = true local font = "default-bold" local text = getPlayerNametagText ( v ) if not text or text == "" then return end dxDrawText ( text, scx, scy, scx, scy, tocolor ( r, g, b, alpha ), scale, font, "center", "center",true,true,true,true) local rem, asd, asd2 = getTimerDetails(InterTimer) local p = rem / 500 if not val1 or not val2 then return end local v1,v2,v3 = interpolateBetween(val1, 0,0, val2, 0,0, p, "Linear") local MyScale = ( ( v1 / 100 ) * 1.3 ) /( ( 1360 / x ) * ( 768 / y ) ) if dist <= 10 then if not getKeyBoundToFunction(ChallengePlayer) then bindKey("H", "down", ChallengePlayer, v) end local scx2, scy2 = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1, -50, true ) local alpha2 = 255 dxDrawText ( "#66ffaaPress #ffffffH #66ffaaTo Challenge", scx2, scy2, scx2, scy2, tocolor ( r, g, b, alpha2 ), MyScale * 1.5, font, "center", "center",false,false,false,true ) else if getKeyBoundToFunction(ChallengePlayer) then unbindKey("H","down",ChallengePlayer) end end else alpha = 0 end else alpha = 0 end end end end ) Just make sure to edit the part where the text is defined (And remove the "F" thingy + timer at top.)
MisterQuestions Posted June 3, 2014 Author Posted June 3, 2014 Thanks...So..? If i need to put text like that, on diferent ranks, like Server Owner, Admins,Mods..Etc?
.:HyPeX:. Posted June 3, 2014 Posted June 3, 2014 Just take a look at the part where text = getPlayerNametagText( v ) Just Replace it with whatever the method you have to distinguish them.
MisterQuestions Posted June 3, 2014 Author Posted June 3, 2014 Soo...If i want to distinguish a player by acl & should use, "text = isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) )
-.Paradox.- Posted June 3, 2014 Posted June 3, 2014 isObjectInACLGroup is a server side function and Hypex code is client side. I suggest to create a server side script and check player's account if he is like example admin then set his Element data to admin. And in the client side use getElementData
-.Paradox.- Posted June 4, 2014 Posted June 4, 2014 No, oh god, Let me make it for you... 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 ( "Owner" ) ) then setElementData(source, "ACL", "Owner") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then setElementData(source, "ACL", "Moderator") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Super Moderator" ) ) then setElementData(source, "ACL", "Super Moderator") end end end ) addEventHandler( 'onPlayerLogout', root, function ( ) local acl = getElementData(source, "ACL") if acl then removeElementData(source,"ACL") end end) Client: text = getElementData(localPlayer, "ACL")
MisterQuestions Posted June 4, 2014 Author Posted June 4, 2014 Sooo...Thanks this are the .lua file´s Client-Side addEventHandler ( "onClientRender", getRootElement ( ), function ( ) local PlayerX, PlayerY, PlayerZ = getElementPosition ( getLocalPlayer ( ) ) for i, v in ipairs ( getElementsByType("player") ) do if v == getLocalPlayer() then else local PedX, PedY, PedZ = getElementPosition ( v ) local dist = getDistanceBetweenPoints3D ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ ) local PX, PY, PZ = getElementPosition ( getLocalPlayer ( ) ) local PeX, PeY, PeZ = getElementPosition(v) local Rot = findRotation(PeX, PeY, PX, PY) if dist <= 40 then local scx, scy = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1.2, -50, true ) if isLineOfSightClear ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ, true, false, false, false ) and scx and scy then local alpha = 200 local r = 0 local g = 150 local b = 200 local scale = 2 local scale3d = true local font = "default-bold" local text = getElementData(localPlayer, "ACL") if not text or text == "" then return end dxDrawText ( text, scx, scy, scx, scy, tocolor ( r, g, b, alpha ), scale, font, "center", "center",true,true,true,true) local rem, asd, asd2 = getTimerDetails(InterTimer) local p = rem / 500 if not val1 or not val2 then return end local v1,v2,v3 = interpolateBetween(val1, 0,0, val2, 0,0, p, "Linear") local MyScale = ( ( v1 / 100 ) * 1.3 ) /( ( 1360 / x ) * ( 768 / y ) ) if dist <= 10 then if not getKeyBoundToFunction(ChallengePlayer) then bindKey("H", "down", ChallengePlayer, v) end local scx2, scy2 = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1, -50, true ) local alpha2 = 255 dxDrawText ( "#66ffaaPress #ffffffH #66ffaaTo Challenge", scx2, scy2, scx2, scy2, tocolor ( r, g, b, alpha2 ), MyScale * 1.5, font, "center", "center",false,false,false,true ) else if getKeyBoundToFunction(ChallengePlayer) then unbindKey("H","down",ChallengePlayer) end end else alpha = 0 end else alpha = 0 end end end end ) Server-Side addEventHandler( 'onPlayerLogin', root, function ( ) local account = getPlayerAccount( source ) if account and not isGuestAccount( account ) then local accountName = getAccountName( account ); if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Owner" ) ) then setElementData(source, "ACL", "Owner") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "ClanMananger" ) ) then setElementData(source, "ACL", "Clan-Mananger") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then setElementData(source, "ACL", "Admin") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerador" ) ) then setElementData(source, "ACL", "SuperModerador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderador" ) ) then setElementData(source, "ACL", "Moderador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Miembro" ) ) then setElementData(source, "ACL", "Miembro") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "MiembroTrial" ) ) then setElementData(source, "ACL", "MiembroTrial") end end end ) addEventHandler( 'onPlayerLogout', root, function ( ) local acl = getElementData(source, "ACL") if acl then removeElementData(source,"ACL") end end)
-.Paradox.- Posted June 4, 2014 Posted June 4, 2014 Sooo...Thanks this are the .lua file´sClient-Side addEventHandler ( "onClientRender", getRootElement ( ), function ( ) local PlayerX, PlayerY, PlayerZ = getElementPosition ( getLocalPlayer ( ) ) for i, v in ipairs ( getElementsByType("player") ) do if v == getLocalPlayer() then else local PedX, PedY, PedZ = getElementPosition ( v ) local dist = getDistanceBetweenPoints3D ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ ) local PX, PY, PZ = getElementPosition ( getLocalPlayer ( ) ) local PeX, PeY, PeZ = getElementPosition(v) local Rot = findRotation(PeX, PeY, PX, PY) if dist <= 40 then local scx, scy = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1.2, -50, true ) if isLineOfSightClear ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ, true, false, false, false ) and scx and scy then local alpha = 200 local r = 0 local g = 150 local b = 200 local scale = 2 local scale3d = true local font = "default-bold" local text = getElementData(localPlayer, "ACL") if not text or text == "" then return end dxDrawText ( text, scx, scy, scx, scy, tocolor ( r, g, b, alpha ), scale, font, "center", "center",true,true,true,true) local rem, asd, asd2 = getTimerDetails(InterTimer) local p = rem / 500 if not val1 or not val2 then return end local v1,v2,v3 = interpolateBetween(val1, 0,0, val2, 0,0, p, "Linear") local MyScale = ( ( v1 / 100 ) * 1.3 ) /( ( 1360 / x ) * ( 768 / y ) ) if dist <= 10 then if not getKeyBoundToFunction(ChallengePlayer) then bindKey("H", "down", ChallengePlayer, v) end local scx2, scy2 = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1, -50, true ) local alpha2 = 255 dxDrawText ( "#66ffaaPress #ffffffH #66ffaaTo Challenge", scx2, scy2, scx2, scy2, tocolor ( r, g, b, alpha2 ), MyScale * 1.5, font, "center", "center",false,false,false,true ) else if getKeyBoundToFunction(ChallengePlayer) then unbindKey("H","down",ChallengePlayer) end end else alpha = 0 end else alpha = 0 end end end end ) Server-Side addEventHandler( 'onPlayerLogin', root, function ( ) local account = getPlayerAccount( source ) if account and not isGuestAccount( account ) then local accountName = getAccountName( account ); if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Owner" ) ) then setElementData(source, "ACL", "Owner") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "ClanMananger" ) ) then setElementData(source, "ACL", "Clan-Mananger") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then setElementData(source, "ACL", "Admin") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerador" ) ) then setElementData(source, "ACL", "SuperModerador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderador" ) ) then setElementData(source, "ACL", "Moderador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Miembro" ) ) then setElementData(source, "ACL", "Miembro") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "MiembroTrial" ) ) then setElementData(source, "ACL", "MiembroTrial") end end end ) addEventHandler( 'onPlayerLogout', root, function ( ) local acl = getElementData(source, "ACL") if acl then removeElementData(source,"ACL") end end) It should work.
ZL|LuCaS Posted June 4, 2014 Posted June 4, 2014 Please help!!! this works perfectly for me findRotation return nil ? test code Client-Side addEventHandler ( "onClientRender", getRootElement ( ), function ( ) local PlayerX, PlayerY, PlayerZ = getElementPosition ( getLocalPlayer ( ) ) for i, v in ipairs ( getElementsByType("player") ) do if v == getLocalPlayer() then else local PedX, PedY, PedZ = getElementPosition ( v ) local dist = getDistanceBetweenPoints3D ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ ) local PX, PY, PZ = getElementPosition ( getLocalPlayer ( ) ) local PeX, PeY, PeZ = getElementPosition(v) local Rot = findRotation(PeX, PeY, PX, PY) if dist <= 40 then local scx, scy = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1.2, -50, true ) if isLineOfSightClear ( PlayerX, PlayerY, PlayerZ, PedX, PedY, PedZ, true, false, false, false ) and scx and scy then local alpha = 200 local r = 0 local g = 150 local b = 200 local scale = 2 local scale3d = true local font = "default-bold" local text = getElementData(localPlayer, "ACL") or "" dxDrawText ( text, scx, scy, scx, scy, tocolor ( r, g, b, alpha ), scale, font, "center", "center",true,true,true,true) local rem, asd, asd2 = getTimerDetails(InterTimer) local p = rem / 500 if not val1 or not val2 then return end local v1,v2,v3 = interpolateBetween(val1, 0,0, val2, 0,0, p, "Linear") local MyScale = ( ( v1 / 100 ) * 1.3 ) /( ( 1360 / x ) * ( 768 / y ) ) if dist <= 10 then if not getKeyBoundToFunction(ChallengePlayer) then bindKey("H", "down", ChallengePlayer, v) end local scx2, scy2 = getScreenFromWorldPosition ( PedX, PedY, PedZ + 1, -50, true ) local alpha2 = 255 dxDrawText ( "#66ffaaPress #ffffffH #66ffaaTo Challenge", scx2, scy2, scx2, scy2, tocolor ( r, g, b, alpha2 ), MyScale * 1.5, font, "center", "center",false,false,false,true ) else if getKeyBoundToFunction(ChallengePlayer) then unbindKey("H","down",ChallengePlayer) end end else alpha = 0 end else alpha = 0 end end end end ) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end Server-Side addEventHandler( 'onPlayerLogin', root, function ( ) local account = getPlayerAccount( source ) if account and not isGuestAccount( account ) then local accountName = getAccountName( account ); if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Owner" ) ) then setElementData(source, "ACL", "Owner") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "ClanMananger" ) ) then setElementData(source, "ACL", "Clan-Mananger") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then setElementData(source, "ACL", "Admin") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerador" ) ) then setElementData(source, "ACL", "SuperModerador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderador" ) ) then setElementData(source, "ACL", "Moderador") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Miembro" ) ) then setElementData(source, "ACL", "Miembro") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "MiembroTrial" ) ) then setElementData(source, "ACL", "MiembroTrial") end end end ) addEventHandler( 'onPlayerLogout', root, function ( ) local acl = getElementData(source, "ACL") if acl then removeElementData(source,"ACL") end end)
MisterQuestions Posted June 4, 2014 Author Posted June 4, 2014 I think it have a bug...It just appears me "Owner", And the text is on the nick e.e How to fix it?
-.Paradox.- Posted June 5, 2014 Posted June 5, 2014 I think it have a bug...It just appears me "Owner", And the text is on the nick e.e How to fix it? Just do some funky maths to the ScreenWorldPosition. Or mess around with them, I suggest to use offset
MisterQuestions Posted June 5, 2014 Author Posted June 5, 2014 but...another problem, it show´s me on the nick, "Owner" (Myrank) on all players, and i ask to other players (vips, team-manangers), the say that, they see just their rank, and when spectate, dont show nothing.
MisterQuestions Posted June 5, 2014 Author Posted June 5, 2014 it show´s me on the nick, "Owner" (Myrank) on all players, and i ask to other players (vips, team-manangers), the say that, they see just their rank, and when spectate, dont show nothing. what to do?
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