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

Wysłany: 2019-05-06, 22:21


Adaskokieblasko







Wiek: 23
Na forum: 2954 dni
Posty: 101

Piwa: 18

Respekt: 100
Respekt: 100

Cze?? mam taki kodzik i chcia?bym aby przy nadawa?o gr?b w 1 funkcji a w 2 usuwa?o - Kombinowa?em tutaj ale wtedy jak 2 graczy mia?o bw to mog?em uleczy? tylko 1 ;/
addEventHandler("onClientPlayerWasted"getRootElement(), 
    function(killerweaponbodypart)
        if(source == getLocalPlayer()) then
            local abs=getElementData(source,"abseiling")
            if abs and abs~="" then
                return
            end
            local bwSeconds 10            
            if bodypart == 9 then -- g?owa
                bwSeconds = (10 60)
            elseif bodypart == 9 then -- ty?ek
                bwSeconds = (60)
            elseif tonumber(bodypart) and (tonumber(bodypart) >= and tonumber(bodypart) <= 8then -- ko?czyny
                bwSeconds = (60)
            elseif bodypart == 3 then -- klatka piersiowa
                bwSeconds = (60)
            else
                bwSeconds = (60)
            end
            
            setElementData(getLocalPlayer(), "bwEndTime"getTickCount()+(bwSeconds 1000))
            
            triggerEvent("onGUIOptionChange"getRootElement(), "grayscale"true)
            addEventHandler("onClientRender"getRootElement(), bwUpdate)
            fadeCamera false1.000) 
            setTimer fadeCamera20001true0.5 )
            triggerServerEvent("bw:zacznij",localPlayer)
            
            death.heartBeat playSound("audio/heartbeat.mp3"true)
        end
    end
)

