Jump to content

Need little help


-.Paradox.-

Recommended Posts

Posted

Hello, i made a script that if player is an admin or mod or super mod then draw an image in his head but i tried it and it wont work here is the script :| thanks for help

function nameImage() 
    if thePlayer == localPlayer then  
        if ( hasObjectPermissionTo ( getThisResource (), "function.kickPlayer", true ) ) then 
            dxDrawImage ( X - 33.5+8*i, Y - 46, 10, 10, 'star.png', 0, 0, 0 ) 
        end 
    end 
end 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

hasObjectPermissionTo is a server side function, and your script is client side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

Ok gonna try, the code has no errors?

And if i want to set another image for default player what i should use in hasObjectinACL?

Edited by Guest

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

'thePlayer' isn't defined anywhere.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Can you fix it please :|

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

As I said, you mixed server side with client side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

not that you said that the player isnt defined anywhere what i suppose to do

and its not working :| no errors in debug or servr log

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
if thePlayer == localPlayer then 

That's not required.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

And what i should use?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

1: Remove that line.

2: Set element data on login, with the returned value of hasObjectPermissionTo ( server side ).

3: Use getElementData client side to get that value instead of using hasObjectPermissionTo ( since it doesn't work client side ).

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I did already in another topic here is the code it wasnt working

addEventHandler("onPlayerLogin", root, 
function ( thePlayer ) 
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    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 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        setElementData ( source, "Classicon",":experience\Class\Classicon_player.png" ) 
    end 
) 
  
addEventHandler ( "onPlayerLogin", root, 
    function ( _, acc ) 
        local accName = getAccountName ( acc ) 
        if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Admin" ) ) then 
            setElementData ( source, "Classicon", ":experience\Class\Classicon_admin.png" ) 
        elseif isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Moderator" ) ) then 
            setElementData ( source, "Classicon", ":experience\Class\Classicon_mod.png" ) 
        else 
            setElementData ( source, "Classicon", ":experience\Class\Classicon_player.png" ) 
        end 
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

And if i want to draw the classicons image in head of player what i must use? thanks for helping

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

like that?

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)   

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Why don't you try it?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I did but they still dont appear :|

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

I remove the client side and i add a dxdrawimage line to nametag resource

here is the line

                    local imageSize = dxGetFontHeight ( textscale*NAMETAG_TEXTSIZE, srfont ) 
                        if getElementData(player, "Classicon") and fileExists ( ":Class/class/classicon_"..getElementData(player, "Classicon")..".png" ) then 
                        dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - imageSize - 1*scale, sy - imageSize, imageSize, imageSize, ":Class/class/classicon_"..getElementData(player, "Classicon")..".png" ) 
                        end 

And here is the nametag script

srfont = dxCreateFont("DFHEIMDU_id.ttf",16) 
  
g_Root = getRootElement() 
g_ResRoot = getResourceRootElement(getThisResource()) 
g_Players = getElementsByType('player') 
g_Me = getLocalPlayer() 
  
nametag = {} 
local nametags = {} 
local g_screenX,g_screenY = guiGetScreenSize() 
local bHideNametags = false 
  
local NAMETAG_SCALE = 0.3 --Overall adjustment of the nametag, use this to resize but constrain proportions 
local NAMETAG_ALPHA_DISTANCE = 50 --Distance to start fading out 
local NAMETAG_DISTANCE = 100 --Distance until we're gone 
local NAMETAG_ALPHA = 255 --The overall alpha level of the nametag 
--The following arent actual pixel measurements, they're just proportional constraints 
local NAMETAG_TEXT_BAR_SPACE = 1 
local NAMETAG_WIDTH = 50 
local NAMETAG_HEIGHT = 5 
local NAMETAG_TEXTSIZE = 0.3 
local NAMETAG_OUTLINE_THICKNESS = 1.2 
  
  
-- 
local NAMETAG_ALPHA_DIFF = NAMETAG_DISTANCE - NAMETAG_ALPHA_DISTANCE 
NAMETAG_SCALE = 1/NAMETAG_SCALE * 800 / g_screenY 
  
-- Ensure the name tag doesn't get too big 
local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } 
-- Ensure the text doesn't get too small/unreadable 
local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } 
-- Make the text a bit brighter and fade more gradually 
local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } 
  
setPedTargetingMarkerEnabled ( false )  
  
