Jump to content

Zsoltisz

Members
  • Posts

    43
  • Joined

  • Last visited

Posts posted by Zsoltisz

  1. Oookay. It's still working. But i got some problem. Please help me.

    Code:
     

    function asd (message,level,file,line)
        if exports.StarMTA_core:Fejleszto(localPlayer) and level == 1 then
    	outputChatBox("#7CC576[StarMTA-Debugscript]: #FF3333ERROR:#FFFFFF"..message.." (#FFA500"..line.."#FFFFFF)",255,255,255,true)
       	end
    end
    addEventHandler ("onClientDebugMessage",getRootElement(),asd)

    Debugscript: ERROR:StarMTA_debugscript\client.lua:3 attempt to concatenate local 'line' (nil value)

  2. I try this but it's dont working. What's the prob?

    addEventHandler ("onClientDebugMessage",getRootElement(),
    function(message,level,file,line)
        if exports.StarMTA_core:Fejleszto(thePlayer) then
      outputChatBox (message)
       	end
    end)

    I just type for outputChatBox because i want to test first.
     

  3. Hello guys. Can I change the debugscript colors? :D It's just an idea. I see in video and i see the debugscript is create with dxDrawText. How can i do it?

  4. Hello guys I got error in this script. please help me.

    ERROR:names/nametags.lua:75:attempt to perform arithmetic on local "sy" (a nil value)
     

    local myfont = ""
    local nametags = { }
    local nevekbe = false
    -- settings
    local _max_distance = 300 
    
    local _adminszoli_tavolsag = 20
    local _adminszoli_textsize = 1.3
    
    local _min_distance = 7.5
    local _alpha_distance = 20
    local _nametag_alpha = 170
    local _bar_alpha = 300
    local _scale = 0.2
    local _nametag_textsize = 1.5
    local _chatbubble_size = 15
    local _bar_width = 40
    local _bar_height = 6
    local _bar_border = 1.2
    
    local _, screenY = guiGetScreenSize( )
    real_scale = screenY / ( _scale * 800 ) 
    local _alpha_distance_diff = _max_distance - _alpha_distance
    local localPlayer = getLocalPlayer( )
    
    addEventHandler( 'onClientRender', root, 
    	function( )
    		-- get the camera position of the local player
    			local cx, cy, cz = getCameraMatrix( )
    			local dimension = getElementDimension( localPlayer )
    			local interior = getElementInterior( localPlayer )
    			
    			-- loop through all players
    			for player, chaticon in pairs( nametags ) do
    				if (getElementDimension( player ) == dimension and getElementInterior( player ) == interior and isElementOnScreen( player )) then
    					local px, py, pz = getElementPosition( player )
    					local distance = getDistanceBetweenPoints3D( px, py, pz, cx, cy, cz )
    					if distance <= _adminszoli_tavolsag then
    						local dz = 1 + 2 * math.min( 1, distance / _min_distance ) * _scale
    						if isPedDucked( player ) then
    							dz = dz / 2
    						end
    						pz = pz + dz
    						local sx, sy = getScreenFromWorldPosition( px, py, pz )
    						if sx and sy then
    							local cx = sx
    							
    							distance = math.max( distance, _min_distance )
    							local scale = 1
    							
    							local alpha = ( ( distance - _alpha_distance ) / _alpha_distance_diff )
    							local bar_alpha = ( ( alpha < 0 ) and _bar_alpha or _bar_alpha - (alpha * _bar_alpha) ) * ( getElementData( localPlayer, "collisionless" ) and 1 or getElementAlpha( player ) / 255 )
    							if bar_alpha > 0 then
    								end
    								local nametag_alpha = 1000
    								end
    								local jatekosid = getElementData ( player, "playerid" )
    								local adminduty = getElementData ( player, "adminduty" )
    								local adminrang = exports.StarMTA_core:AdminRang( player )
    								local alpha = getElementAlpha(player) or 0
    									if (adminduty == 0 and getElementAlpha(player, 255)) then
    										local jatekosid = getElementData ( player, "playerid" )
    										dxDrawText(getPlayerNametagText( player ).." #FFFFFF("..jatekosid..")", sx, sy+75, sx, sy+75, tocolor( 255, 255, 255, 255 ), 1.5, 'arial', 'center', 'bottom',false,false,false,true )
    									end
    								if (exports.StarMTA_core:Tulajdonos(player) and adminduty == 1 and alpha == 255) then
    								local jatekosid = getElementData ( player, "playerid" )
    								local adminduty = getElementData ( player, "adminduty" )
    								local adminrang = exports.StarMTA_core:AdminRang( player )								
    									dxDrawText("#FFFFFF"..getPlayerNametagText( player ).." #FF3333(#"..adminrang..") #FFFFFF("..jatekosid..")", sx, sy+75, sx, sy+75, tocolor( 0, 240, 255, 255), 1.7, 'arial', 'center', 'bottom',false,false,false,true )
    								elseif (exports.StarMTA_core:Fejleszto(player) and adminduty == 1 and alpha == 255) then
    									dxDrawText("#FFFFFF"..getPlayerNametagText( player ).." #32B3EF<"..adminrang.."/> #FFFFFF("..jatekosid..")", sx, sy, sx, sy+75, tocolor( 0, 240, 255, 255 ), 1.7, 'arial', 'center', 'bottom',false,false,false,true )
    								elseif (exports.StarMTA_core:Rendszergazda(player) and adminduty == 1 and alpha == 255) then
    									dxDrawText("#FFFFFF"..getPlayerNametagText( player ).." #ec9d9d("..adminrang..") #FFFFFF("..jatekosid..")", sx, sy, sx, sy+75, tocolor( 0, 240, 255, 255 ), 1.7, 'arial', 'center', 'bottom',false,false,false,true )
    								elseif (exports.StarMTA_core:SzuperAdmin(player) and adminduty == 1 and alpha == 255) then
    									dxDrawText("#FFFFFF"..getPlayerNametagText( player ).." #9c00ff("..adminrang..") #FFFFFF("..jatekosid..")", sx, sy, sx, sy+75, tocolor( 0, 240, 255, 255 ), 1.7, 'arial', 'center', 'bottom',false,false,false,true )
    								elseif (exports.StarMTA_core:FoAdmin(player) and adminduty == 1 and alpha == 255) then
    									dxDrawText("#FFFFFF"..getPlayerNametagText( player ).." #ffb32f("..adminrang..") #FFFFFF("..jatekosid..")", sx, sy, sx, sy+75, tocolor( 0, 240, 255, 255 ), 1.7, 'arial', 'center', 'bottom',false,false,false,true )
    								elseif (exports.StarMTA_core:EgyesAdmin(player) and adminduty == 1 and alpha == 255) then
    									dxDrawText("#FFFFFF"..getPlayerNametagText( player ).." #7cc576("..adminrang..") #FFFFFF("..jatekosid..")", sx, sy, sx, sy+75, tocolor( 0, 240, 255, 255 ), 1.7, 'arial', 'center', 'bottom',false,false,false,true )
    							end
    						end
    					end
    				end
    			end
    )
    
    addEventHandler( 'onClientResourceStart', getResourceRootElement( ),
    	function( )
    		for _, player in pairs( getElementsByType( 'player' ) ) do
    			if player ~= localPlayer then
    				-- hide the default nametag
    				setPlayerNametagShowing( player, false )
    				
    				if isElementStreamedIn( player ) then
    					-- save the player data
    					nametags[ player ] = false
    				end
    			end
    		end
    	end
    )
    
    addEventHandler( 'onClientResourceStop', getResourceRootElement( ),
    	function( )
    		-- handle stopping this resource
    		for player in pairs( nametags ) do
    			-- restore the nametag
    			setPlayerNametagShowing( player, true )
    			
    			-- remove saved data
    			nametags[ player ] = nil
    		end
    	end
    )
    
    addEventHandler ( 'onClientPlayerJoin', root,
    	function( )
    		-- hide the nametag
    		setPlayerNametagShowing( source, false )
    	end
    )
    
    addEventHandler ( 'onClientElementStreamIn', root,
    	function( )
    		if source ~= localPlayer and getElementType( source ) == "player" then
    			-- save the player data
    			nametags[ source ] = false
    			
    			triggerServerEvent( "nametags:chatbubble", source )
    		end
    	end
    )
    
    addEventHandler ( 'onClientElementStreamOut', root,
    	function( )
    		if nametags[ source ] then
    			-- cleanup
    			nametags[ source ] = nil
    		end
    	end
    )
    
    addEventHandler ( 'onClientPlayerQuit', root,
    	function( )
    		if nametags[ source ] then
    			-- cleanup
    			nametags[ source ] = nil
    		end
    	end
    )
    
    
    --
    
    local oldConsoleState = false
    local oldInputState = false
    
    local tag = dxCreateTexture("Duty/Tulajdonos_Duty.png")
    local tag2 = dxCreateTexture("Duty/Fejleszto_Duty.png")
    local tag3 = dxCreateTexture("Duty/Rendszergazda_Duty.png")
    local tag4 = dxCreateTexture("Duty/SzuperAdmin_Duty.png")
    local tag5 = dxCreateTexture("Duty/FoAdmin_Duty.png")
    local tag6 = dxCreateTexture("Duty/Admin_Duty.png")
    
    
    function Fejleszto_Duty()
        local players = getElementsByType("player")
        for i = 1 , #players do
            local adminduty = getElementData(players[i], "adminduty") or 0
            local alpha = getElementAlpha(players[i]) or 0
            if tonumber(adminduty) == 1 and alpha == 255 then 
                if players[i] ~= localPlayer then
                    if exports.StarMTA_core:Tulajdonos(players[i]) then 
                        dxDrawImageOnElement(players[i],tag)
                    elseif exports.StarMTA_core:Fejleszto(players[i]) then 
                        dxDrawImageOnElement(players[i],tag2)
    				elseif exports.StarMTA_core:Rendszergazda(players[i]) then
    					dxDrawImageOnElement(players[i],tag3)
    				elseif exports.StarMTA_core:SzuperAdmin(players[i]) then
    					dxDrawImageOnElement(players[i],tag4)
    				elseif exports.StarMTA_core:FoAdmin(players[i]) then
    					dxDrawImageOnElement(players[i],tag5)
    				elseif exports.StarMTA_core:EgyesAdmin(players[i]) then
    					dxDrawImageOnElement(players[i],tag6)
                    end 
                end 
            end 
        end
    end
    addEventHandler("onClientRender", root, Fejleszto_Duty)
      
    
    function dxDrawImageOnElement(TheElement,Image,distance,height,width,R,G,B,alpha) 
        local x, y, z = getElementPosition(TheElement)
        local x2, y2, z2 = getElementPosition(localPlayer)
        local distance = distance or 20
        local height = height or 1
        local width = width or 1
        local checkBuildings = checkBuildings or true
        local checkVehicles = checkVehicles or false
        local checkPeds = checkPeds or false
        local checkObjects = checkObjects or true
        local checkDummies = checkDummies or true
        local seeThroughStuff = seeThroughStuff or false
        local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
        local ignoredElement = ignoredElement or nil
        if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
            local sx, sy = getScreenFromWorldPosition(x, y, z+height)
            if(sx) and (sy) then
                local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
                if(distanceBetweenPoints < distance) then
                   dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/distance), tocolor(R or 255, G or 255, B or 255, alpha or 255))
                end
            end
        end
    end

     

  5. Sorry for i type again :D But i see my logo too again but i added this code. Here is the full code:

    function Fejleszto_Duty()
    local tag = dxCreateTexture("Duty/Fejleszto_Duty.png")
    		local players = getElementsByType("player")
    		for _,player in pairs(getElementsByType'player')do
    			local adminduty = getElementData (player, "adminduty" )
    			if (exports.StarMTA_core:Fejleszto(player) and adminduty == 1 and getElementAlpha(player) == 255 ) then
    				dxDrawImageOnElement(player,tag,20,1) -- adjust 2.3 to how high you want the image ofer the player
    			if players[_] ~= localPlayer then
       
    			end
    			end
    	end
    end
    addEventHandler("onClientPreRender", root, Fejleszto_Duty)
    
    function Tulajdonos_Duty()
    	local tag2 = dxCreateTexture("Duty/Tulajdonos_Duty.png")
    	local players = getElementsByType("player")
    		for _,player in pairs(getElementsByType'player')do
    			local adminduty = getElementData ( player, "adminduty" )
    			if (exports.StarMTA_core:Tulajdonos(player) and adminduty == 1 and getElementAlpha(player) == 255 ) then
    				dxDrawImageOnElement(player,tag2,20,1) -- adjust 2.3 to how high you want the image ofer the player
    			if players[_] ~= localPlayer then
       
    			end
    			end
    		end
    end
    addEventHandler("onClientPreRender", root, Tulajdonos_Duty)
    
    
        function dxDrawImageOnElement(TheElement,Image,distance,height,width,R,G,B,alpha)
        				local x, y, z = getElementPosition(TheElement)
        				local x2, y2, z2 = getElementPosition(localPlayer)
        				local distance = distance or 20
        				local height = height or 1
        				local width = width or 1
                                        local checkBuildings = checkBuildings or true
                                        local checkVehicles = checkVehicles or false
                                        local checkPeds = checkPeds or false
                                        local checkObjects = checkObjects or true
                                        local checkDummies = checkDummies or true
                                        local seeThroughStuff = seeThroughStuff or false
                                        local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
                                        local ignoredElement = ignoredElement or nil
        				if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
        					local sx, sy = getScreenFromWorldPosition(x, y, z+height)
        					if(sx) and (sy) then
        						local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
        						if(distanceBetweenPoints < distance) then
        							dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/distance), tocolor(R or 255, G or 255, B or 255, alpha or 255))
        						end
        					end
        			end
        	end
    

     

  6. Hi guys. I made this script but i go in adminduty i don't the name, but when i go out in adminduty i see the names. What the prob?
     

    local nametag_alpha = 1000
    local jatekosid = getElementData ( player, "playerid" )
    local adminduty = getElementData ( player, "adminduty" )
    if adminduty == 0 then
    dxDrawText(getPlayerNametagText( player ).." #7cc576("..jatekosid..")", sx, sy+10, sx, sy+10, tocolor( 255, 255, 255, nametag_alpha ), scale * _adminszoli_textsize, 'default', 'center', 'bottom',false,false,false,true )
    elseif exports.StarMTA_core:Fejleszto(thePlayer) then
    local adminrang = exports.StarMTA_core:AdminRang( player )
    dxDrawText("#FFFFFF"..getPlayerNametagText( player ).." #32C8FF<"..adminrang.."/>", sx, sy+10, sx, sy+10, tocolor( 0, 240, 255, nametag_alpha ), scale * _adminszoli_textsize, 'default', 'center', 'bottom',false,false,false,true )
    end
    elseif exports.StarMTA_core:Tulajdonos(thePlayer) then
    local adminrang = exports.StarMTA_core:AdminRang(player)
    dxDrawText("#FFFFFF"..getPlayerNametagText( player ).." #598ed7(#"..adminrang..")", sx, sy+10, sx, sy+10, tocolor( 0, 240, 255, nametag_alpha ), scale * _adminszoli_textsize, 'default', 'center', 'bottom',false,false,false,true )

     

×
×
  • Create New...