addEvent("onBwFinish"true)
addEventHandler("onBwFinish"getRootElement(),
    function()
        setCameraTarget(getLocalPlayer())        
        destroyElement(death.heartBeat)
            
        triggerServerEvent("onPlayerFinshBW"getLocalPlayer())
        
        triggerEvent("onGUIOptionChange"getRootElement(), "grayscale"false)        
        removeEventHandler("onClientRender"getRootElement(), bwUpdate)
        triggerServerEvent("bw:zakoncz",localPlayer)
    end
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-06, 22:39


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Co wed?ug Ciebie znaczy gr?b?

Jak dok?adnie wygl?da? Tw?j problem?
Co si? dzia?o z pierwszym graczem i czy przy drugim otrzymywa?e? jakie? b??dy?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-06, 22:47


Adaskokieblasko







Wiek: 23
Na forum: 2954 dni
Posty: 101

Piwa: 18

Respekt: 100
Respekt: 100

Gr?b - Obiekt o ID 2127
Wi?c tak je?eli graczowi HP do 0 wtedy dostaje tzw "BW" i przez czas "BW" podczas gdy 2 graczy dostawa?o BW tworzy? si? na jednym i drugim obiekty oczywi?cie obiekt znika? z 2 graczy ale drugi gracz non-stop mia? u?miercon? posta? nie mia? mo?liwo?ci poruszania si? nic kamera lecia?a w gor? i jedynie restart zasobu pomaga? :/ ?adnych b??d?w w DB3 nie by?o

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-06, 23:47


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No i taki opis trzeba by?o od razu.

Poka? tre?? eventu "bw:zacznij".
Domy?lam si?, ?e wykonujesz tam tylko jeden timer, po ?mierci drugiego gracza one si? nadpisuj? i tylko jeden si? odradza.

Nie widz? nigdzie, aby owy obiekt si? tworzy? - masz gdzie? od niego kod? Chodzi mi tylko o fakt, czy on istnieje w og?le, pisa?e? co? o nim to wol??zapyta?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-07, 00:11


Adaskokieblasko







Wiek: 23
Na forum: 2954 dni
Posty: 101

Piwa: 18

Respekt: 100
Respekt: 100

addEvent("bw:zakoncz",true)
addEventHandler("bw:zakoncz",getRootElement(),function()
    exports.DB2:zapytanie("UPDATE `lss_users` SET `uo_bw`=0 WHERE id="..getElementData(source,"auth:uid"))
end)

addEvent("bw:zacznij",true)
addEventHandler("bw:zacznij",getRootElement(),function()
    exports.DB2:zapytanie("UPDATE `lss_users` SET `uo_bw`=1 WHERE id="..getElementData(source,"auth:uid"))
end)
addEvent("onPlayerFinshBW"true)
addEventHandler("onPlayerFinshBW"getRootElement(),
    function()
        local x,y,getElementPosition(source)
        local character getElementData(source"character")
        exports["lss-achievements"]:checkAchievementForPlayer(source,"1stblood")
        spawnPlayer(sourcexyz0character.co_skin and tonumber(character.co_skin) or character.faction_skin and tonumber(character.faction_skin) or getElementModel(source) or tonumber(character.skin), getElementInterior(source), getElementDimension(source))
        setElementHealth(source1)
--    setElementModel(sourcecharacter.skin)

end)

Znaczy co? tam pisa?em ale ju? nie mam raczej tego na komputerze.
Generalnie to nie jest wina obecnego kodu tylko w?a?nie edytowanego przez moj? osob? bo w?a?nie wtedy nie mo?na zrespi? gracza.

[ Dodano: 2019-05-07, 00:30 ]
addEvent("bw:zakoncz",true)
addEventHandler("bw:zakoncz",getRootElement(),function()
    exports.DB2:zapytanie("UPDATE `lss_users` SET `uo_bw`=0 WHERE id="..getElementData(source,"auth:uid"))
end)

addEvent("bw:zacznij",true)
addEventHandler("bw:zacznij",getRootElement(),function()
    exports.DB2:zapytanie("UPDATE `lss_users` SET `uo_bw`=1 WHERE id="..getElementData(source,"auth:uid"))
end)
addEvent("onPlayerFinshBW"true)
addEventHandler("onPlayerFinshBW"getRootElement(),
    function()
        local x,y,getElementPosition(source)
        local character getElementData(source"character")
        exports["lss-achievements"]:checkAchievementForPlayer(source,"1stblood")
        spawnPlayer(sourcexyz0character.co_skin and tonumber(character.co_skin) or character.faction_skin and tonumber(character.faction_skin) or getElementModel(source) or tonumber(character.skin), getElementInterior(source), getElementDimension(source))
        setElementHealth(source1)
--    setElementModel(sourcecharacter.skin)

end)

Znaczy co? tam pisa?em ale ju? nie mam raczej tego na komputerze.
Generalnie to nie jest wina obecnego kodu tylko w?a?nie edytowanego przez moj? osob? bo w?a?nie wtedy nie mo?na zrespi? gracza.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-07, 11:09


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nigdzie nie wykonujesz eventu "onPlayerFinshBW", on niby si? wykonuje w innym evencie ale znowu ten drugi te? nigdzie si? nie triggeruje.

Albo wys?a?e? obci?ty kod, albo nigdzie tego nie uwzgl?dni?e?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-05-07, 16:41


Adaskokieblasko







Wiek: 23
Na forum: 2954 dni
Posty: 101

Piwa: 18

Respekt: 100
Respekt: 100

local sx,sy guiGetScreenSize()
local death = {}

function dli(x,a,b,c)
    if (x==1then    return a end
    if (x%10>1) and (x%10<5) and (not ((x%100>=10) and (x%100<=21))) then     return b end
    return c
end

local czyDodaneDoBazy false

function bwUpdate()
    local toBwEnd = (getElementData(getLocalPlayer(), "bwEndTime")-getTickCount())
    local xygetElementPosition getLocalPlayer () )
--    setCameraMatrix 101015xy)
    setCameraMatrix(x-(10 math.sin(toBwEnd/40000)),y+(10 math.cos(toBwEnd/40000)),z+15,x,y,z)

    if(toBwEnd <= 1then
        outputChatBox("?yjesz! Lecz masz tylko 1hp udaj si? do szpitala po leki.")        
        triggerEvent("onBwFinish"getRootElement())        
        removeEventHandler("onClientRender"getRootElement(), bwUpdate)
        triggerServerEvent("bw:zakoncz",localPlayer)
        return
        
    end
    
    local timeInt math.floor(toBwEnd/1000)
    local timeStr = (timeInt >= 60 and dli(timeInt/60+1"minuta""minuty""minut") or dli(timeInt"sekunda""sekund""sekund"))
    
    local text "Do ko?ca BW pozosta?o " .. tostring(math.floor((timeInt >= 60 and timeInt/60+or timeInt))) .. " " .. timeStr
    
    local fX = (sx/2)-(dxGetTextWidth(text2)/2)
    local fY = (sx/2)-200
    
    dxDrawText(textfX 1fYfX 1fYtocolor(0,   0,   0255),   2)
    dxDrawText(textfX 1fYfX 1fYtocolor(0,   0,   0255),   2)
    dxDrawText(textfXfY 1fXfY 1tocolor(0,   0,   0255),   2)
    dxDrawText(textfXfY 1fXfY 1tocolor(0,   0,   0255),   2)
    dxDrawText(textfXfYfXfYtocolor(255255255255), 2)
end

addEventHandler("onClientPlayerWasted"getRootElement(), 
    function(killerweaponbodypart)
        if(source == getLocalPlayer()) then
            local abs=getElementData(source,"abseiling")
            if abs and abs~="" then
                return
            end
            local bwSeconds 10            
            if bodypart == 9 then -- g?owa
                bwSeconds = (10 60)
            elseif bodypart == 9 then -- ty?ek
                bwSeconds = (60)
            elseif tonumber(bodypart) and (tonumber(bodypart) >= and tonumber(bodypart) <= 8then -- ko?czyny
                bwSeconds = (60)
            elseif bodypart == 3 then -- klatka piersiowa
                bwSeconds = (60)
            else
                bwSeconds = (60)
            end
            
            setElementData(getLocalPlayer(), "bwEndTime"getTickCount()+(bwSeconds 1000))
            
            triggerEvent("onGUIOptionChange"getRootElement(), "grayscale"true)
            addEventHandler("onClientRender"getRootElement(), bwUpdate)
            fadeCamera false1.000) 
            setTimer fadeCamera20001true0.5 )
            triggerServerEvent("bw:zacznij",localPlayer)
            
            death.heartBeat playSound("audio/heartbeat.mp3"true)
        end
    end
)

