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

Wysłany: 2017-12-14, 22:24


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

je?li si? data przedawni powinno zwolni? dom a nie zwalnia db3 b??d ?aden :
addEventHandler("onResourceStart"resourceRoot, function()
        local q exports["db"]:dbGet("SELECT * FROM Domy")
        for i,v in ipairs(q) do
                v.wejscie 1(v.wejscie",")
                if v.nwlasciciel:len() < 3 then id 1273 else id 1272 end
                local wejscie createPickup(v.wejscie[1], v.wejscie[2], v.wejscie[3], 3id00)
                local cwejscie createColSphere(v.wejscie[1], v.wejscie[2], v.wejscie[3], 1)
                local wlasciciel false
                local nwlascciiel false
                if id == 1273 then
                        wlasciciel "brak"
                        nwlasciciel "brak"
                else
                        wlasciciel v.wlasciciel
                        nwlasciciel v.nwlasciciel
                end
                v.wyjscie 1(v.wyjscie",")
                v.tpw 1(v.tpw",")
                setElementData(cwejscie"dom", {
                ["id"]=v.id,
                ["wlasciciel"]=wlasciciel,
                ["nwlasciciel"]=nwlasciciel,
                ["cena"]=v.cena,
                ["nazwa"]=v.nazwa,
                ["x"]=v.tpw[1],
                ["y"]=v.tpw[2],
                ["z"]=v.tpw[3],
                ["data"]=v.data,
                ["int"]=v.int,
                ["organizacja"]=v.organizacja
                })
                local wyjscie createMarker(v.wyjscie[1], v.wyjscie[2], v.wyjscie[3], "arrow"100255)
                setElementData(wyjscie"wdom", {
                ["x"]=v.wejscie[1],
                ["y"]=v.wejscie[2],
                ["z"]=v.wejscie[3],
                })
                setElementInterior(wyjsciev.int)
                setElementDimension(wyjsciev.id)
        end
end)


setTimer ( function()
        local time getRealTime()
        local hours time.hour
        local minute time.minute
        if tonumber(hours) == 23 and tonumber(minute) == 59 then
            outputDebugString("* Zresetowano domki *")
            restartResource(getThisResource())
        end
end999*60)






function refreshDomy()
    local q exports['db']:dbGet("SELECT * FROM Domy")
    for i,v in ipairs(q) do
        local qq exports['db']:dbGet("SELECT * FROM Domy WHERE id=?"v.id)
        local qq2 exports['db']:dbGet("SELECT * FROM Domy WHERE id=? AND data<NOW()"v.id)
        if #qq2 > 0 then
                            exports['db']:dbGet("UPDATE Domy SET wlasciciel=0, nwlasciciel=?, data=?, organizacja=? WHERE id=?""""0000-00-00","brak"id)
                local query1=exports["db"]:dbSet("UPDATE organization_list set spawn=? where id=?""0,0,0",code)
            restartResource(getThisResource())
        end
    end
end
setTimer(refreshDomy10*1000*50)


addCommandHandler("refreshdomy", function(player)
if getElementData(player"player:admin"then
                local ranga getElementData(player,"player:level")
                if ranga == or ranga == 3 then
        refreshDomy()
    end
end
end)


addCommandHandler("dom", function(g_c, ...)
               if ... and and getElementData(g"player:admin")  then
                local ranga getElementData(g,"player:level")
                if  ranga == or ranga == or ranga == 2 then
                local xygetElementPosition(g)
                local n table.concat({...}, " ")
                outputChatBox("Dom na "..x..":"..y..":"..z.." nazwa "..n.." za cene "..string.format("%1.2f"c).." PLN"g)
                local wejscie x..","..y..","..z
                exports['db']:dbGet("INSERT INTO Domy SET wlasciciel=0, nwlasciciel=?, nazwa=?, data=?, wejscie=?, wyjscie=?, tpw=?, cena=?, organizacja=?"""n"0000-00-00"wejscie"318.61, 1114.48, 1083.88""318.39, 1116.68, 1083.88"c"brak")
                restartResource(getThisResource())
        end
    end
end)

