Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2017-11-11, 21:31


Szydlo

Stance Works






Wiek: 25
Na forum: 3585 dni
Posty: 343
Nick w MP: Szydlo

Piwa: 4

Respekt: 105,3
Respekt: 105,3

Witam, chcia?bym zrobi? sw?j nametag, i mam taki problem ?e jak to zrobi? wymy?li?em co? takiego: robie dxDrawa, i b?dzie on mia? x,y,z+10. No ale chyba tak nie mo?na. Oraz chcia?bym zrobi? takiego markera w 3D: https://imgur.com/6s8KMhH

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
nagrywki12
Wysłany: 2017-11-11, 21:41


neku^







Wiek: 24
Na forum: 3521 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5

Co do nametag'ow, najlepiej pobra? pozycj? szyji gracza i do tej warto?ci doda? w pozycji Z z 2 albo 3.

Więcej informacji znajdziesz w Wikipedii MTA:

getPedBonePosition

Co do markerow to jest to chyba

Więcej informacji znajdziesz w Wikipedii MTA:

dxDrawMaterialLine3D


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 21:43


Szydlo

Stance Works






Wiek: 25
Na forum: 3585 dni
Posty: 343
Nick w MP: Szydlo

Piwa: 4

Respekt: 105,3
Respekt: 105,3

A nametag mog? za pomoc? dxdraw?

[ Dodano: 2017-11-11, 21:44 ]
Dobra w wiki jest przyk?ad nametagu

Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 21:45


neku^







Wiek: 24
Na forum: 3521 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5

Oczywi?cie ale jako x oraz y dajesz warto?? zwr?cona przez funkcje getPedBonePosition p??niej dajesz getScreenFromWorldPosition i zwr?cona warto?? dajesz do dxDrawText i podnosisz troch? ?eby nametag nie by? w szyji

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 21:47


Szydlo

Stance Works






Wiek: 25
Na forum: 3585 dni
Posty: 343
Nick w MP: Szydlo

Piwa: 4

Respekt: 105,3
Respekt: 105,3

Na wiki jest taki przyk?ad i to jest nametag:


addEventHandler"onClientRender",root,
   function( )
      local pxpypztxtytzdist
      pxpypz getCameraMatrix( )
      for _v in ipairsgetElementsByType 'player' ) do
         txtytz getElementPosition)
         dist math.sqrt( ( px tx ) ^ + ( py ty ) ^ + ( pz tz ) ^ )
         if dist 30.0 then
            if isLineOfSightClearpxpypztxtytztruefalsefalsetruefalsefalsefalse,localPlayer then
               local sxsysz getPedBonePositionv)
               local x,getScreenFromWorldPositionsxsysz 0.3 )
               if x then 
                dxDrawTextgetPlayerName), xyxytocolor(150500), 0.85 + ( 15 dist ) * 0.02"bankgothic" )
               end
            end
         end
      end
   end
)


Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 21:49


neku^







Wiek: 24
Na forum: 3521 dni
Posty: 461
Nick w MP: neku^

Piwa: 1186

Respekt: 320,5
Respekt: 320,5Respekt: 320,5Respekt: 320,5

Nom, czyli to co m?wi?em getPedBonePosition getScreenFromWorldPosition

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 21:57


Szydlo

Stance Works






Wiek: 25
Na forum: 3585 dni
Posty: 343
Nick w MP: Szydlo

Piwa: 4

Respekt: 105,3
Respekt: 105,3

Dobra a jak usun?? ten nametag co daje mta?

[ Dodano: 2017-11-11, 22:01 ]
I ten chcia?bym wykry? kiedy gracz pisze (kiedy ma w??czone T).

Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 22:07


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8


Więcej informacji znajdziesz w Wikipedii MTA:

setPlayerNametagShowing



Więcej informacji znajdziesz w Wikipedii MTA:

isChatBoxInputActive


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 22:11


Szydlo

Stance Works






Wiek: 25
Na forum: 3585 dni
Posty: 343
Nick w MP: Szydlo

Piwa: 4

Respekt: 105,3
Respekt: 105,3

