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

Wysłany: 2018-11-11, 16:03


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

Witam gdy dodaje do schowka aby mozna by?o wyci?ga? skina nie dzia?a :/

Kod c.lua

local screenSize Vector2(guiGetScreenSize())
local ticks = {alphaTick getTickCount(), animTick getTickCount(), vehicle nil}

local function isMouseInPosition(xywidthheight)
    if not isCursorShowing() then return false end
    
    local cursor = {getCursorPosition()}
    local cxcy = (cursor[1]*screenSize.x), (cursor[2]*screenSize.y)
    if (cx >= and cx <= width) and (cy >= and cy <= heightthen return true else return false end
end

function isEventHandlerAdded(sEventNamepElementAttachedTofunc)
    if type(sEventName) == 'string' and isElement(pElementAttachedTo) and type(func) == 'function' then
    local aAttachedFunctions getEventHandlers(sEventNamepElementAttachedTo)
    if type(aAttachedFunctions) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs(aAttachedFunctions) do if v == func then return true end end end 
    end return false
end

local function scaleElement(sxsy)
    return (screenSize.sx)/2, (screenSize.sy)/2
end

local icon_xicon_y scaleElement(128128)
local function drawGUI()
    local up interpolateBetween(10000000, (getTickCount()-ticks.animTick)/2000"OutBack") 

    if anim == "fadein" then
        progress = (getTickCount()-ticks.alphaTick)/1000
        alpha interpolateBetween(alpha0025500progress"Linear")
        if alpha == 255 then
            ticks.alphaTick getTickCount()
            anim nil
        end
    elseif anim == "fadeout" then
        progress = (getTickCount()-ticks.alphaTick)/500
        alpha interpolateBetween(alpha00000progress"Linear")
        if alpha == 0 then
            removeEventHandler("onClientRender"rootdrawGUI)
            ticks.alphaTick nil
            anim nil
        end
    end
    
    if isMouseInPosition(icon_x-300icon_y128128then color_one_down = {36175178} else color_one_down = {255255255end
    if isMouseInPosition(icon_x-150icon_y128128then color_two_down = {36175178} else color_two_down = {255255255end
    if isMouseInPosition(icon_xicon_y128128then color_three_down = {36175178} else color_three_down = {255255255end
    if isMouseInPosition(icon_x+150icon_y128128then color_four_down = {36175178} else color_four_down = {255255255end
    if isMouseInPosition(icon_x+300icon_y128128then color_five_down = {36175178} else color_five_down = {255255255end
    if isMouseInPosition(icon_x+450icon_y128128then color_six_down = {36175178} else color_six_down = {255255255end
    dxDrawImage(icon_x-300icon_y+up128128"images/extinguisher.png"000tocolor(color_one_down[1], color_one_down[2], color_one_down[3], alpha), false)
    dxDrawImage(icon_x-150icon_y+up128128"images/ladder.png"000tocolor(color_two_down[1], color_two_down[2], color_two_down[3], alpha), false)
    dxDrawImage(icon_xicon_y+up128128"images/object.png"000tocolor(color_three_down[1], color_three_down[2], color_three_down[3], alpha), false)
    dxDrawImage(icon_x+150icon_y+up128128"images/saw.png"000tocolor(color_four_down[1], color_four_down[2], color_four_down[3], alpha), false)
    dxDrawImage(icon_x+300icon_y+up128128"images/sorbent.png"000tocolor(color_five_down[1], color_five_down[2], color_five_down[3], alpha), false)
    dxDrawImage(icon_x+450icon_y+up128128"images/aodo.png"000tocolor(color_six_down[1], color_six_down[2], color_six_down[3], alpha), false)
end

for i,v in ipairs(getElementsByType("vehicle")) do
    if v.model == 407 then
        if v:getData("vehicle:rank"then
            marker Marker(000"cylinder"125500150)
            attachElements(markerv1.80, -1)
            
            addEventHandler("onClientMarkerHit"resourceRoot, function(playerdimension)
                if player == localPlayer and dimension then
                    if not isEventHandlerAdded("onClientRender"rootdrawGUIthen
                        if player:getData("player:duty") == "SAFD" then
                            local data marker:getData("marker:vehicle")
                            ticks.vehicle data
                        
                            alpha 0
                            anim "fadein"
                            showChat(false)
                            showCursor(truefalse)
                            ticks.animTick getTickCount()
                            ticks.alphaTick getTickCount()
                            player:setData("player:blackwhite"true)
                            player:setData("player:hud_visible"true)
                            setPlayerHudComponentVisible("radar"false)
                            addEventHandler("onClientRender"rootdrawGUI)
                            --triggerServerEvent("iyw_fire_equipment:say"localPlayer"podchodzi do wozu, przegl?daj?c zawarto??...")
                        end
                    end
                end
            end)
            
            addEventHandler("onClientMarkerLeave"marker, function(playerdimension)
                if player == localPlayer and dimension then
                    if isEventHandlerAdded("onClientRender"rootdrawGUIthen
                        alpha 255
                        showChat(true)
                        anim "fadeout"
                        showCursor(false)
                        ticks.vehicle nil
                        ticks.animTick getTickCount()
                        ticks.alphaTick getTickCount()
                        player:setData("player:blackwhite"false)
                        player:setData("player:hud_visible"false)
                        setPlayerHudComponentVisible("radar"true)
                    end
                end
            end)
        end
    end
end

local function closeGUI()
    alpha 255
    showChat(true)
    anim "fadeout"
    showCursor(false)
    ticks.animTick getTickCount()
    ticks.alphaTick getTickCount()
    setPlayerHudComponentVisible("radar"true)
    localPlayer:setData("player:blackwhite"false)
    localPlayer:setData("player:hud_visible"false)
end

addEventHandler("onClientClick"root, function(buttonstate)
    if button == "left" and state == "down" then
        if isEventHandlerAdded("onClientRender"rootdrawGUIthen
            if isMouseInPosition(icon_x-300icon_y128128then
                closeGUI()
                triggerServerEvent("iyw_fire_equipment:say"localPlayer"bierze ga?nic? ze schowka.")
                triggerServerEvent("iyw_fire_equipment:give"localPlayer"extinguisher")
            elseif isMouseInPosition(icon_x-150icon_y128128then
                if not localPlayer:getData("player:ladder"then
                    closeGUI()
                    triggerServerEvent("iyw_fire_equipment:say"localPlayer"w?wczas chwyci? za drabin?, oraz wyj?? j? ze schowka.")
                    triggerServerEvent("iyw_fire_equipment:give"localPlayer"ladder")
                else
                    closeGUI()
                    triggerServerEvent("iyw_fire_equipment:say"localPlayer"z?o?y? drabin?, oraz umie?ci? j? w schowku.")
                    triggerServerEvent("iyw_fire_equipment:give"localPlayer"ladder")    
                end
            elseif isMouseInPosition(icon_xicon_y128128then
                if not localPlayer:getData("vehicle:jumping"then
                    closeGUI()
                    triggerServerEvent("iyw_fire_equipment:say"localPlayer"bierze skokochron ze schowka.")
                    triggerServerEvent("iyw_fire_equipment:give"localPlayer"jump")
                else
                    closeGUI()
                    triggerServerEvent("iyw_fire_equipment:say"localPlayer"chowa skokochron do schowka.")
                    localPlayer:setData("vehicle:jumping"false)
                end
            elseif isMouseInPosition(icon_x+150icon_y128128then
                closeGUI()
                triggerServerEvent("iyw_fire_equipment:say"localPlayer"bierze pi?? mechaniczn? ze schowka.")
                triggerServerEvent("iyw_fire_equipment:give"localPlayer"saw")            
            end
            elseif isMouseInPosition(icon_x+450icon_y128128then
                closeGUI()
                triggerServerEvent("iyw_fire_equipment:say"localPlayer"bierze AODO ze schowka.")
                triggerServerEvent("iyw_fire_equipment:give"localPlayer"aodo")            
            end
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-11, 17:18


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

poka? miejsce w kt?rym dajesz skina bo nie widz? go w kodzie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-11, 18:13


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

    if v.model == 407 then
        if v:getData("vehicle:rank"then
            marker Marker(000"cylinder"125500150)
            attachElements(markerv1.80, -1)


debugscript 3



Oraz s.lua

object = {}
object_preview = {}
elements = {}

addEvent("iyw_fire_equipment:say"true)
addEventHandler("iyw_fire_equipment:say"root, function(text)
    local sphere ColShape.Sphere(Vector3(getElementPosition(source)), 30)
    local players sphere:getElementsWithin("player")
    sphere:destroy()
    
    for _,v in pairs(players) do
        outputChatBox("** "..source.name:gsub("#%x%x%x%x%x%x""").." "..textv255128255)
    end
end)

local function create(player)
    if player:getData("player:duty") == "SAFD" then    
        object_preview[player] = Object(1437000000)
        object_preview[player]:setCollisionsEnabled(false)
        object_preview[player].scale 0.8
    
        object_preview[player]:attach(player020, -3000)
        bindKey(player"z""down", function(participant)
            local rotation = {getElementRotation(object_preview[player])}
            object[participant] = Object(1437Vector3(getElementPosition(object_preview[player])), -30rotation[2], rotation[3])
            object[participant].scale 1
            object_preview[player]:detach()
            object_preview[player]:destroy()
            object_preview[player] = nil
        end)
    end
end

addEventHandler("onPlayerQuit"root, function()
    if object_preview[source] or isElement(object_preview[source]) or elements[source] or isElement(elements[source]) or object[source] or isElement(object[source]) then
        object_preview[source]:destroy()
        elements[source]:destroy()
        object[source]:destroy()
    end
end)

addEvent("iyw_fire_equipment:give"true)
addEventHandler("iyw_fire_equipment:give"root, function(value)
    if value == "extinguisher" then
        triggerClientEvent(source"onClientAddNotification"source"Wzi??e?(a?) ga?nic? ze schowka.""success")
        giveWeapon(source429999)
    elseif value == "saw" then
        triggerClientEvent(source"onClientAddNotification"source"Wzi??e?(a?) pi?? mechaniczn? ze schowka.""success")
        giveWeapon(source99999)
    elseif value == "aodo" then
        triggerClientEvent(source"onClientAddNotification"source"Wzi??e?(a?) AODO ze schowka.""success")
        setPlayerSkin(root278 )
    elseif value == "jump" then
        triggerClientEvent(source"onClientAddNotification"source"Wzi??e?(a?) skokochron ze schowka. (Aby go postawi?, wpisz /skokochron)""success")
        setElementData(source"vehicle:jumping"true)
    elseif value == "ladder" then
        if not source:getData("player:ladder"then
            if not object[source] and not elements[sourcethen
                elements[source] = Object(1428000000)
                elements[source]:setCollisionsEnabled(false)
                elements[source].scale 0.8

                exports["bone_attach"]:attachElementToBone(elements[source], source30.20, -0.109080)
                source:setData("player:ladder"true)
                setControlState(source"walk"true)
                
                bindKey(source"lctrl""down", function(player)
                    if player:getData("player:ladder"then
                        if elements[player] and isElement(elements[player]) then
                            elements[player]:destroy()
                            player:setData("player:ladder"false)
                            setControlState(player"walk"false)
                        end
                        create(player)
                    end
                end)
            else
                triggerClientEvent(source"onClientAddNotification"source"Mo?esz ro??o?y? tylko jedn? drabin?!""error")
            end
        else
            if elements[source] and isElement(elements[source]) then
                elements[source]:destroy()
                source:setData("player:ladder"false)
                setControlState(source"walk"false)
            end
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-11, 18:27


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

brakuje end?w

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-11, 18:36


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

s?

[ Dodano: 2018-11-11, 18:38 ]
M?g? by? mi to zrobi??

[ Dodano: 2018-11-11, 21:05 ]
"Kalizman" napisał/a:

brakuje end?w


Zrobi? bys mi to?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-11-12, 18:34


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

"Szym34kKacperQ" napisał/a:

s?

[ Dodano: 2018-11-11, 18:38 ]
M?g? by? mi to zrobi??

[ Dodano: 2018-11-11, 21:05 ]
"Kalizman" napisał/a:

brakuje end?w


Zrobi? bys mi to?


Sp?jrz, kt?ra to linijka. Sp?jrz ile masz funkcji, kt?rym brakuje zamkni?cia end'u i tyle.

Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Tagi: schowek :: psp
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