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

Wysłany: 2020-07-17, 19:17


NorbiTTT

Nbi#1824






Wiek: 27
Na forum: 3207 dni
Posty: 193
Nick w MP: Nbi

Piwa: 698

Respekt: 60


local dx exports.ad_dx;
local font dx:getFont("rbt-b"10);
local font2 dx:getFont("rbt-r"4);
local font3 dx:getFont("rbt-r"5);

local sw,sh guiGetScreenSize();
local baseX 1920;
local zoom 1;
local minzoom 2;
if sw baseX then
    zoom math.min(minzoombaseX/sw);
end;

local selected 1;
local tick getTickCount();
local interaction = {};
local type_i "join"

local a1,a2,a3 0,0,0;

local textures = { -- Teksturki
  "img/I_brutto.png",
  "img/I_engine.png",
  "img/I_handbrake.png",
  "img/I_getout.png",
  "img/I_carlock.png",
   "img/bagaznik.png",
  "img/maska.png",
  "img/I_leftbutton.png",
  "img/I_rightbutton.png",
  "img/I_spacebutton.png",

};

local tbl = {
  [1] = "light",
  [2] = "engine",
  [3] = "handbrake",
  [4] = "cancel",
  [5] = "leave",
  [6] = "lock",
  [7] = "bagaznik",
  [8] = "maska", 

};

local img = {} -- Wszystkie tekstury
for i,v in pairs(textures) do
  img[i] = dxCreateTexture(v"argb"false"clamp")
end

function isEventHandlerAddedsEventNamepElementAttachedTofunc )
        local aAttachedFunctions getEventHandlerssEventNamepElementAttachedTo )
        if #aAttachedFunctions > 0 then
            for iv in ipairsaAttachedFunctions ) do
                if == func then
                    return true
                end
            end
        end

    return false
end

local selected_option = {
  function(vehoptiontrigger)
    if trigger then
      if option == 1 then
        return "switchLIGHT"
      elseif option == 2 then
        return "switchENGINE"
      elseif option == 3 then
        return "switchHANDBRAKE"
      elseif option == 4 then
        return "kickOCCUPANTS"
      elseif(option == 5)then
        return "changeLOCKED"
      elseif(option == 6)then
        return "bagaznik"
      elseif option == 7 then
        return "maska"
      elseif option == 12 then
        return "bagaznik"
      end
    else
      if option == 1 then
        return getVehicleOverrideLights(veh) == and "Odpal lampy" or "Zga? lampy"
      elseif option == 2 then
        return getVehicleEngineState(veh) == true and "Zga? silnik" or "Odpal silnik"
      elseif option == 3 then
        return getElementData(veh"vehicle:handbrake") and "Spu?? r?czny" or "Zaci?gnij r?czny"
      elseif option == 4 then
        return "Wysadz pasa?er?w"
      elseif option == 5 then
        return isVehicleLocked(veh) == true and "Otw?rz zamek" or "Zamknij zamek"
      elseif option == 6 then
        return "Otw?rz/Zamknij bagaznik"
      elseif option == 7 then
        return "Otw?rz/Zamknij maske"
      
      end
    end
  end
}

bindKey("lshift""both", function(_state)
    local veh getPedOccupiedVehicle(localPlayer)
    if not veh then return end

    

  if state == "up" then
    type_i "quit";
    tick getTickCount();

    unbindKey("arrow_r""down"down)
    unbindKey("mouse_wheel_down""down"down)
    unbindKey("arrow_l""down"up)
    unbindKey("mouse_wheel_up""down"up)
    unbindKey("space""down"accept);
  elseif(state == "down" and not isCursorShowing())then
    if(not isEventHandlerAdded("onClientRender"rootguiInter))then
      addEventHandler("onClientRender"rootguiInter)
    end;
    
    selected 4;
    tick getTickCount();
    type_i "join";
    a1,a2,a3 0,0,0;

    bindKey("arrow_r""down"down)
    bindKey("mouse_wheel_down""down"down)
    bindKey("arrow_l""down"up)
    bindKey("mouse_wheel_up""down"up)
    bindKey("space""down"accept);
    end
end)