dxDrawMaterialLine3D to chyba nie jest mi si? tak zdaje. Chyba da si? jako? podmieni? tekstur? oryginalnego markera. Co? takiego by?a na Drift Paradise bo mam gamemode.

Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 22:14


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Nie ma czego? takiego jak "podmiana markera", trzeba pisa? w?asny system przy pomocy tego co poda? dbn69,

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 22:15


Szydlo

Stance Works






Wiek: 25
Na forum: 3585 dni
Posty: 343
Nick w MP: Szydlo

Piwa: 4

Respekt: 105,3
Respekt: 105,3

Dobra i mam kolejne problemy. Mam sobie nametag, i gdy si? oddalam od osoby to wtedy nametag si? zwi?ksza, a ja nie chce ?eby si? zwi?ksza?. Kolejny problem jest taki ?e chce mie? tekst zawsze po ?rodku bo gdy mam np nick "Szydlo" to jest po?rodku ale gdy mam nick "[1]Szydlo2" to wtedy ju? nie jest.

[ Dodano: 2017-11-11, 22:16 ]
I mam tutaj taki kod na marker:

-- Отрисовка маркеров

local screenSize Vector2(guiGetScreenSize())

local MARKER_ANIMATION_SPEED 0.008

-- Иконка на земле
local MARKER_ICON_SIZE 6
local MARKER_ANIMATION_SIZE 0.3

local MARKER_TEXT_SIZE 5
local MARKER_TEXT_ANIMATION_SIZE 0.1
local MARKER_TEXT_OFFSET Vector3(002)

local markersToDraw = {}

-- Текст на экране
local screenTextFont
local screenTextBottomOffset 60

-- Маркер, в котором сейчас находится игрок
local currentMarker
local markerKey "g"

local markerTypes = {}
markerTypes.garage = {
    color = {212040},
    icon "assets/garage_icon.png",
    text "assets/garage_text.png",
    string "markers_garage_text"
}

markerTypes.city = {
    color = {212040},
    icon "assets/city_icon.png",
    text "assets/city_text.png",
    string "markers_city_text"
}

markerTypes.showroom = {
    color = {212040},
    icon "assets/showroom_icon.png",
    text "assets/showroom_text.png",
    string "markers_showroom_text"
}

markerTypes.house = {
    color = {212040},
    icon "assets/house_floor.png",
    iconSize 1,
    text "assets/house_icon.png",
    string "markers_house_enter_text"
}

markerTypes.stripclub = {
    color = {212040},
    icon "assets/house_floor.png",
    iconSize 1,
    text "assets/strip_icon.png",
    string "markers_strip_enter_text"
}

markerTypes.race = {
    color = {255255255},
    icon "assets/race_icon.png",
    iconSize 12.5,
    text "assets/race_text.png",
    string "markers_race_enter_text",
    noPaint true
}

markerTypes.tofu = {
    color = {255255255},
    icon "assets/race_icon.png",
    iconSize 12.5,
    string "markers_tofu_text",
    noPaint true
}

markerTypes.exit = {
    color = {212040},
    text "assets/exit_icon.png",
    string "markers_house_exit_text"
}

function getMarkerProperties(type)
    return markerTypes[type]
end

local function dxDrawShadowText(textx1y1x2y2colorscalefontalignXalignY)
    dxDrawText(textx1 1y1x2 1y2tocolor(000150), scalefontalignXalignY)
    dxDrawText(textx1 1y1x2 1y2tocolor(000150), scalefontalignXalignY)
    dxDrawText(textx1y1 1x2y2 1tocolor(000150), scalefontalignXalignY)
    dxDrawText(textx1y1 1x2y2 1tocolor(000150), scalefontalignXalignY)
    dxDrawText(textx1y1x2y2colorscalefontalignXalignY)
end

local function drawScreenText(text)
    text string.format(exports.dpLang:getString(text), string.upper(markerKey))
    local yOffset math.sin(getTickCount() * MARKER_ANIMATION_SPEED) * 5
    -- dxDrawText(
    --     text, 
    --     10, 
    --     10 yOffset, 
    --     screenSize.x, 
    --     screenSize.screenTextBottomOffset yOffset, 
    --     tocolor(000150), 
    --     1, 
    --     screenTextFont, 
    --     "center", 
    --     "bottom"
    -- )
    dxDrawShadowText(
        text, 
        0, 
        yOffset, 
        screenSize.x, 
        screenSize.screenTextBottomOffset yOffset, 
        tocolor(255255255), 
        1, 
        screenTextFont, 
        "center", 
        "bottom"
    )    
