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

Wysłany: 2018-08-29, 09:17


trojkatdwanasci







Wiek: 33
Na forum: 3049 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

Witam ponownie :D jako ?e nie chce mi si? ju? m?czy? oczu na wiki z LUA, wol? napisa? tutaj mianowicie chodzi o skrypt kt?ry po postrzale nadaje animacje lecz ta animacja jest jednorazowa (chodzi mi o co? w stylu animka po postrzale niczym w SAMP :-> ) i chcia?bym aby ona by?a aktywna przez jakie? 10 - 20 sekund i dopiero po up?ywie czasu mo?na by by?o normalnie funkcjonowa?

A i je?li da rad? to czy by?a by opcja aby do tego skryptu doda? mo?liwo?? chodzenia z animacj? "PED", "FALL_collapse" g??wnie chodzi o skr?canie bo jak si? otrzyma obra?enia to posta? idzie przed siebie


--[[
    ##########################################################################
    ##                                                                      ##
    ## Project: 'Taser' - resource for MTA: San Andreas                     ##
    ##                                                                      ##
    ##########################################################################
    [C] Copyright 2013-2014, Falke
]]

local cFunc = {}
local cSetting = {}

cSetting["shots"] = {}
cSetting["shot_calcs"] = {}
local last_shot = 1
-- FUNCTIONS --


cFunc["render_shots"] = function()
    for index, tbl in pairs(cSetting["shots"]) do
        dxDrawFuckedLine3D(tbl[1], tbl[2], tbl[3], tbl[4], tbl[5], tbl[6], tocolor(0, 255, 0))
    end
end

cFunc["draw_shot"] = function(x1, y1, z1, x2, y2, z2)
    table.insert(cSetting["shots"], last_shot, {x1, y1, z1, x2, y2, z2})
    -- SHOT CALCULATING 
    local lastx, lasty, lastz = x1, y1, z1
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2)
    cSetting["shot_calcs"][last_shot] = {}
    
    for i = 1, dis, 0.5 do
    --    cSetting["shot_calcs"][i] = nx, ny, nz
    --    cSetting["shot_calcs"][last_shot][i] =
    end
    last_shot = last_shot+1
end

cFunc["shot_weapon"] = function(hitX, hitY, hitZ, x, y, z)
    playSound3D("data/Fire.wav", x, y, z)
    local s = playSound3D("data/Fire.wav", hitX, hitY, hitZ)
    setSoundMaxDistance(s, 50)
    for i = 1, 5, 1 do
        fxAddPunchImpact(hitX, hitY, hitZ, 0, 0, 0)
        fxAddSparks(hitX, hitY, hitZ, 0, 0, 0, 8, 1, 0, 0, 0, true, 3, 1)
    end
    cFunc["draw_shot"](x, y, z, hitX, hitY, hitZ)
    fxAddPunchImpact(x, y, z, 0, 0, -3)
end

cFunc["wait_shot"] = function()
    toggleControl("fire", false)
    setTimer(function()
        toggleControl("fire", true)
    end, 350, 1)
end

cFunc["shot_check"] = function(wp, _, _, hitX, hitY, hitZ, element, startX, startY, startZ)
    if(wp == 23) then
        cFunc["shot_weapon"](hitX, hitY, hitZ, startX, startY, startZ)
        if(source == localPlayer) then
            cFunc["wait_shot"]()
        end
    end
end

dxDrawFuckedLine3D = function(x1, y1, z1, x2, y2, z2, color)
    local dis = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2)
    local lastx, lasty, lastz = x1, y1, z1
    --for i = 1, dis, 3 do
    --    dxDrawLine3D(x1, y1, z1, x2, y2, z2)
    --end
end

cFunc["anim_check"] = function(_, wep, bodypart)
    if(wep == 23)  and (bodypart == 9) then
        setPedAnimation(source, "ped", "KO_shot_face", 20000, false, true, false)
    elseif(wep == 23 or wep == 24)  and (bodypart == 8) then 
        setPedAnimation(source, "PED", "FALL_collapse", 20000, false, true, false)
    elseif(wep == 23 or wep == 24)  and (bodypart == 7) then 
        setPedAnimation(source, "PED", "FALL_collapse", 20000, false, true, false)
    elseif(wep == 23 or wep == 24)  and (bodypart == 6) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 20000, false, true, false)
    elseif(wep == 23 or wep == 24)  and (bodypart == 5) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 20000, false, true, false)
    elseif(wep == 23 or wep == 24)  and (bodypart == 4) then
        setPedAnimation(source, "CRACK", "crckdeth3", 20000, false, true, false)
    elseif(wep == 23 or wep == 24)  and (bodypart == 3) then
        setPedAnimation(source, "ped", "KO_shot_stom", 20000, false, true, false)
    elseif(wep == 23 or wep == 24)  and (bodypart == 2) then
        setPedAnimation(source, "CRACK", "crckdeth2", 20000, false, true, false)
    elseif(wep == 23 or wep == 24)  and (bodypart == 1) then
        setPedAnimation(source, "CRACK", "crckdeth2", 20000, false, true, false)

    end
