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

Wysłany: 2020-08-14, 17:18


xyzzzikk

.gg






Wiek: 18
Na forum: 2774 dni
Posty: 175
Nick w MP: aspyk

Piwa: 6499

Respekt: 30,5

Cze??, mam problem z tym, ?e tworze serwer DayZ, mam skrypt kt?ry wy?eitla bro? na plecach, lecz bronie s? pod te same id lecz inne modele bronie dzia?aj?, lecz gdy maj? wy?ietli? si? na plecach, wy?eitla si? tylko jedna bro? z tym ID.

kod:

--[[ BackWeapons script By Gothem

    Feel free to use and change it as you want,
    obviously keeping the credit to the creator.--]]

local jugadores = {}
local lplayer getLocalPlayer()
local info = {}
local sx,sy guiGetScreenSize()

function crearArma(jug,arma)
    local model obtenerObjeto(arma)
    local slot getSlotFromWeapon(arma)
    jugadores[jug][slot] = createObject(model,0,0,0)
    setElementCollisionsEnabled(jugadores[jug][slot],false)
end

function destruirArma(jug,slot)
    destroyElement(jugadores[jug][slot])
    jugadores[jug][slot] = nil
end

addEventHandler("onClientResourceStart",getResourceRootElement(),function()
    for k,v in ipairs(getElementsByType("player",root,true)) do
        jugadores[v] = {}
        info[v] = {true,isPedInVehicle(v)}
    end
end,false)

addEventHandler("onClientPlayerQuit",root,function()
    if jugadores[source] and source ~= lplayer then
        for k,v in pairs(jugadores[source]) do
            destroyElement(v)
        end
        jugadores[source] = nil
        info[source] = nil
    end
end)

addEventHandler("onClientElementStreamIn",root,function()
    if getElementType(source) == "player" and source ~= lplayer then
        jugadores[source] = {}
        info[source] = {true,isPedInVehicle(source)}
    end
end)

addEventHandler("onClientElementStreamOut",root,function()
    if jugadores[source] and source ~= lplayer then
        for k,v in pairs(jugadores[source]) do
            destroyElement(v)
        end
        jugadores[source] = nil
        info[source] = nil
    end
end)

addEventHandler("onClientPlayerSpawn",root,function()
    if jugadores[sourcethen
        info[source][1] = true
    end
end)

addEventHandler("onClientPlayerWasted",root,function()
    if jugadores[sourcethen
        for k,v in pairs(jugadores[source]) do
            destruirArma(source,k)
        end
        info[source][1] = false
    end
end)

addEventHandler("onClientPlayerVehicleEnter",root,function()
    if jugadores[sourcethen
        for k,v in pairs(jugadores[source]) do
            destruirArma(source,k)
        end
        info[source][2] = true
    end
end)

addEventHandler("onClientPlayerVehicleExit",root,function()
    if jugadores[sourcethen
        info[source][2] = false
    end
end)

addEventHandler("onClientPreRender",root,function()
    for k,v in pairs(jugadores) do
        local x,y,getPedBonePosition(k,3)
        local rot math.rad(90-getPedRotation(k))
        local i 15
        local wep getPedWeaponSlot(k)
        local ox,oy math.cos(rot)*0.22,-math.sin(rot)*0.22
        local alpha getElementAlpha(k)
        for q,w in pairs(v) do
            if == wep then
                destruirArma(k,q)
            else
                setElementRotation(w,0,70,getPedRotation(k)+90)
                setElementAlpha(w,alpha)
                if q==2 then
                    local px,py,pz getPedBonePosition(k,51)
                    local qx,qy math.sin(rot)*0.11,math.cos(rot)*0.11
                    setElementPosition(w,px+qx,py+qy,pz)
                elseif q==4 then
                    local px,py,pz getPedBonePosition(k,41)
                    local qx,qy math.sin(rot)*0.06,math.cos(rot)*0.06
                    setElementPosition(w,px-qx,py-qy,pz)
                else
                    setElementPosition(w,x+ox,y+oy,z-0.2)
                    setElementRotation(w,-17,-(50+i),getPedRotation(k))
                    i=i+15
                end
            end
        end
        if info[k][1] and not info[k][2then
            for i=1,do
                local arma getPedWeapon(k,i)
                if arma~=wep and arma>and not jugadores[k][ithen
                    crearArma(k,arma)
                end
            end
        end
    end
end)

function obtenerObjeto(arma)
    local m
    if arma and arma 9 then
        m 331 arma

        -------------------------------------------------------- AK-47
    elseif arma == 31 then
        m 1834
        -------------------------------------------------- FN SCAR
    elseif arma == 31 then
        m 1838

        -------------------------------------------
    elseif (arma 21 and arma 30) or (arma 32 and arma 39) or (arma 40 and arma 44then
        m 324 arma
    elseif arma 29 and arma 32 then
        m 325 arma
    elseif arma == 32 then
        m 73
    end
    return m
end


Tzn, je?li mam AK - wy?wietla, je?li mam inn? bro? - nie wy?wietla ( pod tym samym ID, inny model )

[ Dodano: 2020-08-14, 21:14 ]
Lock, by?o trzeba doda? elementdat? g??wnej broni, np.

    elseif ( arma == 31 then

        if getElementData(localPlayer,"currentweapon_1") == "AK-107" then
            m 1834
        elseif getElementData(localPlayer,"currentweapon_1") == "SA-58V ACOG" then
            m 1838
        end


Postaw piwo autorowi tego posta
 

 
Tagi: wyświetlanie
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