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

Wysłany: 2014-09-21, 17:27


Dixers

No-Life






Wiek: 26
Na forum: 4312 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Witam, jak zmieni? ten fragment kodu, ?eby zamiast jak kto? wiedzie to ?aduje od razu do 100, tylko ?eby ?adowa?o 10.

function setTimerRefillGas(enabled)
   

setElementData(vehicle,"fuel",tostring(100))
end
addEventHandler("onGasRefill",getRootElement(),setTimerRefillGas)

function timerRefillGas()
    if(isPedInVehicle(getLocalPlayer())) then
        local player getLocalPlayer()
        local vehicle getPedOccupiedVehicle(player)
        local fuel getElementData(vehicle,"fuel")
        if(tonumber(fuel) < 100then
        setElementData(vehicle,"fuel",100)
            distanceOld distance
        end
    end
end



Za pomoc oczywi?cie, kilka piwek. Tradycyjnie :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-21, 17:55


TheTroll

Pan Majster






Wiek: 38
Na forum: 4764 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1114

Respekt: 120
Respekt: 120

Prosz?
Kod:


function setTimerRefillGas(enabled)


setElementData(vehicle,"fuel",tostring(100))
end
addEventHandler("onGasRefill",getRootElement(),setTimerRefillGas)

function timerRefillGas()
if(isPedInVehicle(getLocalPlayer())) then
local player = getLocalPlayer()
local vehicle = getPedOccupiedVehicle(player)
local fuel = getElementData(vehicle,"fuel")
if(tonumber(fuel) < 100) then
setElementData(vehicle,"fuel",getElementData(vehicle, "fuel") +10)
distanceOld = distance
end
end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-09-21, 18:50


Dixers

No-Life






Wiek: 26
Na forum: 4312 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

Nie dzia?a. Nadal daje full paliwa. My?la?em ?e chodzi te? o t? linijk? kodu:


setElementData(vehicle,"fuel",tostring(100))


Ale zrobi?em tak samo jak ty te ni?ej. I nadal dawa?o full.

Postaw piwo autorowi tego posta
 

 
Tagi: paliwo :: ostatnia :: sprawa.
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