function nametag.create ( player ) 
    nametags[player] = true 
end 
  
function nametag.destroy ( player ) 
    nametags[player] = nil 
end 
  
addEventHandler ( "onClientPreRender", g_Root, 
    function() 
        if getElementData(getLocalPlayer(), "state.hud") == "disabled" then 
        return 
        end 
        -- Hideous quick fix -- 
        for i,player in ipairs(g_Players) do 
            if isElement(player) then 
                if player ~= g_Me then 
                    setPlayerNametagShowing ( player, false ) 
                    if not nametags[player] then 
                        nametag.create ( player ) 
                    end 
                end 
            end 
        end 
        if bHideNametags then 
            return 
        end 
        local x,y,z = getCameraMatrix() 
    
        for player in pairs(nametags) do 
            while true do 
                if not isElement(player) then break end 
                if getElementDimension(player) ~= getElementDimension(g_Me) then break end 
                local px,py,pz = getElementPosition ( player ) 
                if not isLineOfSightClear(x, y, z, px, py, pz, true, false, false, true, false, true) then break end 
                local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) 
                if pdistance <= NAMETAG_DISTANCE then 
                    --Get screenposition 
                    local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) 
                    if not sx or not sy then break end 
                    --Calculate our components 
                    local scale = 1/(NAMETAG_SCALE * (pdistance / NAMETAG_DISTANCE)) 
                    local alpha = ((pdistance - NAMETAG_ALPHA_DISTANCE) / NAMETAG_ALPHA_DIFF) 
                    alpha = (alpha < 0) and NAMETAG_ALPHA or NAMETAG_ALPHA-(alpha*NAMETAG_ALPHA) 
                    scale = math.evalCurve(maxScaleCurve,scale) 
                    local textscale = math.evalCurve(textScaleCurve,scale) 
                    local textalpha = math.evalCurve(textAlphaCurve,alpha) 
                    local outlineThickness = NAMETAG_OUTLINE_THICKNESS*(scale) 
                    --Draw our text 
                    local playerName = getPlayerName(player):gsub("#%x%x%x%x%x%x","") 
                    local r,g,b = getPlayerNametagColor(player) 
                    local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 
                    local w = dxGetTextWidth(playerName, textscale * NAMETAG_TEXTSIZE, srfont) / 2 
                    local myR = getElementData(localPlayer, "reputation.reputation") 
                    local playerR = getElementData(player, "reputation.reputation") 
                     
                    local drawX = sx - NAMETAG_WIDTH*scale/2 
                    drawY = sy + offset 
                    local width,height =  NAMETAG_WIDTH*scale, NAMETAG_HEIGHT*scale 
                    dxDrawText ( playerName, sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false, false, false, true, true ) 
                        if myR and playerR then 
                            if getElementData(localPlayer, "reputation.criminal") == false and getElementData(player, "reputation.criminal") == false then 
                            rr, rg, rb = 158, 210, 229 
                            elseif getElementData(localPlayer, "reputation.criminal") == true and getElementData(player, "reputation.criminal") == false then 
                            rr, rg, rb = 217, 25, 31 
                            elseif getElementData(localPlayer, "reputation.criminal") == false and getElementData(player, "reputation.criminal") == true then 
                            rr, rg, rb = 217, 25, 31 
                            elseif getElementData(localPlayer, "reputation.criminal") == true and getElementData(player, "reputation.criminal") == true then 
                            rr, rg, rb = 246, 231, 89 
                            end 
                        else 
                        rr, rg, rb = r, g, b 
                        end 
                    dxDrawText ( playerName, sx, sy - offset, sx, sy - offset, tocolor(rr,rg,rb,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false, false, false, true, true )          
                    nameWidth = dxGetTextWidth ( playerName, textscale*NAMETAG_TEXTSIZE, srfont ) 
                    teamWidth = nameWidth 
                    local team = getPlayerTeam(player) 
                        if team then 
                        dxDrawText ( "["..getTeamName(team).."]", sx, sy - offset + 6*scale, sx, sy - offset + 6*scale, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE*0.75, srfont, "center", "bottom", false, false, false, true, true ) 
                        dxDrawText ( "["..getTeamName(team).."]", sx, sy - offset + 6*scale, sx, sy - offset + 6*scale, tocolor(rr,rg,rb,255), textscale*NAMETAG_TEXTSIZE*0.75, srfont, "center", "bottom", false, false, false, true, true ) 
                        teamWidth = dxGetTextWidth ( "["..getTeamName(team).."]", textscale*NAMETAG_TEXTSIZE*0.75, srfont ) 
                        end 
                    local imageSize = dxGetFontHeight ( textscale*NAMETAG_TEXTSIZE, srfont ) 
                        if getElementData(player, "Classicon") and fileExists ( ":Class/class/classicon_"..getElementData(player, "Classicon")..".png" ) then 
                        dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - imageSize - 1*scale, sy - imageSize, imageSize, imageSize, ":Class/class/classicon_"..getElementData(player, "Classicon")..".png" ) 
                        end 
                        if getElementData(player, "Classicon") and fileExists ( ":Class/class/classicon_"..getElementData(player, "Classicon")..".png" ) then 
                        dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 1*scale, sy - imageSize, imageSize, imageSize, ":Class/class/classicon_"..getElementData(player, "Classicon")..".png" ) 
                        end  
                end 
                break 
            end 
        end 
    end 
) 
  
  
---------------THE FOLLOWING IS THE MANAGEMENT OF NAMETAGS----------------- 
addEventHandler('onClientResourceStart', g_Root, 
    function() 
        for i,player in ipairs(getElementsByType"player") do 
            if player ~= g_Me then 
                nametag.create ( player ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onClientPlayerJoin", g_Root, 
    function() 
        if source == g_Me then return end 
        setPlayerNametagShowing ( source, false ) 
        nametag.create ( source ) 
    end 
) 
  
addEventHandler ( "onClientPlayerQuit", g_Root, 
    function() 
        nametag.destroy ( source ) 
    end 
) 
  
-- Math functions 
function math.lerp(from,to,alpha) 
    return from + (to-from) * alpha 
end 
  
-- curve is { {x1, y1}, {x2, y2}, {x3, y3} ... } 
function math.evalCurve( curve, input ) 
    -- First value 
    if input[1][1] then 
        return curve[1][2] 
    end 
    -- Interp value 
    for idx=2,#curve do 
        if input[idx][1] then 
            local x1 = curve[idx-1][1] 
            local y1 = curve[idx-1][2] 
            local x2 = curve[idx][1] 
            local y2 = curve[idx][2] 
            -- Find pos between input points 
            local alpha = (input - x1)/(x2 - x1); 
            -- Map to output points 
            return math.lerp(y1,y2,alpha) 
        end 
    end 
    -- Last value 
    return curve[#curve][2] 
end 
  
function dxDrawColorText(str, ax, ay, bx, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) 
  local pat = "(.-)#(%x%x%x%x%x%x)" 
  local s, e, cap, col = str:find(pat, 1) 
  local last = 1 
  while s do 
    if s ~= 1 or cap ~= "" then  
      local w = dxGetTextWidth(cap, scale, font) 
      dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) 
      ax = ax + w 
      color = tocolor(tonumber("0x"..string.sub(col, 1, 2)), tonumber("0x"..string.sub(col, 3, 4)), tonumber("0x"..string.sub(col, 5, 6)), 255) 
    end 
    last = e+1 
    s, e, cap, col = str:find(pat, last) 
  end 
  if last <= #str then 
    cap = str:sub(last) 
    local w = dxGetTextWidth(cap, scale, font) 
    dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) 
  end 