addEvent("onBwFinish"true)
addEventHandler("onBwFinish"getRootElement(),
    function()
        setCameraTarget(getLocalPlayer())        
        destroyElement(death.heartBeat)
            
        triggerServerEvent("onPlayerFinshBW"getLocalPlayer())
        
        triggerEvent("onGUIOptionChange"getRootElement(), "grayscale"false)        
        removeEventHandler("onClientRender"getRootElement(), bwUpdate)
        triggerServerEvent("bw:zakoncz",localPlayer)
    end
)
addEvent("onScriptReset"true)
addEventHandler("onScriptReset"root,
    function(bwTime)
        setElementData(localPlayer"bwEndTime"bwTime)        
    end
)

addEventHandler "onClientPlayerDamage"getRootElement(),
    function()
        if(source == getLocalPlayer()) then
            fadeCamera false1.02550) 
            setTimer fadeCamera5001true0.5 )
            
        end
    end
)
ca?y c_side

[ Dodano: 2019-05-08, 18:14 ]
addEventHandler("onResourceStart"resourceRoot, function()
    for i,v in ipairs(getElementsByType("player")) do
        if getElementData(v,"character") and isPedDead(vthen

            local x,y,getElementPosition(v)
            local character getElementData(v"character")
            spawnPlayer(vxyz0character.co_skin and tonumber(character.co_skin) or tonumber(character.skin), getElementInterior(v), getElementDimension(v))
            setElementHealth(v50)
            setCameraTarget(v,v)

        end
    end
end)
-- nazwa onPlayerFinishBW
-- opis event wykonywany po zako?czeniu bw.
-- argumenty null
-- source gracz



addEvent("bw:zakoncz",true)
addEventHandler("bw:zakoncz",getRootElement(),function()
    exports.DB2:zapytanie("UPDATE `lss_users` SET `uo_bw`=0 WHERE id="..getElementData(source,"auth:uid"))
end)

addEvent("bw:zacznij",true)
addEventHandler("bw:zacznij",getRootElement(),function()
    exports.DB2:zapytanie("UPDATE `lss_users` SET `uo_bw`=1 WHERE id="..getElementData(source,"auth:uid"))
end)
addEvent("onPlayerFinshBW"true)
addEventHandler("onPlayerFinshBW"getRootElement(),
    function()
        local x,y,getElementPosition(source)
        local character getElementData(source"character")
        exports["lss-achievements"]:checkAchievementForPlayer(source,"1stblood")
        spawnPlayer(sourcexyz0character.co_skin and tonumber(character.co_skin) or character.faction_skin and tonumber(character.faction_skin) or getElementModel(source) or tonumber(character.skin), getElementInterior(source), getElementDimension(source))
        setElementHealth(source1)
--    setElementModel(sourcecharacter.skin)

end)
-- W realnym ?wiecie je?li dostaniesz w ?eb to teginiesz odrazu.;)
addEventHandler("onPlayerDamage"getRootElement(),
    function ( attackerweaponbodypartloss )
        if ( bodypart == then 
            killPed sourceattackerweaponbodypart )
        end
    end
)
Dodam jeszcze ca?e s.lua jak b?dzie potrzebne

[ Dodano: 2019-07-10, 17:42 ]
/ / REFRESH

Postaw piwo autorowi tego posta
 

 
Tagi: nagrobek
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