addEvent("zDom"true)
addEventHandler("zDom"root, function(id)
        exports['db']:dbGet("UPDATE Domy SET wlasciciel=0, nwlasciciel=?, data=?, organizacja=? WHERE id=?""""0000-00-00""brak"id)
        restartResource(getThisResource())
        local uid=getElementData(source,"player:uid")
        local code=getElementData(source,"player:organization:id")
        local result=exports["db"]:dbGet("SELECT * FROM organizations WHERE uid=? and code=?"uid,code)
        if result and #result > 0 then
                if result[1].rank == 4 then
                local x,y,getElementPosition(source)
                local query1=exports["db"]:dbSet("UPDATE organization_list set spawn=? where id=?""0,0,0",code)
        end
        end
end)

local function getPlayerDBID(plr)
        local c=getElementData(plr,"player:uid")
        if not c then return nil end
        return tonumber(c)
end

addEvent("kDom"true)
addEventHandler("kDom"root, function(iddnikoszt)
        if not id and not dni and not koszt then return end
        local dbid getPlayerDBID(client)
        local hajs getPlayerMoney(client) 
        koszt dni*koszt
              CD id
              CD2 dni
              CD3 koszt
        if tonumber(koszt) > hajs then
                exports["noti"]:noti("Nie sta? ci? na zakup tego domu, potrzebujesz "..koszt.." PLN."client)
                return
        end
        local r exports['db']:dbSet("UPDATE Domy SET wlasciciel=?,nwlasciciel=?,data=IF(data>NOW(),data,NOW())+INTERVAL ? DAY WHERE id=?"dbidgetPlayerName(client), dniid)
       exports["db"]:dbSet("insert into Logi_domy SET  id_dom=?, gracz=?,serial=?,ile_dni=?,kwota=?,data=NOW()",CD,getPlayerName(client),getPlayerSerial(client),CD2,CD3,data)
        setPlayerMoney(clienthajs-koszt)
        exports["noti"]:noti("Zakupi?e?/przed?u?y?e? mieszkanie o id "..id.." na ilo?? dni "..dni.." za cene "..koszt.." PLN."client)
        restartResource(getThisResource())
end)

addEvent("tdDomu"true)
addEventHandler("tdDomu"root, function(xyzintdim)
        if int and dim then
                setElementInterior(clientint)
                setElementDimension(clientdim)
        else
                setElementDimension(client0)
                setElementInterior(client0)
        end
        setElementPosition(clientxyz)
end)

addEvent("przepiszDom"true)
addEventHandler("przepiszDom"root, function(id)
        local przepisywanie exports['db']:dbGet("UPDATE Domy SET organizacja=? WHERE id=?"getElementData(source,"player:organization"), id)
        restartResource(getThisResource())
    local uid=getElementData(source,"player:uid")
        local code=getElementData(source,"player:organization:id")
        local result=exports["db"]:dbGet("SELECT * FROM organizations WHERE uid=? and code=?"uid,code)
       if result and #result > 0 then
                 if result[1].rank == 4 then   
                local x,y,getElementPosition(source)
                local query1=exports["db"]:dbSet("UPDATE organization_list set spawn=? where id=?", ("%s,%s,%s"):format(x,y,z),code)
        end
        end
end)

addEvent("odpiszDom"true)
addEventHandler("odpiszDom"root, function(id)
        local przepisywanie exports['db']:dbGet("UPDATE Domy SET organizacja=? WHERE id=?""brak"id)
        restartResource(getThisResource())
        local uid=getElementData(source,"player:uid")
        local code=getElementData(source,"player:organization:id")
        local result=exports["db"]:dbGet("SELECT * FROM organizations WHERE uid=? and code=?"uid,code)
        if result and #result > 0 then
                 if result[1].rank == 4 then  
                local x,y,getElementPosition(source)
                local query1=exports["db"]:dbSet("UPDATE organization_list set spawn=? where id=?""0,0,0",code)
        end
        end
end)



Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-14, 22:45


koxpl2x22

MAPPER-ALLEREK






Wiek: 23
Na forum: 4556 dni
Posty: 375
Nick w MP: ALLEREK

Piwa: 1726

Respekt: 142,5
Respekt: 142,5

Bo z tego co widze tu nie ma nic takiego.
Daj do tabeli mysql czas w kt?rym dom ma sie usunac i przy refreshowaniu domk?w sprawdzaj czy czas domku jest mniejszy od czasu obecnego, je?li tak, zwolnij go.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-14, 22:48


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

"koxpl2x22" napisał/a:

Bo z tego co widze tu nie ma nic takiego.
Daj do tabeli mysql czas w kt?rym dom ma sie usunac i przy refreshowaniu domk?w sprawdzaj czy czas domku jest mniejszy od czasu obecnego, je?li tak, zwolnij go.
mo?esz powiedzie? jak bo a? tak dobrze mysql nie znam jest tam
datanow()


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-14, 23:32


.RiV







Wiek: 25
Na forum: 3588 dni
Posty: 554
Nick w MP: Split

Piwa: 2596

Respekt: 597,8
Respekt: 597,8

Wyt?umaczenie: Je?eli data b?dzie mniejsza od aktualnego czasu :)

Podpis

Autor OGRPG, na scenie MTA od 2012 roku.




Użytkownik: 08.08.2016
GTAO Member: 06.02.2017
Support-Team: 17.06.2017 & 01.06.2019 - 18.11.2019
Moderator: 14.01.2018 - 09.08.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-15, 09:59


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

".WhiteBlue" napisał/a:

Wyt?umaczenie: Je?eli data b?dzie mniejsza od aktualnego czasu :)
no tak jest ale czemu nie chce zadzia?a? jest u?yte w skrypcie to

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-15, 13:26


koxpl2x22

MAPPER-ALLEREK






Wiek: 23
Na forum: 4556 dni
Posty: 375
Nick w MP: ALLEREK

Piwa: 1726

Respekt: 142,5
Respekt: 142,5

zdefiniuj now() jako

local now getRealTime()


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-15, 17:51


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

"koxpl2x22" napisał/a:

zdefiniuj now() jako

local now getRealTime()
nie pomog?o

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-15, 19:43


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

koxpl2x22, Bzdura z tym getRealTime.

mis14,
 exports['db']:dbGet("UPDATE Domy SET wlasciciel=0, nwlasciciel=?, data=?, organizacja=? WHERE id=?""""0000-00-00","brak"id)
nie korzystam i nie korzysta?em z og ale czy tutaj aby nie powinno by? dbSet zamiast dbGet? I te puste "" nale?y usun??, skoro ustawiasz sta?? warto?? 0.

Czyli
 exports['db']:dbSet("UPDATE Domy SET wlasciciel=0, nwlasciciel=?, data=?, organizacja=? WHERE id=?""0000-00-00","brak"id)


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-15, 21:18


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

poradzi?em sobie sam dzi?kuje

Postaw piwo autorowi tego posta
 

 
Tagi: zwalnianie :: domu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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