end  
  

line 121

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
srfont = dxCreateFont("DFHEIMDU_id.ttf",16) 
  
g_Root = getRootElement() 
g_ResRoot = getResourceRootElement(getThisResource()) 
g_Players = getElementsByType('player') 
g_Me = getLocalPlayer() 
  
nametag = {} 
local nametags = {} 
local g_screenX,g_screenY = guiGetScreenSize() 
local bHideNametags = false 
  
local NAMETAG_SCALE = 0.3 --Overall adjustment of the nametag, use this to resize but constrain proportions 
local NAMETAG_ALPHA_DISTANCE = 50 --Distance to start fading out 
local NAMETAG_DISTANCE = 100 --Distance until we're gone 
local NAMETAG_ALPHA = 255 --The overall alpha level of the nametag 
--The following arent actual pixel measurements, they're just proportional constraints 
local NAMETAG_TEXT_BAR_SPACE = 1 
local NAMETAG_WIDTH = 50 
local NAMETAG_HEIGHT = 5 
local NAMETAG_TEXTSIZE = 0.3 
local NAMETAG_OUTLINE_THICKNESS = 1.2 
  
  
-- 
local NAMETAG_ALPHA_DIFF = NAMETAG_DISTANCE - NAMETAG_ALPHA_DISTANCE 
NAMETAG_SCALE = 1/NAMETAG_SCALE * 800 / g_screenY 
  
-- Ensure the name tag doesn't get too big 
local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } 
-- Ensure the text doesn't get too small/unreadable 
local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } 
-- Make the text a bit brighter and fade more gradually 
local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } 
  
setPedTargetingMarkerEnabled ( false ) 
  
function nametag.create ( player ) 
    nametags[player] = true 
end 
  
function nametag.destroy ( player ) 
    nametags[player] = nil 
end 
  
addEventHandler ( "onClientPreRender", g_Root, 
    function() 
        if getElementData(getLocalPlayer(), "state.hud") == "disabled" then 
        return 
        end 
        -- Hideous quick fix -- 
        for i,player in ipairs(g_Players) do 
            if isElement(player) then 
                if player ~= g_Me then 
                    setPlayerNametagShowing ( player, false ) 
                    if not nametags[player] then 
                        nametag.create ( player ) 
                    end 
                end 
            end 
        end 
        if bHideNametags then 
            return 
        end 
        local x,y,z = getCameraMatrix() 
    
        for player in pairs(nametags) do 
            while true do 
                if not isElement(player) then break end 
                if getElementDimension(player) ~= getElementDimension(g_Me) then break end 
                local px,py,pz = getElementPosition ( player ) 
                if not isLineOfSightClear(x, y, z, px, py, pz, true, false, false, true, false, true) then break end 
                local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) 
                if pdistance <= NAMETAG_DISTANCE then 
                    --Get screenposition 
                    local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) 
                    if not sx or not sy then break end 
                    --Calculate our components 
                    local scale = 1/(NAMETAG_SCALE * (pdistance / NAMETAG_DISTANCE)) 
                    local alpha = ((pdistance - NAMETAG_ALPHA_DISTANCE) / NAMETAG_ALPHA_DIFF) 
                    alpha = (alpha < 0) and NAMETAG_ALPHA or NAMETAG_ALPHA-(alpha*NAMETAG_ALPHA) 
                    scale = math.evalCurve(maxScaleCurve,scale) 
                    local textscale = math.evalCurve(textScaleCurve,scale) 
                    local textalpha = math.evalCurve(textAlphaCurve,alpha) 
                    local outlineThickness = NAMETAG_OUTLINE_THICKNESS*(scale) 
                    --Draw our text 
                    local playerName = getPlayerName(player):gsub("#%x%x%x%x%x%x","") 
                    local r,g,b = getPlayerNametagColor(player) 
                    local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 
                    local w = dxGetTextWidth(playerName, textscale * NAMETAG_TEXTSIZE, srfont) / 2 
                    local myR = getElementData(localPlayer, "reputation.reputation") 
                    local playerR = getElementData(player, "reputation.reputation") 
                    
                    local drawX = sx - NAMETAG_WIDTH*scale/2 
                    drawY = sy + offset 
                    local width,height =  NAMETAG_WIDTH*scale, NAMETAG_HEIGHT*scale 
                    dxDrawText ( playerName, sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false, false, false, true, true ) 
                        if myR and playerR then 
                            if getElementData(localPlayer, "reputation.criminal") == false and getElementData(player, "reputation.criminal") == false then 
                            rr, rg, rb = 158, 210, 229 
                            elseif getElementData(localPlayer, "reputation.criminal") == true and getElementData(player, "reputation.criminal") == false then 
                            rr, rg, rb = 217, 25, 31 
                            elseif getElementData(localPlayer, "reputation.criminal") == false and getElementData(player, "reputation.criminal") == true then 
                            rr, rg, rb = 217, 25, 31 
                            elseif getElementData(localPlayer, "reputation.criminal") == true and getElementData(player, "reputation.criminal") == true then 
                            rr, rg, rb = 246, 231, 89 
                            end 
                        else 
                        rr, rg, rb = r, g, b 
                        end 
                    dxDrawText ( playerName, sx, sy - offset, sx, sy - offset, tocolor(rr,rg,rb,255), textscale*NAMETAG_TEXTSIZE, srfont, "center", "bottom", false, false, false, true, true )         
                    nameWidth = dxGetTextWidth ( playerName, textscale*NAMETAG_TEXTSIZE, srfont ) 
                    teamWidth = nameWidth 
                    local team = getPlayerTeam(player) 
                        if team then 
                        dxDrawText ( "["..getTeamName(team).."]", sx, sy - offset + 6*scale, sx, sy - offset + 6*scale, tocolor(0,0,0,255), textscale*NAMETAG_TEXTSIZE*0.75, srfont, "center", "bottom", false, false, false, true, true ) 
                        dxDrawText ( "["..getTeamName(team).."]", sx, sy - offset + 6*scale, sx, sy - offset + 6*scale, tocolor(rr,rg,rb,255), textscale*NAMETAG_TEXTSIZE*0.75, srfont, "center", "bottom", false, false, false, true, true ) 
                        teamWidth = dxGetTextWidth ( "["..getTeamName(team).."]", textscale*NAMETAG_TEXTSIZE*0.75, srfont ) 
                        end 
                    local imageSize = dxGetFontHeight ( textscale*NAMETAG_TEXTSIZE, srfont ) 
                        if fileExists ( getElementData(player, "Classicon") ) then 
                            dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - imageSize - 1*scale, sy - imageSize, imageSize, imageSize, getElementData(player, "Classicon") ) 
                        end 
                        if fileExists ( getElementData(player, "Classicon") ) then 
                        dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 1*scale, sy - imageSize, imageSize, imageSize, getElementData(player, "Classicon") ) 
                        end 
                end 
                break 
            end 
        end 
    end 
) 
  
  
---------------THE FOLLOWING IS THE MANAGEMENT OF NAMETAGS----------------- 
addEventHandler('onClientResourceStart', g_Root, 
    function() 
        for i,player in ipairs(getElementsByType"player") do 
            if player ~= g_Me then 
                nametag.create ( player ) 
            end 
        end 
    end 
) 
  