end

-- EVENT HANDLER --

addEventHandler("onClientPlayerWeaponFire", getRootElement(), cFunc["shot_check"])
addEventHandler("onClientRender", getRootElement(), cFunc["render_shots"])
addEventHandler("onClientPedDamage", getRootElement(),cFunc["anim_check"])
addEventHandler("onClientPlayerDamage", getRootElement(),cFunc["anim_check"])


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-29, 09:56


Kalizman







Wiek: 24
Na forum: 3793 dni
Posty: 1394

Piwa: 4624

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

Tw?j problem rozwi??e
Więcej informacji znajdziesz w Wikipedii MTA:

setPedAnimation
a dok?adniej zrobienie setTimera na 10-20 sekund - tak jak napisa?e?, a nast?pnie umie?ci? w nim wy?ej wymienion? funkcj?, z tylko drugim argumentem tej funkcji na false - wtedy animacja wy??czy si?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-29, 10:15


trojkatdwanasci







Wiek: 33
Na forum: 3049 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

Kalizman, chodzi o co? takiego?

function freezeThisDude ( thePlayer, freezeTime )                        
    setTimer ( toggleAllControls, freezeTime, 1, thePlayer, true ) 
end
    
cFunc["anim_check"] = function(_, wep, bodypart)
    if(wep == 23 or wep == 41 or wep == 17 or wep == 37)  and (bodypart == 9) then
        setPedAnimation(source, "ped", "KO_shot_face", 20000, false, true, false)
        freezeThisDude (source, 10000 )
    elseif(wep == 23 or wep == 24 or wep == 22 or wep == 25 or wep == 32 or wep == 31 or wep == 30)  and (bodypart == 8) then 
        setPedAnimation(source, "PED", "FALL_collapse", 20000, false, true, false)
        freezeThisDude (source, 10000 )
    elseif(wep == 23 or wep == 24 or wep == 22 or wep == 25 or wep == 32 or wep == 31 or wep == 30)  and (bodypart == 7) then 
        setPedAnimation(source, "PED", "FALL_collapse", 20000, false, true, false)
        freezeThisDude (source, 10000 )
    elseif(wep == 23 or wep == 24 or wep == 22 or wep == 25 or wep == 32 or wep == 31 or wep == 30)  and (bodypart == 6) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 20000, false, true, false)
        freezeThisDude (source, 10000 )
    elseif(wep == 23 or wep == 24 or wep == 22 or wep == 25 or wep == 32 or wep == 31 or wep == 30)  and (bodypart == 5) then 
        setPedAnimation(source, "CRACK", "crckdeth2", 20000, false, true, false)
        freezeThisDude (source, 10000 )
    elseif(wep == 23 or wep == 24 or wep == 22 or wep == 25 or wep == 32 or wep == 31 or wep == 30)  and (bodypart == 4) then
        setPedAnimation(source, "CRACK", "crckdeth3", 20000, false, true, false)
        freezeThisDude (source, 10000 )
    elseif(wep == 23 or wep == 24 or wep == 22 or wep == 25 or wep == 32 or wep == 31 or wep == 30)  and (bodypart == 3) then
        setPedAnimation(source, "ped", "KO_shot_stom", 20000, false, true, false)
        freezeThisDude (source, 10000 )
    elseif(wep == 23 or wep == 24 or wep == 22 or wep == 25 or wep == 32 or wep == 31 or wep == 30)  and (bodypart == 2) then
        setPedAnimation(source, "CRACK", "crckdeth2", 20000, false, true, false)
        freezeThisDude (source, 10000 )
    elseif(wep == 23 or wep == 24 or wep == 22 or wep == 25 or wep == 32 or wep == 31 or wep == 30)  and (bodypart == 1) then
        setPedAnimation(source, "CRACK", "crckdeth2", 20000, false, true, false)
        freezeThisDude (source, 10000 )


Podpis
RCRP (Red County Role Play) - Nowy projekt. W czasie prac.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-29, 10:52


Kalizman







Wiek: 24
Na forum: 3793 dni
Posty: 1394

Piwa: 4624

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

nie u?y?e? settimera

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-29, 14:24


trojkatdwanasci







Wiek: 33
Na forum: 3049 dni
Posty: 50
Nick w MP: Brak

Piwa: 301

Respekt: 50

Kalizman, pozmienialem timer itp ale nadal to samo (nie wywala bledow debug3) animacja przeleci i koniec

Podpis
RCRP (Red County Role Play) - Nowy projekt. W czasie prac.
Postaw piwo autorowi tego posta
 

 
Tagi: zawieszenie :: animacji
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