function guiInter()
    local v getPedOccupiedVehicle(localPlayer)
    if not v then
    removeEventHandler("onClientRender"rootguiInter)

    unbindKey("arrow_r""down"down)
    unbindKey("mouse_wheel_down""down"down)
    unbindKey("arrow_l""down"up)
    unbindKey("mouse_wheel_up""down"up)
    unbindKey("space""down"accept);
        return
  end

  if type_i == "join" then
    a1,a2,a3 interpolateBetween(a1a2a3255100200, (getTickCount()-tick)/500"Linear");
  elseif type_i == "quit" then
    a1,a2,a3 interpolateBetween(a1a2a3000, (getTickCount()-tick)/500"Linear");

    if(a1 == 0)then
      removeEventHandler("onClientRender"rootguiInter);
    end;
  end;

  dxDrawRectangle(00swshtocolor(282834a3), false);

  dxDrawText("Klawiszologia"00swsh-130/zoomtocolor(227226223a1), 1font"center""bottom"falsefalsetruetrue);  

  dxDrawImage(sw/2-110/zoomsh-100/zoom104/zoom30/zoomtextures[10], 000tocolor(255255255a1), false);
  dxDrawText("Zatwierd?"sw/2+5/zoomsh-97/zoom104/zoom30/zoomtocolor(250249249a1), 1font3"left""top"falsefalsetruetrue);  

  dxDrawImage(sw/2-250/zoomsh-100/zoom30/zoom30/zoomtextures[8], 000tocolor(255255255a1), false);
  dxDrawText("W lewo"sw/2-210/zoomsh-97/zoom104/zoom30/zoomtocolor(250249249a1), 1font3"left""top"falsefalsetruetrue);  

  dxDrawImage(sw/2+130/zoomsh-100/zoom30/zoom30/zoomtextures[9], 000tocolor(255255255a1), false);
  dxDrawText("W prawo"sw/2+170/zoomsh-97/zoom104/zoom30/zoomtocolor(250249249a1), 1font3"left""top"falsefalsetruetrue);  
  
  local max getElementData(v"vehicle:type") == "LPG" and or 7;
  for 1,max do
    local x i-selected;
    local sX = (120/zoom)*x;

    if(selected == i)then
      dxDrawImage(sw/2-40/zoom+sXsh/2-64/zoom80/zoom80/zoomtextures[i], 000tocolor(255255255a1), false);
      dxDrawText(selected_option[1](vselected), sw/2-40/zoom+sX+1sh/2+15/zoom+180/zoom+sw/2-40/zoom+sX+180/zoom+1tocolor(000a1), 1font2"center""top"falsefalsetruetrue);
      dxDrawText(selected_option[1](vselected), sw/2-40/zoom+sXsh/2+15/zoom80/zoom+sw/2-40/zoom+sX80/zoomtocolor(250249249a1), 1font2"center""top"falsefalsetruetrue);  
    else
      dxDrawImage(sw/2-40/zoom+sXsh/2-64/zoom80/zoom80/zoomtextures[i], 000tocolor(108107108a1), false);
    end;
  end;
end;

function accept()
  local veh getPedOccupiedVehicle(localPlayer);
  if(veh and selected_option[1](vehselectedtrue))then
    triggerServerEvent(selected_option[1](vehselectedtrue), resourceRootveh);
  end;
end;

function up()
  tick getTickCount()
  selected math.max(selected 11)
end

function down()
  local v getPedOccupiedVehicle(localPlayer)
  local max getElementData(v"vehicle:type") == "LPG" and or 7;

  tick getTickCount()
  selected math.min(selected 1max)
end


ma ktos propozycje jak to zrobic aby pasazer nie mogl wlaczac interakcji?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-17, 19:26


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Zr?b sobie taki warunek, dostosuj tylko zmienne pod siebie

driver=getVehicleOccupant(pojazd,0)
if driver==tw?j_element_ciebie then
--kod
end


Postaw piwo autorowi tego posta
 

 
Tagi: pasazer :: widzi :: interakcje
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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