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

Wysłany: 2020-02-28, 21:15


SenpaiDarciok







Wiek: 27
Na forum: 2320 dni
Posty: 10
Nick w MP: Devon/Darecki



Respekt: 50

Przy odebraniu wyplaty kasa idzie do eq (99mln tego) a chce zeby sz?a do banku ;/

S:
local factions = {
["SAPD"] = 800000,
["SAFD"] = 800000,
["SAMD"] = 800000,
["SARA"] = 800000,
}

function getwyplata(el,md)
    local uid getElementData(el,"player:sid")
    local result=exports["pystories-db"]:dbGet("SELECT * FROM pystories_factions WHERE sid=?"uid)
    if #result > 0 then
        if factions[result[1].codethen
            if getElementData(el,"player:workinjob") and getElementData(el,"player:workinjob") >= 60 then
                local money = (factions[result[1].code] * getElementData(el,"player:workinjob"))
                local czas getElementData(el,"player:workinjob")
                setElementData(el,"player:workinjob",0)
                exports["pystories-db"]:dbSet("UPDATE pystories_users SET worker=? WHERE id=?""0"getElementData(el"player:sid"))
                outputChatBox("Trwa przetwarzanie twoich danych..."el)
                setTimer ( function()
                setElementData(el,"player:workinjob",0)
                exports["pystories-db"]:dbSet("UPDATE pystories_users SET worker=? WHERE id=?""0"getElementData(el"player:sid"))
                exports["pystories-db"]:dbSet("UPDATE pystories_factions SET wyplat=wyplat+?, ostatnia_wyplata=now() WHERE sid=?"moneygetElementData(el"player:sid"))
                outputChatBox("Otrzymujesz "..money.." PLN za przepracowane na s?u?bie "..czas.." minut!"el)
                givePlayerMoney(el,money)
                setElementData(el,"player:workinjob",0)
                end50001)
                exports["pystories-db"]:dbSet("UPDATE pystories_users SET worker=? WHERE id=?""0"getElementData(el"player:sid"))
                setElementData(el,"player:workinjob",0)
            else
                outputChatBox("Nie masz przepracowane minimum godziny na s?u?bie!"el)
            end
        else
            outputChatBox("W twojej frakcji nie ma skonfigurowanego otrzymywania wyp?at"el)
        end
    end
end
addEvent("getwyplata"true)
addEventHandler("getwyplata"resourceRootgetwyplata)

C:
ww,hh 19201080
www,hhh guiGetScreenSize()
w= (www/ww), (hhh/hh)

local wyplatafont1 dxCreateFont(":pseudol-nametagi/f/droid-sans.ttf"13)
local wyplatafont2 dxCreateFont(":pseudol-nametagi/f/droid-sans.ttf"17)
local wyplatafont3 dxCreateFont(":pseudol-nametagi/f/droid-sans.ttf"22)

function nankymouse(xywh)
    if (not isCursorShowing()) then
        return false
    end
    local mxmy getCursorPosition()
    local fullxfully guiGetScreenSize()
    cursorxcursory mx*fullxmy*fully
    if cursorx and cursorx and cursory and cursory h then
        return true
    else
        return false
    end
end

function nankyrectangle(xywhcolor)
    dxDrawRectangle(xywhcolorfalse)
    dxDrawRectangle(2141colorfalse)
    dxDrawRectangle(2h41colorfalse)
    dxDrawRectangle(1214colorfalse)
    dxDrawRectangle(w214colorfalse)
end
local markery = {
{940.37, -1443.5713.581.2,"Odebranie wyp?aty ze s?u?by"},
}
for i,v in pairs(markery) do
local marker=createMarker(v[1], v[2], v[3]-1"cylinder"v[4], 0,102,255)
local text=createElement("text")
setElementData(text,"name",v[5])
setElementDimension(text1)
setElementDimension(marker1)
setElementPosition(text,v[1], v[2], v[3])
panel false

function wyplatagui()
        nankyrectangle(658*w292*h604*w497*htocolor(000162), false)
        nankyrectangle(658*w269*h604*w27*htocolor(00255255), false)
        dxDrawText("Panel odbierania wyp?at frakcyjnych"659*w270*h1262*w296*htocolor(255255255255), 1*wwyplatafont1"center""center"falsefalsefalsefalsefalse)
        dxDrawText("Tutaj mo?esz odebra? wyp?at? frakcyjn?.\n\nAby dokona? wyp?aty wci?nij przycisk wyp?a?.\nAby zamkn?? panel wyp?at wci?nij przycisk zamknij panel."669*w480*h1252*w461*htocolor(255255255255), 1*wwyplatafont2"center""center"falsefalsefalsefalsefalse)
        if nankymouse(679*w655*h215*w110*hthen nankyrectangle(679*w655*h215*w110*htocolor(00255150), false) else nankyrectangle(679*w655*h215*w110*htocolor(00255255), falseend
        if nankymouse(1027*w655*h215*w110*hthen nankyrectangle(1027*w655*h215*w110*htocolor(00255150), false) else nankyrectangle(1027*w655*h215*w110*htocolor(00255255), falseend
        dxDrawText("Wyp?a?"679*w655*h894*w765*htocolor(255255255255), 1*wwyplatafont3"center""center"falsefalsefalsefalsefalse)
        dxDrawText("Zamknij\npanel"1027*w655*h1242*w765*htocolor(255255255255), 1*wwyplatafont3"center""center"falsefalsefalsefalsefalse)                 
end


function uruchom(el,md)
if el~=localPlayer then return end
if panel == false then
addEventHandler("onClientRender",root,wyplatagui)
czas getTickCount()
panel true
showCursor(true)
end
end
addEventHandler('onClientMarkerHit',marker,uruchom)

function closepanel(buttonstate)
    if panel and button == "left" and state == "down" then
           if nankymouse(1027*w655*h215*w110*hthen
           removeEventHandler ("onClientRender"rootwyplatagui)
           panel false
           showCursor(false) 
         end
    end
end
addEventHandler("onClientClick"getRootElement(), closepanel)

function getwyplata(buttonstate)
    if panel and button == "left" and state == "down" then
           if nankymouse(679*w655*h215*w110*hthen 
           triggerServerEvent("getwyplata"root,localPlayer)
         end
    end
end
addEventHandler("onClientClick"getRootElement(), getwyplata)
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-02-28, 22:02


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No to wykonaj zapytanie do bazy danych MySQL z funkcj? UPDATE dla kolumny z pieni?dzmi zamiast givePlayerMoney.

Luknij na poni?sz? linijk?, pozmieniaj max 2 s?owa (worker= no i argument po przecinku za kwot?).

exports["pystories-db"]:dbSet("UPDATE pystories_users SET worker=? WHERE id=?""0"getElementData(el"player:sid"))


Postaw piwo autorowi tego posta
 

 
Tagi: wypłata :: frakcji
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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