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

Wysłany: 2018-12-29, 15:58


Mikołajj







Wiek: 22
Na forum: 2885 dni
Posty: 303
Nick w MP: Mikołaj

Piwa: 132

Respekt: 91

Witam, tym razem przychodze z pytaniem, do jakiego eventu mog? doda? tak? funkcj??

function fatigue()
    if getPedControlState(localPlayer"sprint"then
        setTimer(function()
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")-1)
        end5000)
    elseif getPedControlState(localPlayer"walk"then
        setTimer(function()
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")+1)
        end5000)
    elseif getPedControlState(localPlayer"jump"then
        setTimer(function()
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")+1)
        end501)
    end
end


Bo je?eli dam sam? funkcj? to nie dzia?a, wi?c ju? nie wiem... A w jednym setTimer'rze tego nie zrobi?. :/

Albo czy robi? co? ?le?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-29, 16:20


Pawel5321

Szkrypter






Wiek: 36
Na forum: 3809 dni
Posty: 237
Nick w MP: Pawell

Piwa: 2315

Respekt: 240
Respekt: 240Respekt: 240


setTimer(function()

    if getPedControlState(localPlayer"sprint"then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")-1)
    elseif getPedControlState(localPlayer"walk"then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")+1)
    elseif getPedControlState(localPlayer"jump"then
setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")+1)
    end

end,1000,0)


Postaw piwo autorowi tego posta
 

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


Mikołajj







Wiek: 22
Na forum: 2885 dni
Posty: 303
Nick w MP: Mikołaj

Piwa: 132

Respekt: 91

"Pawel5321" napisał/a:


setTimer(function()

    if getPedControlState(localPlayer"sprint"then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")-1)
    elseif getPedControlState(localPlayer"walk"then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")+1)
    elseif getPedControlState(localPlayer"jump"then
setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")+1)
    end

end,1000,0)


No w?a?nie o to mi chodzi, ?e nie chc? tego w jednym setTimerze, poniewa? do poszczeg?lnych "controli" peda chc? inne czasy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-29, 17:14


Pawel5321

Szkrypter






Wiek: 36
Na forum: 3809 dni
Posty: 237
Nick w MP: Pawell

Piwa: 2315

Respekt: 240
Respekt: 240Respekt: 240


setTimer(function()


  if getPedControlState(localPlayer"walk") and getPedControlState(localPlayer"jump")==false and getPedControlState(localPlayer"sprint")==false then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")+1)
            end

end,50,0)

setTimer(function()

    if getPedControlState(localPlayer"sprint"then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")-1)
  end
 

end,500,0)
setTimer(function()

    if getPedControlState(localPlayer"jump"then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")-1)
  end
 
end,500,0)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-29, 17:55


Mikołajj







Wiek: 22
Na forum: 2885 dni
Posty: 303
Nick w MP: Mikołaj

Piwa: 132

Respekt: 91

"Pawel5321" napisał/a:


setTimer(function()


  if getPedControlState(localPlayer"walk") and getPedControlState(localPlayer"jump")==false and getPedControlState(localPlayer"sprint")==false then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")+1)
            end

end,50,0)

setTimer(function()

    if getPedControlState(localPlayer"sprint"then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")-1)
  end
 

end,500,0)
setTimer(function()

    if getPedControlState(localPlayer"jump"then
            setElementData(localPlayer"player:fatigue"getElementData(localPlayer"player:fatigue")-1)
  end
 
end,500,0)


Nie pomy?la?em o tym, dzi?ki. :D

Postaw piwo autorowi tego posta
 

 
Tagi: jaki :: event?
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Jaki event? 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