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

Wysłany: 2020-07-22, 00:24


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Witam, mam problem z respem obok domu, niby wszystko jest dobrze ale jednak nie respi.

Domki
-- Add a new event called onSpecialEvent
addEvent "SprawdzDom"true )
-- Define our handler function
function SprawdzDom gracz )
    local q=exports["pystories-db"]:dbGet("select id,house from pystories_users where id=? and house IS NOT NULL"getElementData(gracz,"player:sid"))
    if #q < 1 then
    local dbdomy=exports["pystories-db"]:dbGet("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid AND d.ownerid IS NOT NULL;")
    for __,v in ipairs(dbdomy) do
        local uid=tonumber(getElementData(gracz,"player:sid"))
        local r=v.ownerid
        v.drzwi=split(v.drzwi,",")
        for ii,vv in ipairs(v.drzwi) do        v.drzwi[ii]=tonumber(vv)    end
        if r then if == uid then 
        setElementData(gracz,"player:house", {v.drzwi[1],v.drzwi[2],v.drzwi[3]})
        end end
    end
        elseif #q > 0 then
        local qr=exports["pystories-db"]:dbGet("select ownerid,drzwi,id from lss_domy where id=?"q[1].house)
        for i,v in ipairs(qr) do
        local uid=tonumber(getElementData(gracz,"player:sid"))
        v.drzwi=split(v.drzwi,",")
        for ii,vv in ipairs(v.drzwi) do        v.drzwi[ii]=tonumber(vv)    end
        setElementData(gracz,"player:house", {v.drzwi[1],v.drzwi[2],v.drzwi[3]})
        end
    end
end
-- Add the event handler
addEventHandler "SprawdzDom"rootSprawdzDom )


Panel logowania

addEventHandler("onClientClick"root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(button_1.xbutton_1.ybutton_1.widthbutton_1.height) and data.showed then
         setElementData(localPlayer,"player:spawn",{813.31, -1343.2513.53+0.1})
         closeZones()
        
        end
        if isMouseIn(button_1.xbutton_1.y_2button_1.widthbutton_1.height) and data.showed then
         setElementData(localPlayer,"player:spawn",{693.62, -1576.0714.24+0.1})
         closeZones()
        end
        if isMouseIn(button_1.xbutton_1.y_3button_1.widthbutton_1.height) and data.showed then
        setElementData(localPlayer,"player:spawn",{-1983.78137.9527.69+0.1})
        closeZones()
        end
        if isMouseIn(button_1.xbutton_1.y_4button_1.widthbutton_1.height) and data.showed then
        setElementData(localPlayer,"player:spawn",{1882.832133.2810.82+0.1})
        closeZones()
        end
        if isMouseIn(button_1.xbutton_1.y_5button_1.widthbutton_1.height) and data.showed then
        local domek=getElementData(localPlayer,"player:house")
        if not domek then
        setElementData(localPlayer,"player:spawn",{813.31, -1343.2513.53+0.1})
        outputChatBox("* Nie posiadasz domku, lub straci? wa?no??.")
        end
        closeZones()
        end
    end
end)


Podpis


Modern Stories
Discord
https://discord.gg/MRJSYq8
Forum
https://msmta.pl
Panel Gracza
https://panel.msmta.pl
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-22, 07:44


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

W dolnym kodzie nie ustawiasz graczowi element daty player:spawn z danymi z element daty player:house.

Btw. Je?li wszystko jest dobrze, to czemu niby nie dzia?a?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-22, 13:44


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
No to jak to zrobi? ?eby gracz respi? si? przy domku, jak zrobi? aby w player:spawn by?y dane z player:house?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-22, 15:02


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8


Więcej informacji znajdziesz w Wikipedii MTA:

getElementData


Więcej informacji znajdziesz w Wikipedii MTA:

setElementData


Pobierasz dane z 1 element daty i zapisujesz te dane 2 element dacie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-22, 17:25


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Jak pobra? z elementDaty wartosci tabelowe oraz jak je zapisa? maj?c kolejn? warto?? - to jest odpowiedz na twoje pytanie :


x,y,z=getElementPosition(gracz)
setElementData(gracz,"pos",{x,y,z})

x,y,z=unpack(getElementData(gracz,"pos"))
money=getPlayerMoney(gracz)
setElementData(gracz,"pos",{x,y,z,money})


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-23, 01:14


Matikmontana

Modern Stories






Wiek: 22
Na forum: 2473 dni
Posty: 423
Nick w MP: Mazeusz*

Piwa: 1015

Respekt: 130
Respekt: 130

Ostrzeżeń: 60%
Dzi?ki za pomoc uda?o mi si? to ogarna? :*


Dla przysz?ych pokole? pseudol?w trzeba by?o zrobi? tak:
addEvent "SprawdzDom"true )
-- Define our handler function
function SprawdzDom gracz )
    local dbdomy=exports["pystories-db"]:dbGet("SELECT d.id,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid AND d.ownerid IS NOT NULL;")
    for __,v in ipairs(dbdomy) do
        local uid=tonumber(getElementData(gracz,"player:sid"))
        local r=v.ownerid
        v.drzwi=split(v.drzwi,",")
        for ii,vv in ipairs(v.drzwi) do        v.drzwi[ii]=tonumber(vv)    end
        if r then if == uid then setElementData(gracz,"player:house",truesetElementData(gracz,"player:spawn",{v.drzwi[1],v.drzwi[2],v.drzwi[3]}) end end
    end     
end
-- Add the event handler
addEventHandler "SprawdzDom"rootSprawdzDom )


Postaw piwo autorowi tego posta
 

 
Tagi: spawn :: przy :: domku :: lss_domy
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