Jump to content

Delete Post.


Recommended Posts

Posted
  
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.)

Posted

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

Posted

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") 

Posted

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) 
  

Posted
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) 
  

It should work.

Posted
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) 
  

Posted
I think it have a bug...It just appears me "Owner", And the text is on the nick e.e How to fix it?

242wio0.jpg

kf049k.jpg

Just do some funky maths to the ScreenWorldPosition.

Or mess around with them, I suggest to use offset

Posted

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.

Posted

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?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...