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

Wysłany: 2017-12-01, 20:40


Hiroszekk







Wiek: 24
Na forum: 3453 dni
Posty: 113
Nick w MP: Hiroszek

Piwa: 845

Respekt: -84,3

Ostrzeżeń: 20%
Witam. Mam taki kod po stronie serwera

addEvent("dajprezent",true)
addEventHandler("dajprezent",resourceRoot,function()
local uid = getElementData(source,"player:uid")
local dbid = getElementData(source,"player:uid")
exports['ogrpg-db']:dbSet("UPDATE ogrpg_users SET prez=? WHERE id=?",1,uid)
end)


local days = 1

addEvent("dajpremium",true)
addEventHandler("dajpremium",resourceRoot,function()
if exports['ogrpg-db']:dbGet('SELECT 1 FROM ogrpg_users WHERE prez=? AND id=? LIMIT 1;', "1", uid) then
outputChatBox("test", thePlayer, 255, 0, 0, true)
else
exports['ogrpg-db']:dbSet(string.format("UPDATE ogrpg_users SET premiumdate = DATE(curdate()) + INTERVAL %d DAY WHERE id=%d",days,getElementData(client,"player:uid")))
        triggerEvent("save:player",root,client)
        triggerEvent("load:player",root,client)
    end
end)



i taki po stronie clienta

--createBlip(1482.05, -1685.51, 14.05,26, 2, 255,0,0,255,0,400)
-- Skrypt na prezenty Edit by LooK

local marker = createMarker(-102.74, -253.85, 51.82-1, "cylinder", 2, 255, 255, 255, 25)
local t=createElement("text")
setElementPosition(t, 1412382.05, -1685.51, 14.05)
setElementData(t,"name","Odbierz prezent swiateczny!\nDostepne juz wkrotce!")

local wm={}
wm.window=guiCreateWindow(0.38, 0.30, 0.25, 0.35, "Odbieranie prezentu", true)
guiWindowSetSizable(wm.window, false)
guiWindowSetMovable(wm.window, false)
guiSetVisible(wm.window, false)
wm.label=guiCreateLabel(0.02, 0.02, 0.96, 0.25, "Z ponizszej listy wybierz przezent ktory chcesz otrzymac.\n Mozesz wybrac tylko jeden prezent na serial!", true, wm.window)
guiLabelSetHorizontalAlign(wm.label, "center", false)
guiLabelSetVerticalAlign(wm.label, "center")
guiGridListAddColumn(wm.gridlist, "Mozesz wybrac tylko jedna rzecz na serial", 0.5)
wm.close=guiCreateButton(0.32, 0.83, 0.36, 0.13, "Anuluj", true, wm.window)
faggio=guiCreateButton(0.32, 0.63, 0.36, 0.13, "Faggio", true, wm.window)
hajs=guiCreateButton(0.32, 0.43, 0.36, 0.13, "20 000 PLN", true, wm.window)
premka=guiCreateButton(0.32, 0.23, 0.36, 0.13, "Premium 1 Dzien", true, wm.window)






addEventHandler("onClientGUIClick", wm.close, function()
    if not guiGetVisible(wm.window) then return end
    showCursor(false)
    guiSetVisible(wm.window, false)
            outputChatBox("Anulowales wybor prezentu.")
end)



addEventHandler("onClientGUIClick", premka, function()
    if not guiGetVisible(wm.window) then return end
    showCursor(false)
    guiSetVisible(wm.window, false)
        outputChatBox("Wybrales prezent: Konto Premium na 1 dzien!", 0, 255, 0)
            triggerServerEvent("dajpremium",resourceRoot,prezent)
            triggerServerEvent("dajprezent",resourceRoot,prezent)
                            --destroyElement(marker)
end)


addEventHandler("onClientMarkerHit", marker, function(el,md)
    if not md or el~=localPlayer then return end
    if guiGetVisible(wm.window) then return end
    showCursor(true)
    guiSetVisible(wm.window,true)
    end)



Chodzi o to ,?e w bazie danych mam w kolumnie "prez" ustawione 0 czyli po stronie serwera w 'dajprezent' nie powinno mi wy?wietla? "test" na chacie lecz dawa? premke.
Tak si? nie dzieje wy?wietla na chacie "test" tak jakbym mia? ustawione 1
Pomo?e ktu?? Daje piwo

Postaw piwo autorowi tego posta
 

 
Tagi: prezent :: mikołaja
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » prezent u mikołaja 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