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

Wysłany: 2020-07-28, 16:12


CytrusekLUA







Wiek: 22
Na forum: 2611 dni
Posty: 5
Nick w MP: MichaleQ



Respekt: 50

powiem wprost pr?buje napisa? autorski radar znajduj?cy si? w prawym g?rnym rogu ekranu. Niestety blipy nie chc? si? tworzy?, by? mo?e ja co? namiesza?em w kodzie wi?c prosz? o pomoc osoby lepsze w LUA odemnie.

kod blip?w:

for i,b in pairs(getElementsByType('blip')) do
            local bXbYbZ getElementPosition(b);
            local pXpYpZ getElementPosition(localPlayer);
            local __crZ getElementRotation(getCamera());
            local dist getDistanceBetweenPoints3D(bXbYbZpXpYpZ);
            local maxdist getBlipVisibleDistance(b);

            if (dist <= maxdist and getElementDimension(localPlayer) == getElementDimension(b) and getElementInterior(b) == getElementInterior(getCamera())) then
                local radius dist/zoom;
                local direction math.atan2(bX pXbY pY) + math.rad(crZ);

                local blipX math.sin(direction) * radius;
                local blipY math.sin(direction) * radius;

                blipX math.max(0math.min(blipXw));
                blipY math.max(0math.min(blipYh));

                local path ':radar/files/map_blips/radarBlip_'..getBlipIcon(b)..'.png';
                if (paththen
                    local color tocolor(getBlipColor(b));
                    local size tonumber(getBlipSize(b));

                    dxDrawImage(blipX size/2blipY size/2sizesizepath000color);
                else return
                end;
            end;
        end;


Oraz ca?o?? kodu:

local fileDirs = {
    map ':radar/files/map_file/map.jpg',
    circle ':radar/files/map_circle/circle.png',
    player ':radar/files/player_blip/player.png',
    fx ':radar/files/map_fx/hud_mask.fx',
};

local screenWscreenH guiGetScreenSize();
local xywscreenW 0.8516screenH 0.0250screenW 0.1320screenH 0.2264
local render true;
local radarTextureradarCircleMaskradarShadereverythingOkay;

addEventHandler('onClientResourceStart'resourceRoot, function()
    radarTexture dxCreateTexture(fileDirs.map);
    radarCircleMask dxCreateTexture(fileDirs.circle);
    radarShader dxCreateShader(fileDirs.fx);

    everythingOkay radarTexture and radarCircleMask and radarShader;
    if (everythingOkaythen
        dxSetShaderValue(radarShader'sPicTexture'radarTexture);
        dxSetShaderValue(radarShader'sMaskTexture'radarCircleMask);
    end;

    setPlayerHudComponentVisible('all'false);
    --setPlayerHudComponentVisible('radar'true);
end);

addEventHandler('onClientRender'root, function()
    if (render == falsethen return end;
    if (everythingOkaythen
        dxSetShaderValue(radarShader'sMaskTexture'radarCircleMask);
        
        local x,getElementPosition(localPlayer);
        = ( ) / 6000;
        = ( ) / -6000;
        dxSetShaderValue(radarShader'gUVPosition'x,y);
        
        local zoom 20;
        if (not isPedInVehicle(localPlayer)) then
            local zoom 20;
        end;
        --zoom zoom math.singetTickCount() / 500 ) * 3;
        dxSetShaderValue(radarShader'gUVScale'1/zoom1/zoom);

        local camXcamYcamZ getElementRotation(getCamera());
        dxSetShaderValue(radarShader'gUVRotAngle'math.rad(-camZ));
        --dxSetShaderTransform(radarShader0, -65camZ);
    
        local __pROT getElementRotation(localPlayer);
        dxDrawImage(screenW 0.8516screenH 0.0250screenW 0.1320screenH 0.2264radarShader0,0,0tocolor(255,255,255,230));
        dxDrawImage(screenW 0.9117screenH 0.1236screenW 0.0125screenH 0.0236fileDirs.player00math.rad(-pROT), tocolor(255255255255), false);

        for i,b in pairs(getElementsByType('blip')) do
            local bXbYbZ getElementPosition(b);
            local pXpYpZ getElementPosition(localPlayer);
            local __crZ getElementRotation(getCamera());
            local dist getDistanceBetweenPoints3D(bXbYbZpXpYpZ);
            local maxdist getBlipVisibleDistance(b);

            if (dist <= maxdist and getElementDimension(localPlayer) == getElementDimension(b) and getElementInterior(b) == getElementInterior(getCamera())) then
                local radius dist/zoom;
                local direction math.atan2(bX pXbY pY) + math.rad(crZ);

                local blipX math.sin(direction) * radius;
                local blipY math.sin(direction) * radius;

                blipX math.max(0math.min(blipXw));
                blipY math.max(0math.min(blipYh));

                local path ':radar/files/map_blips/radarBlip_'..getBlipIcon(b)..'.png';
                if (paththen
                    local color tocolor(getBlipColor(b));
                    local size tonumber(getBlipSize(b));

                    dxDrawImage(blipX size/2blipY size/2sizesizepath000color);
                else return
                end;
            end;
        end;
    end;
end);


Za pomoc daje zimniutkie piwko :-> :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-28, 16:24


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

B??dy /debugscript 3?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-28, 16:25


CytrusekLUA







Wiek: 22
Na forum: 2611 dni
Posty: 5
Nick w MP: MichaleQ



Respekt: 50

nic nie ma w?a?nie wilq'u. Po prostu si? nie pojawiaj? bo pod db3 sam bym doszed? do rozwi?zania...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-31, 01:49


Ketyso







Wiek: 22
Na forum: 2146 dni
Posty: 30
Nick w MP: Ketyso

Piwa: 2

Respekt: 50

W kodzie masz wsz?dzie powpisywany znak ' zmie? go na "

je?eli b??d wyst?puje dalej sprawdz czy nazwa blipu jest identyczna ( wielko?? liter ma znaczenie ) :)

Postaw piwo autorowi tego posta
 

 
Tagi: blipy :: nie :: tworzą :: się
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » blipy nie tworzą się 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