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

Wysłany: 2015-10-03, 16:26


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
Witam. Mam taki problem, ot?? przerabia?em m?j stary system respektu na system g?odu i natrafi?em na problem. Gdy odpal? skrypt to jest dobrze bo usuwa 1 punkt w minut?, ale drugi raz ju? nie usunie. po 100 ustawia na 99 i dalej ju? si? nie ruszy. Wiecie o co chodzi? Przecie? setTimer jest ustawiony na niesko?czono?? razy :)

function dxDraw()
        dxDrawText("G??d:", 0, 335, 131, 385, tocolor(0, 255, 137, 255), 1.50, "pricedown", "left", "top", false, false, false, false, false)
        dxDrawText(getElementData(localPlayer, "Respekt") or 0, 148, 335, 261, 378, tocolor(255, 43, 43, 255), 1.50, "pricedown", "left", "top", false, false, false, false, false)
end
addEventHandler("onClientRender", root, dxDraw)


local player = getLocalPlayer ()
local data = getElementData(player, "Respekt") or 100
function resp_minuta ()
         setElementData (player, "Respekt", data - 1)
end
setTimer (resp_minuta, 60*1000, 0)

function sprawdz_poziom_glodu ()
       glod = getElementData (player, "Respekt")
        if glod == 0 then
           killPlayer (player)
           outputChatBox ("* Umar?e? z g?odu! Trzeba by?o co? zje??!", 255, 0, 0)
         elseif glod == 10 then
           outputChatBox ("Powoli robisz si? g?odny. Znajd? co? do jedzenia!")
        end
end
setTimer (sprawdz_poziom_glodu, 60*1000, 0)



Za pomoc dam :piwo:


//EDIT

Kolejny problem to teleportacja do burger shotow. Mam je 2 i jak wejde do burgera w Downtown i chce wyjsc, to teleportuje mnie przed burgera w juniper hollow. O co chodzi? Przecie? markery itp. mam pod inn? nazw? :-?

-- Downtown (San Fierro)
createBlip(-1912.02454, 828.07935, 35.19855,10, 2, 255,0,0,255,0,400)  
wejscie1 = createMarker (-1912.02454, 828.07935, 36.19855, "arrow", 1.5, 255, 255, 0)
wyjscie1 = createMarker (363.27087, -74.97072, 1002.50781, "arrow", 1.5, 255, 255, 0)
setElementDimension(wyjscie1, 0)
setElementInterior(wyjscie1, 10)

addEventHandler("onMarkerHit", wejscie1, function(el, md)
    if isPedInVehicle(el) then return end
    setElementDimension (el, 0)
    setElementInterior (el, 10)
    setElementPosition (el, 364.66623, -73.73338, 1001.50781)
end)

addEventHandler("onMarkerHit", wyjscie1, function(el, md)
    if isPedInVehicle(el) then return end
    setElementDimension (el, 0)
    setElementInterior (el, 0)
    setElementPosition (el, -1910.66663, 829.90070, 35.17188)
end)


-- Juniper Hollow (San Fierro)
createBlip(-2356.42529, 1008.02527, 50.89844,10, 2, 255,0,0,255,0,400)  
wejscie2 = createMarker (-2355.81714, 1008.13525, 51.8984, "arrow", 1.5, 255, 255, 0)
wyjscie2 = createMarker (363.27087, -74.97072, 1002.50781, "arrow", 1.5, 255, 255, 0)
setElementDimension(wyjscie2, 1)
setElementInterior(wyjscie2, 10)

addEventHandler("onMarkerHit", wejscie2, function(el, md)
    if isPedInVehicle(el) then return end
    setElementDimension (el, 1)
    setElementInterior (el, 10)
    setElementPosition (el, 364.66623, -73.73338, 1001.50781)
end)

addEventHandler("onMarkerHit", wyjscie2, function(el, md)
    if isPedInVehicle(el) then return end
    setElementDimension (el, 0)
    setElementInterior (el, 0)
    setElementPosition (el, -2358.87769, 1007.62817, 50.69531)
end)


Dodam, ?e to jest ten sam interior. Za to te? dam :piwo: xD

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-03, 17:34


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
1) Date pobierasz raz, nie jest ona aktualizowana na bierz?co.

2) Do wej?cia/wyj?cia doda?:


if not md then return end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-03, 17:46


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
A przy okazji mo?esz mi jeszcze poprawi? zapis? Bo jak wyjd? i wejd? to mam znowu 100 g?odu

function odczyt ()
local konto = getAccountName(getPlayerAccount(source))
local data = getAccountData(konto, "Respekt")
    if data then
    setElementData(source, "Respekt", data)
    else
    setAccountData(konto, "Respekt", 100)
    setElementData(source, "Respekt", 100)
    end
end
addEventHandler ( 'onPlayerLogin', getRootElement (), odczyt)

function zapis ()
local konto1 = getPlayerAccount(source)
    local data1 = getElementData(source, "Respekt")
    if data1 then
    setAccountData(konto1, "Respekt", data1)
    end
end
addEventHandler( "onPlayerQuit", getRootElement(), zapis)
addEventHandler( "onPlayerLogout", getRootElement(), zapis)
addEventHandler( "onResourceStop", getRootElement(), zapis)


Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-03, 17:52


#404







Wiek: 27
Na forum: 4913 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
 function odczyt ( _, konto )
local data = getAccountData(konto, "Respekt")
    if data then
    setElementData(source, "Respekt", data)
    else
    setAccountData(konto, "Respekt", 100)
    setElementData(source, "Respekt", 100)
    end
end
addEventHandler ( 'onPlayerLogin', getRootElement (), odczyt)

function zapis (_,konto)
    setAccountData(konto, "Respekt", (getElementData(source, "Respekt")or 100))
end

addEventHandler( "onPlayerLogout", getRootElement(), zapis)

function zapis2 ()

    setAccountData(getPlayerAccount(source), "Respekt", (getElementData(source, "Respekt")or 100))
end

addEventHandler( "onPlayerQuit", getRootElement(), zapis2)


A co do marker?w:


addEventHandler("onMarkerHit", wyjscie2, function(el, md)
    if isPedInVehicle(el) then return end
    if not md then return end
    setElementDimension (el, 0)
    setElementInterior (el, 0)
    setElementPosition (el, -2358.87769, 1007.62817, 50.69531)
end)


Ostatnio zmieniony przez #404 2015-10-04, 22:01, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-04, 21:59


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
Za?atwione. Polecia?o :piwo: i R* xD

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Tagi: settimer :: usuwa :: tylko :: raz :: nie :: działa :: teleport
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » setTimer usuwa tylko raz i nie działa teleport 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