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

Wysłany: 2017-03-16, 18:03


STOPseba

Emeryt na scenie MTA






Wiek: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

Respekt: 576,3
Respekt: 576,3

Witam
!
Witam chcia?em zrobi? spawn w panelu logowania do domu ale i? mam taki problem ze nie wiem jak to zrobi? z tym systemem dom?w chodzi tu o co? takiego jak "player:house" na ya ist itp Je?li kto? wie jak to zrobi? lub mnie nakieruje z g?ry Dzi?kuje.


(system dom?w Aspera)
C:

--[[
AutorAsper
SkryptSystem domow
Dla: .newMode
]]

bindKey'i''both', function( keykeyState )
    if keyState == 'down' then
        for kv in ipairs getElementsByType'colshape'resourceRoot ) ) do
            local dom=getElementData(v,"dom")
            if tonumber(dom.wlascicielthen
                createBlipAttachedTov322255,0,0,255,100,500 );
            else
                createBlipAttachedTov312255,0,0,255,100,500 );
            end
        end
    else
        for kv in ipairsgetElementsByType'blip'getResourceRootElement() ) ) do
            destroyElement(v)
        end
    end

end)

local screenWscreenH guiGetScreenSize()
local sxsy guiGetScreenSize()

function mysz(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

local ustawienia nil
local panel false

local edit guiCreateEdit(0.7860.480.1590.057"1"true)
guiSetVisible(editfalse)
guiEditSetMaxLength(edit2)
guiSetAlpha(edit0.5)
local c guiCreateFont":nm-noti/czcionka.ttf"10 )
guiSetFont(editc)

local czcionka dxCreateFont(":nm-geodeta/czcionka.ttf"10)
if not czcionka then czcionka "default-bold" end