end

local function drawMarker(marker)
    local markerType marker:getData("dpMarkers.type")
    local markerProperties markerTypes[markerType]
    if not markerProperties then
        return
    end

    local t getTickCount()

    local color = {
        markerProperties.color[1], 
        markerProperties.color[2], 
        markerProperties.color[3], 
        200 math.sin(MARKER_ANIMATION_SPEED 3) * 35
    }

    -- Текст маркера
    local restrictElement marker:getData("dpMarkers.restrictElement")
    local canEnter false
    if restrictElement then
        if restrictElement == "vehicle" and localPlayer.vehicle then
            canEnter true
        elseif restrictElement == "player" and not localPlayer.vehicle then
            canEnter true
        end
    else
        canEnter true
    end
    if (localPlayer:isWithinMarker(marker) or 
        (localPlayer.vehicle and localPlayer.vehicle:isWithinMarker(marker))) and canEnter
    then
        if not markerProperties.noPaint then
            color = {
                232 math.sin(MARKER_ANIMATION_SPEED) * 23, 
                20 math.sin(MARKER_ANIMATION_SPEED) * 20,
                60 math.sin(MARKER_ANIMATION_SPEED) * 30,
                255
            }
        end
        local markerText marker:getData("dpMarkers.text")
        if not markerText then
            markerText markerProperties.string
        end
        drawScreenText(markerText)
        if currentMarker ~= marker then
            triggerEvent("dpMarkers.enter"marker)
            currentMarker marker
        end
    end    

    local mxmymz getElementPosition(marker)
    -- Иконка на земле
    if markerProperties.icon then
        -- Размеры иконки
        local markerIconSize MARKER_ICON_SIZE
        local animationSize MARKER_ANIMATION_SIZE
        if markerProperties.iconSize then
            markerIconSize markerProperties.iconSize
            animationSize markerIconSize MARKER_ICON_SIZE MARKER_ANIMATION_SIZE
        end
        local iconSize markerIconSize math.sin(MARKER_ANIMATION_SPEED) * animationSize        

        local direction marker:getData("dpMarkers.direction")
        local ox math.cos(direction) * iconSize 2
        local oy =  math.sin(direction) * iconSize 2
        dxDrawMaterialLine3D(
            mx ox,
            my oy,
            mz,
            mx ox,
            my oy,
            mz,
            markerProperties.icon, 
            iconSize,
            tocolor(255255255color[4]),
            mx,
            my,
            mz 1
        )
    end

    if not markerProperties.text then
        return
    end
    local textSize MARKER_TEXT_SIZE
    -- Вертикальная картинка
    local textAnimationOffset math.sin(MARKER_ANIMATION_SPEED) * MARKER_TEXT_ANIMATION_SIZE
    dxDrawMaterialLine3D(
        mx, 
        my,
        mz textSize MARKER_TEXT_OFFSET.textAnimationOffset,
        mx,
        my,
        mz textSize MARKER_TEXT_OFFSET.textAnimationOffset,
        markerProperties.text,
        textSize,
        tocolor(unpack(color))
    )
end