addEventHandler ( "onClientPlayerJoin", g_Root, 
    function() 
        if source == g_Me then return end 
        setPlayerNametagShowing ( source, false ) 
        nametag.create ( source ) 
    end 
) 
  
addEventHandler ( "onClientPlayerQuit", g_Root, 
    function() 
        nametag.destroy ( source ) 
    end 
) 
  
-- Math functions 
function math.lerp(from,to,alpha) 
    return from + (to-from) * alpha 
end 
  
-- curve is { {x1, y1}, {x2, y2}, {x3, y3} ... } 
function math.evalCurve( curve, input ) 
    -- First value 
    if input[1][1] then 
        return curve[1][2] 
    end 
    -- Interp value 
    for idx=2,#curve do 
        if input[idx][1] then 
            local x1 = curve[idx-1][1] 
            local y1 = curve[idx-1][2] 
            local x2 = curve[idx][1] 
            local y2 = curve[idx][2] 
            -- Find pos between input points 
            local alpha = (input - x1)/(x2 - x1); 
            -- Map to output points 
            return math.lerp(y1,y2,alpha) 
        end 
    end 
    -- Last value 
    return curve[#curve][2] 
end 
  
function dxDrawColorText(str, ax, ay, bx, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) 
  local pat = "(.-)#(%x%x%x%x%x%x)" 
  local s, e, cap, col = str:find(pat, 1) 
  local last = 1 
  while s do 
    if s ~= 1 or cap ~= "" then 
      local w = dxGetTextWidth(cap, scale, font) 
      dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) 
      ax = ax + w 
      color = tocolor(tonumber("0x"..string.sub(col, 1, 2)), tonumber("0x"..string.sub(col, 3, 4)), tonumber("0x"..string.sub(col, 5, 6)), 255) 
    end 
    last = e+1 
    s, e, cap, col = str:find(pat, last) 
  end 
  if last <= #str then 
    cap = str:sub(last) 
    local w = dxGetTextWidth(cap, scale, font) 
    dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) 
  end 
end  
  

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Still invisible

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

No errors in debug and server log too

is there other way to draw the image in player head?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Are you sure that there are no errors? they won't show in the server console, they'll show on the debugscript ( ingame ).

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Yes i checked /debugscript 3

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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