Jump to content

Recommended Posts

function premiumhud()
    local px,py,pz = getElementPosition(getLocalPlayer()) 
    local x,y,z = getElementPosition(getLocalPlayer()) 
    local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz)
        if distance <= 10 then 
            local sx,sy = getScreenFromWorldPosition ( x, y, z+1.12, 0.05 ) 
            if not sx then return end 
            local scale = 0.01/(0.01 * (distance / 1))
            dxDrawText ( "Premium", sx, sy, sx, sy + 25, tocolor(255,230,100,255), math.min ( 0.07    *(180/distance),1.8), "clear-normal", "center", "bottom", false, false, false ) 
    end 
end
addCommandHandler("premium", premiumhud)

Kiedy wpisuje komendę /premium na czacie, pojawia mi się na chwile napis po czym szybko znika. Chciałbym, aby to pokazywało się do czasu opuszczenia serwera. Oraz chciałbym zrobić to na uprawnienie, czyli osoba która ma wybraną range w pliku ACL może wpisać tą komende. Czekam na szybką pomoc!

Edited by NiuniekTM
Link to comment

Biblioteka 'dx' wymaga renderowania co klatkę, więc dxDrawText musi być umieszczony w evencie onClientRender.

function showPremium()
    local px,py,pz = getElementPosition(getLocalPlayer()) 
    local x,y,z = getElementPosition(getLocalPlayer()) 
    local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz)
        if distance <= 10 then 
            local sx,sy = getScreenFromWorldPosition ( x, y, z+1.12, 0.05 ) 
            if not sx then return end 
            local scale = 0.01/(0.01 * (distance / 1))
			dxDrawText ( "Premium", sx, sy, sx, sy + 25, tocolor(255,230,100,255), math.min ( 0.07    *(180/distance),1.8), "clear-normal", "center", "bottom", false, false, false ) 
    end 
end

function premiumhud()
	addEventHandler("onClientRender", localPlayer, showPremium)
end
addCommandHandler("premium", premiumhud)

 

Link to comment
  • 5 weeks later...

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