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

Wysłany: 2020-09-26, 22:40


StifMaster







Wiek: 30
Na forum: 3525 dni
Posty: 57
Nick w MP: Sztefi

Piwa: 5

Respekt: 50

Witam, jak zrobi? ?eby neony nie by?y do auta tylko do ziemi. Tak jak na Mega :/ . Z g?ry dzi?ki

c.lua
GUIEditor = {
    button = {},
    window = {},
    label = {}
}

addEventHandler("onClientResourceStart"resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(0.410.170.190.60"Panel Nen?w"true)
        guiWindowSetMovable(GUIEditor.window[1], false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 0.56)
        guiSetProperty(GUIEditor.window[1], "CloseButtonEnabled""False")
        guiSetProperty(GUIEditor.window[1], "CaptionColour""FF1EB8AF")

        GUIEditor.button[1] = guiCreateButton(0.070.190.860.06"Czerwony"trueGUIEditor.window[1])
        GUIEditor.button[2] = guiCreateButton(0.070.480.860.06"Zolty"trueGUIEditor.window[1])
        GUIEditor.button[3] = guiCreateButton(0.070.580.860.06"Rozowy"trueGUIEditor.window[1])
        GUIEditor.button[4] = guiCreateButton(0.070.900.860.06"Usun Neon"trueGUIEditor.window[1])
        GUIEditor.button[5] = guiCreateButton(0.070.290.860.06"Niebieski"trueGUIEditor.window[1])
        GUIEditor.button[6] = guiCreateButton(0.070.380.860.06"Zielony"trueGUIEditor.window[1])
        GUIEditor.button[7] = guiCreateButton(0.070.680.860.06"Bialy"trueGUIEditor.window[1])
        GUIEditor.label[1] = guiCreateLabel(0.230.070.620.04"Wybierz Kolor!"trueGUIEditor.window[1])
        guiSetFont(GUIEditor.label[1], "clear-normal")
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "center"false)
        guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
        guiSetVisible(GUIEditor.window[1], false)
    end
)


function showWindow()
    guiSetVisible(GUIEditor.window[1], true)
    showCursor(true)
end
addEvent("showWindow"true)
addEventHandler("showWindow"getRootElement(), showWindow)



function onClickRegister(button,state)
    if(button == "left" and state == "up"then
        local vehicle getPedOccupiedVehicle(localPlayer)
        if (source == GUIEditor.button[1]) then
            guiSetVisible(GUIEditor.window[1], false)
            showCursor(false)
            setElementData(vehicle,"neony"1)
        end
        if (source == GUIEditor.button[2]) then
            guiSetVisible(GUIEditor.window[1], false)
            showCursor(false)
            setElementData(vehicle,"neony"4)
        end
        if (source == GUIEditor.button[3]) then
            guiSetVisible(GUIEditor.window[1], false)
            showCursor(false)
            setElementData(vehicle,"neony"5)
        end
        if (source == GUIEditor.button[7]) then
            guiSetVisible(GUIEditor.window[1], false)
            showCursor(false)
            setElementData(vehicle,"neony"6)
        end
        if (source == GUIEditor.button[5]) then
            guiSetVisible(GUIEditor.window[1], false)
            showCursor(false)
            setElementData(vehicle,"neony"2)
        end
        if (source == GUIEditor.button[6]) then
            guiSetVisible(GUIEditor.window[1], false)
            showCursor(false)
            setElementData(vehicle,"neony"3)
        end
        if (source == GUIEditor.button[4]) then
            guiSetVisible(GUIEditor.window[1], false)
            showCursor(false)
            setElementData(vehicle,"neony"false)
        end
    end
end
addEventHandler("onClientGUIClick",resourceRoot,onClickRegister)


s.lua

--///////////////////////////////////// Settings ////////////////////////////////////////

local NID={
    3962,2113,1784,2054,2428,2352
}
local postion={-1,0,-0.5}

--///////////////////////////////////// Other /////////////////////////////////
function bindHoron4(veh)
    if not veh then return end
    local OBJECTID=tonumber(getElementData(veh,"neony"))
    if not OBJECTID then return end
    if OBJECTID==0 then return end
    local zalozone=getElementData(veh,"zalozone")
    if (zalozone and type(zalozone)=="table"then
        destroyElement(zalozone[1])
        destroyElement(zalozone[2])
        removeElementData(veh,"zalozone")
    else
        neon1=createObject(NID[OBJECTID],0,0,0)
        neon2=createObject(NID[OBJECTID],0,0,0)
        setElementData(veh,"zalozone", {neon1neon2})
        attachElements(neon1,veh,postion[1],postion[2],postion[3])
        attachElements(neon2,veh,-postion[1],postion[2],postion[3])
        setElementVelocity(veh,000.01)
    end
end

addEventHandler("onElementDestroy"getRootElement(), function ()
  if getElementType(source) == "vehicle" then
      local zalozone=getElementData(source,"zalozone")
    if (zalozone and type(zalozone)=="table"then
        destroyElement(zalozone[1])
        destroyElement(zalozone[2])
        removeElementData(source,"zalozone")
        end
    end
end)


function outputChange(dataName,oldValue)
    if getElementType(source) == "vehicle" then
        if dataName == "neony" then
              local zalozone=getElementData(source,"zalozone")
            if (zalozone and type(zalozone)=="table"then
                destroyElement(zalozone[1])
                destroyElement(zalozone[2])
                removeElementData(source,"zalozone")
            end
            bindHoron4(source)
        end
    end
end
addEventHandler("onElementDataChange",getRootElement(),outputChange)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-09-27, 12:25


Query

SyndicateMTA






Wiek: 24
Na forum: 3071 dni
Posty: 319
Nick w MP: Query

Piwa: 5257

Respekt: 141
Respekt: 141

W gotowych gamemodach typu pys neon jest podmienionym modelem attachowany do pojazdu ( przyczepiony )

?eby neon by? do ziemi to musisz stworzy? w?asny skrypt ;)

Pomocne funkcje:


Więcej informacji znajdziesz w Wikipedii MTA:

getGroundPosition



Więcej informacji znajdziesz w Wikipedii MTA:

dxDrawMaterialLine3D



Więcej informacji znajdziesz w Wikipedii MTA:

getElementData


W razie problem?w pisz tutaj

Postaw piwo autorowi tego posta
 

 
Tagi: neony
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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