function guiKupno()
  exports["nm-blur"]:dxDrawBluredRectangle(screenW 0.7357screenH 0.3112screenW 0.2504screenH 0.3802tocolor(150150150255))
  dxDrawRectangle(screenW 0.7357screenH 0.3099screenW 0.2504screenH 0.0599tocolor(2575125155), false)
  local info "Panel kupna domu"
  if ustawienia.wlasciciel == getElementData(localPlayer"dbid"then
    info "Panel przed?u?ania domu"
  end
  local dni "Ilo?? dni"
  if ustawienia.wlasciciel == getElementData(localPlayer"dbid"then
    dni "Ilo?? dni\n(( Dom jest op?acony do "..ustawienia.data.."))"
  end
  dxDrawText(info, (screenW 0.7357) + 1, (screenH 0.3099) + 1, (screenW 0.9861) + 1, (screenH 0.3698) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  dxDrawText(infoscreenW 0.7357screenH 0.3099screenW 0.9861screenH 0.3698tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  dxDrawText(dniscreenW 0.7650screenH 0.4010screenW 0.9612screenH 0.4674tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  dxDrawRectangle(screenW 0.7877screenH 0.4805screenW 0.1552screenH 0.0560tocolor(255255255255), false)
  if mysz(screenW 0.7804screenH 0.5742screenW 0.1713screenH 0.0677then
    dxDrawRectangle(screenW 0.7804screenH 0.5742screenW 0.1713screenH 0.0677tocolor(2575125180), false)
  else
    dxDrawRectangle(screenW 0.7804screenH 0.5742screenW 0.1713screenH 0.0677tocolor(2575125125), false)
  end
  dxDrawText("Zakup dom o id "..ustawienia.id, (screenW 0.7796) + 1, (screenH 0.5742) + 1, (screenW 0.9517) + 1, (screenH 0.6419) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  dxDrawText("Zakup dom o id "..ustawienia.idscreenW 0.7796screenH 0.5742screenW 0.9517screenH 0.6419tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  if mysz(screenW 0.7423screenH 0.6445screenW 0.0300screenH 0.0417then
    dxDrawRectangle(screenW 0.7423screenH 0.6445screenW 0.0300screenH 0.0417tocolor(2575125180), false)
  else
    dxDrawRectangle(screenW 0.7423screenH 0.6445screenW 0.0300screenH 0.0417tocolor(2575125125), false)
  end
  dxDrawText("X", (screenW 0.7423) + 1, (screenH 0.6445) + 1, (screenW 0.7723) + 1, (screenH 0.6862) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  dxDrawText("X"screenW 0.7423screenH 0.6445screenW 0.7723screenH 0.6862tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
end

function gui()
  local nazwa ustawienia.nazwa
  exports["nm-blur"]:dxDrawBluredRectangle(screenW 0.3360screenH 0.2552screenW 0.3280screenH 0.4909tocolor(150150150255))
  dxDrawRectangle(screenW 0.3360screenH 0.2552screenW 0.3280screenH 0.0495tocolor(2575125155), false)
  dxDrawText(nazwa, (screenW 0.3360) + 1, (screenH 0.2552) + 1, (screenW 0.6640) + 1, (screenH 0.3047) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  dxDrawText(nazwascreenW 0.3360screenH 0.2552screenW 0.6640screenH 0.3047tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  local wlasciciel ustawienia.nwlasciciel
  local cena string.format("%1.2f"ustawienia.cena)
  local id ustawienia.id
  local status "OFFLINE"
  if getPlayerFromName(wlascicielthen
    status "ONLINE"
  end
  local info wlasciciel.." ("..status..")"
  if wlasciciel == "brak" then
    info "brak"
  end
  dxDrawText("ID domku: "..id.."\nW?a?ciciel domku: "..info.."\nCena domku "..cena.." PLN", (screenW 0.3463) + 1, (screenH 0.3516) + 1, (screenW 0.6486) + 1, (screenH 0.5130) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  dxDrawText("ID domku: "..id.."\nW?a?ciciel domku: "..info.."\nCena domku "..cena.." PLN"screenW 0.3463screenH 0.3516screenW 0.6486screenH 0.5130tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  if mysz(screenW 0.3536screenH 0.6003screenW 0.1384screenH 0.0755then
    dxDrawRectangle(screenW 0.3536screenH 0.6003screenW 0.1384screenH 0.0755tocolor(2575125180), false)
  else
    dxDrawRectangle(screenW 0.3536screenH 0.6003screenW 0.1384screenH 0.0755tocolor(2575125125), false)
  end
  dxDrawText("Zobacz dom", (screenW 0.3536) + 1, (screenH 0.5990) + 1, (screenW 0.4919) + 1, (screenH 0.6758) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  dxDrawText("Zobacz dom"screenW 0.3536screenH 0.5990screenW 0.4919screenH 0.6758tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  if mysz(screenW 0.4092screenH 0.5091screenW 0.1786screenH 0.0638then
    dxDrawRectangle(screenW 0.4092screenH 0.5091screenW 0.1786screenH 0.0638tocolor(2575125180), false)
  else
    dxDrawRectangle(screenW 0.4092screenH 0.5091screenW 0.1786screenH 0.0638tocolor(2575125125), false)
  end
  local bnapis ""
  if ustawienia.wlasciciel ~= "brak" and ustawienia.wlasciciel ~= getElementData(localPlayer"dbid"then
    bnapis "Dom zosta? ju? wynaj?ty"
  elseif ustawienia.wlasciciel == "brak" then
    bnapis "Kup dom"
  elseif ustawienia.wlasciciel ~= "brak" and ustawienia.nwlasciciel == getPlayerName(localPlayerthen
    bnapis "Przed?u? dom"
  end
  dxDrawText(bnapis, (screenW 0.4092) + 1, (screenH 0.5078) + 1, (screenW 0.5878) + 1, (screenH 0.5729) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  dxDrawText(bnapisscreenW 0.4092screenH 0.5078screenW 0.5878screenH 0.5729tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  if ustawienia.wlasciciel == getElementData(localPlayer"dbid"then
    if mysz(screenW 0.5066screenH 0.6003screenW 0.1384screenH 0.0755then
      dxDrawRectangle(screenW 0.5066screenH 0.6003screenW 0.1384screenH 0.0755tocolor(2575125180), false)
    else
      dxDrawRectangle(screenW 0.5066screenH 0.6003screenW 0.1384screenH 0.0755tocolor(2575125125), false)
    end
    dxDrawText("Zwolnij dom", (screenW 0.5066) + 1, (screenH 0.5990) + 1, (screenW 0.6449) + 1, (screenH 0.6758) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("Zwolnij dom"screenW 0.5066screenH 0.5990screenW 0.6449screenH 0.6758tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
  end
end

addEventHandler("onClientClick"root, function(bs)
  if ~= "state" and ~= "down" then return end
  if mysz(screenW 0.3536screenH 0.6003screenW 0.1384screenH 0.0755) and panel == true then
    triggerServerEvent("tdDomu"localPlayerustawienia.xustawienia.yustawienia.zustawienia.intustawienia.id)
  elseif mysz(screenW 0.5066screenH 0.6003screenW 0.1384screenH 0.0755) and panel == true then
    if ustawienia.wlascciel ~= "brak" and ustawienia.wlasciciel ~= getElementData(localPlayer"dbid"then return end
    triggerServerEvent("zDom"localPlayerustawienia.id)
    exports["nm-noti"]:noti("Pomy?lnie zwolni?e? dom o id "..ustawienia.id)
  elseif mysz(screenW 0.4092screenH 0.5091screenW 0.1786screenH 0.0638) and panel == true then
    if ustawienia.wlasciciel ~= "brak" and ustawienia.wlasciciel ~= getElementData(localPlayer"dbid"then return end
    addEventHandler("onClientRender"rootguiKupno)
    guiSetVisible(edittrue)
  elseif mysz(screenW 0.7423screenH 0.6445screenW 0.0300screenH 0.0417) and guiGetVisible(edit) == true then
    guiSetVisible(editfalse)
    removeEventHandler("onClientRender"rootguiKupno)
  elseif mysz(screenW 0.7804screenH 0.5742screenW 0.1713screenH 0.0677) and guiGetVisible(edit) == true then
    local text guiGetText(edit)
    if not tonumber(textthen return end
    if tonumber(text) < 1 then
      exports["nm-noti"]:noti("Ilo?? dni musi przekraca? minimum zero.")
      return
    end
    triggerServerEvent("kDom"localPlayerustawienia.idtonumber(text), ustawienia.cena)
  end
end)

addEventHandler("onClientColShapeHit"resourceRoot, function(hit)
  if hit ~= localPlayer then return end
  local dom getElementData(source"dom")
  if not dom then return end
  if panel == true then return end
  ustawienia dom
  showCursor(truefalse)
  panel true
  addEventHandler("onClientRender"rootgui)
end)

addEventHandler("onClientMarkerHit"resourceRoot, function(hit)
  if hit ~= localPlayer then return end
  if getElementDimension(source) ~= getElementDimension(hitthen return end
  local wdom getElementData(source"wdom")
  if not wdom then return end
  triggerServerEvent("tdDomu"hitwdom.xwdom.ywdom.z)
end)

addEventHandler("onClientColShapeLeave"resourceRoot, function(hit)
  if hit ~= localPlayer then return end
  local dom getElementData(source"dom")
  if not dom then return end
  ustawienia false
  showCursor(false)
  panel false
  removeEventHandler("onClientRender"rootgui)
  if guiGetVisible(edit) == true then
    removeEventHandler("onClientRender"rootguiKupno)
    guiSetVisible(editfalse)
  end
end)

S:
--[[
AutorAsper
SkryptSystem domow
Dla: .newMode
]]

addEventHandler("onResourceStart"resourceRoot, function()
    local q exports.mysql:wykonaj("SELECT * FROM domy")
    for i,v in ipairs(q) do
        v.wejscie split(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 split(v.wyjscie",")
        v.tpw split(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,
        })
        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)

function refreshDomy()
    local q exports.mysql:wykonaj("SELECT * FROM domy")
    for i,v in ipairs(q) do
    local qq exports.mysql:wykonaj("SELECT * FROM domy WHERE id=?"v.id)
    local t getRealTime()
    local r t.year
    local m t.month
    local t t.monthday
    r r+1900
    m m+1
    if 10 then
        t "0"..t
    end
    local data r.."-"..m.."-"..t
    if qq[1].data == data then
        exports.mysql:wykonaj("UPDATE domy SET wlasciciel=0, nwlasciciel=?, data=? WHERE id=?""""0000-00-00"q[1].id)
        restartResource(getThisResource())
    end
    end
end
setTimer(refreshDomy36000000)

addCommandHandler("dom", function(g_c, ...)
    if ... and and getElementData(g"duty"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.mysql:wykonaj("INSERT INTO domy SET wlasciciel=0, nwlasciciel=?, nazwa=?, data=?, wejscie=?, wyjscie=?, tpw=?, cena=?"""n"0000-00-00"wejscie"318.61, 1114.48, 1083.88""318.39, 1116.68, 1083.88"c)
        restartResource(getThisResource())
    end
end)

addEvent("zDom"true)
addEventHandler("zDom"root, function(id)
    exports.mysql:wykonaj("UPDATE domy SET wlasciciel=0, nwlasciciel=?, data=? WHERE id=?""""0000-00-00"id)
    restartResource(getThisResource())
end)

local function getPlayerDBID(plr)
    local c=getElementData(plr,"dbid")
    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 getElementData(client"pieniadze")
    koszt dni*koszt
    koszt string.format("%1.2f"koszt)
    if tonumber(koszt) > hajs then
        exports["nm-noti"]:noti("Nie sta? ci? na zakup tego domu, potrzebujesz "..koszt.." PLN."client)
        return
    end
    local r exports.mysql:wykonaj("UPDATE domy SET wlasciciel=?,nwlasciciel=?,data=IF(data>NOW(),data,NOW())+INTERVAL ? DAY WHERE id=?"dbidgetPlayerName(client), dniid)
    setElementData(client"pieniadze"hajs-koszt)
    exports["nm-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)


Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
wirtox
Wysłany: 2017-03-16, 18:52


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

przy respie pobierasz czy gracz ma jakis dom jesli ma to tworzysz rectangle i przy kliknieciu pobierasz kordy x,y,z, z bazy danych i spawnujesz graczy tam

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
STOPseba
Wysłany: 2017-03-16, 19:12


STOPseba

Emeryt na scenie MTA






Wiek: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

Respekt: 576,3
Respekt: 576,3

HazeMaFaze, W?a?nie chodzi tu o sprawdzenie czy gracz ma dom nie wiem jak to zrobi? :(

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-16, 20:18


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

lol
zapytanie takie zr?b "Select * From domy Where wlasciciel = ?", wlasciciel
i wtedy w petle robisz domy i tworzysz tyle rectangle ile ma gracz dom?w i jak kliknie to respi go :P

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
STOPseba
Wysłany: 2017-03-18, 11:37


STOPseba

Emeryt na scenie MTA






Wiek: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

Respekt: 576,3
Respekt: 576,3

HazeMaFaze, a mo?e jaki? przyk?ad lub co? bo nigdy tego nie robi?em :D

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-03-18, 13:50


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

Zwyk?e zapytanie w mysql... Polecam poradnik lukiego obejrze?.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
STOPseba
Wysłany: 2017-03-18, 16:45


STOPseba

Emeryt na scenie MTA






Wiek: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

Respekt: 576,3
Respekt: 576,3

@Lock

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Tagi: system :: domów :: aspera
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » System domów Aspera 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