function addMarkerToDraw(marker)
    if isElementStreamedIn(markerthen
        markersToDraw[marker] = true
    end
end

addEventHandler("onClientRender"root, function ()
    if localPlayer:getData("dpCore.state"then
        return
    end
    for marker in pairs(markersToDraw) do
        drawMarker(marker)
    end
end)

addEventHandler("onClientElementStreamIn"root, function ()
    if source:getData("dpMarkers.type"then
        addMarkerToDraw(source)
    end
end)

addEventHandler("onClientElementStreamOut"root, function ()
    if markersToDraw[sourcethen
        markersToDraw[source] = nil
    end
end)

addEventHandler("onClientElementDestroy"root, function ()
    if markersToDraw[sourcethen
        markersToDraw[source] = nil
    end
end)

addEventHandler("onClientResourceStart"resourceRoot, function ()
    for namemarkerProperties in pairs(markerTypes) do
        if markerProperties.icon then
            markerProperties.icon dxCreateTexture(markerProperties.icon"dxt5")
        end
        if markerProperties.text then
            markerProperties.text dxCreateTexture(markerProperties.text"dxt5")
        end
    end

    screenTextFont exports.dpAssets:createFont("Roboto-Regular.ttf"22)
end)

addEventHandler("onClientKey"root, function (keystate)
    if key == markerKey and state then
        if isMTAWindowActive() then
            return false
        end
        if not isElement(currentMarkerthen
            return
        end
        if localPlayer:getData("dpCore.state") or localPlayer:getData("activeUI"then
            return
        end    
        if localPlayer:isWithinMarker(currentMarker) or 
            (localPlayer.vehicle and localPlayer.vehicle:isWithinMarker(currentMarker))
        then
            triggerEvent("dpMarkers.use"currentMarker)
            cancelEvent()
        end        
    end
end)

addEventHandler("onClientMarkerLeave"resourceRoot, function (player)
    if player ~= localPlayer then
        return
    end
    if source == currentMarker then
        currentMarker nil
    end
end)


Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 22:16


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Co do zwi?kszania si?, to poka? kod. Je?li chodzi o d?ugo?? to
Więcej informacji znajdziesz w Wikipedii MTA:

dxGetTextWidth
i wyliczenia z tym lub mo?esz bawi? si? argumentem od dxDrawText.

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 22:17


Szydlo

Stance Works






Wiek: 25
Na forum: 3585 dni
Posty: 343
Nick w MP: Szydlo

Piwa: 4

Respekt: 105,3
Respekt: 105,3

I w tym kodzie jest

onClientMarkerLeave

A przecie? jest to w?asny marker

[ Dodano: 2017-11-11, 22:18 ]
A je?eli chodzi o kod nametaga:

local FMain dxCreateFont"files/font.ttf"20)
local SMain dxCreateFont"files/font.ttf"15)

addEventHandler"onClientRender",root,
   function(player)
      local players getElementsByType "player" ) 
      for keyplayer in ipairs players ) do       
        setPlayerNametagShowing playerfalse ) 
      end
      local pxpypztxtytzdist
      pxpypz getCameraMatrix( )
      for _v in ipairsgetElementsByType 'player' ) do
         txtytz getElementPosition)
         dist math.sqrt( ( px tx ) ^ + ( py ty ) ^ + ( pz tz ) ^ )
         if dist 30.0 then
            if isLineOfSightClearpxpypztxtytztruefalsefalsetruefalsefalsefalse,localPlayer then
               local sxsysz getPedBonePositionv)
               local x,getScreenFromWorldPositionsxsysz 0.3 )
               if x then 
                dxDrawText"[1]"..getPlayerName), x-60yxytocolor(255255255160), 0.85 + ( 15 dist ) * 0.02FMain )
                dxDrawText"Adminisrator"x-55y+30xytocolor(25500255), 0.85 + ( 15 dist ) * 0.02SMain )
               end
            end
         end
      end
   end
)


Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 22:21


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

 0.85 + ( 15 dist ) * 0.02
to odpowiada za powi?kszanie si?.

Je?li chodzi o markery to za pewne jest tam tworzony marker aby to jako? dzia?a?o, na miejscu tego jest marker i aby by?o ?atwiej to jest to po to by dzia?a?o jak marker normalny. By mo?na sprawdzi? czy gracz jest w markerze, gdy wchodzi/wychodzi pro?ciej tak ni? pisa? w?asne funkcje wywo?uj?ce takie zdarzenia.

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-11, 22:22


Szydlo

Stance Works






Wiek: 25
Na forum: 3585 dni
Posty: 343
Nick w MP: Szydlo

Piwa: 4

Respekt: 105,3
Respekt: 105,3

A ten marker jest pewnie nie widzialny?

Podpis
Aktualny najlepszy kontakt do mnie: Szydlo#8134 (Discord)
Postaw piwo autorowi tego posta
 

 
Tagi: nametagi
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Nametagi + 3D Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku