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

Wysłany: 2020-11-29, 18:11


TheHeniu







Wiek: 23
Na forum: 3585 dni
Posty: 25
Nick w MP: Arbuziik

Piwa: 607

Respekt: 60

Witam, mam pytanie czy da si? zrobi? usuwanie organizacji ?

Mia?em pomys? przerobi? tworzenie organizacji kod:

s_lua

--[[
    System tworzenia organizacji
    @author Malentas
    @dla gtao.pl
    Zakaz usuwania autora!
    Uzupe?nij swoje x,y,z
]]

local markerek = createMarker(1386.29, 1408.48, 10.91-1, "cylinder", 1.0, 50, 90, 200, 75)
setElementDimension(markerek, 1)

local text=createElement("text")
setElementData(text,"name","Zak?adanie organizacji\nKoszt 850 000\nWymagania: 1500 Reputacji")
setElementPosition(text,1386.29, 1408.48, 10.91)
setElementDimension(text,1)

addEvent("zalozs", true)
addEventHandler("zalozs", root, function(nazwa)
if tonumber(getElementData(source, "player:srp")) < 1500 then
exports['noti']:showBox(source,"warning","Nie posiadasz 1500 RP.")
return
end
if getElementData(source, "player:organization") then
exports['noti']:showBox(source,"warning","Posiadasz organizacje.")
return
end
if tonumber(getPlayerMoney(source)) < 850000 then
exports['noti']:showBox(source,"warning","Nie sta? si? na organizacje.")
return
end
takePlayerMoney(source,850000)
setElementData(source, "player:organization", nazwa)
exports["pystories-db"]:dbSet("INSERT INTO ms_organizacje SET uid=?, code=?, rank=?, login=?", getElementData(source, "player:sid"), nazwa, "4", getPlayerName(source))
exports['noti']:showBox(source,"error","Pomy?lnie za?o?y?e? organizacje o nazwie "..nazwa.."")
end)


c_lua

local screenW, screenH = guiGetScreenSize()
local sx, sy = guiGetScreenSize()
local px, py = (sx/1920), (sy/1080)
function isMouseIn(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*screenW,cy*screenH
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

podanaNazwa = guiCreateEdit(0.42, 0.47, 0.13, 0.04, "Podaj nazwe organizacji",false)    
local font1 = dxCreateFont(":pseudol-nametagi/f/droid-sans.ttf", 12)
local font11 = dxCreateFont(":pseudol-nametagi/f/droid-sans.ttf", 10)
local font12 = dxCreateFont(":pseudol-nametagi/f/droid-sans.ttf", 10)
guiSetVisible(podanaNazwa, false)  
name = getPlayerName(localPlayer)

function isMouseIn ( x, y, width, height )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end


local anims, builtins = {}, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve"}

function table.find(t, v)
    for k, a in ipairs(t) do
        if a == v then
            return k
        end
    end
    return false
end

function animate(f, t, easing, duration, onChange, onEnd)
    assert(type(f) == "number", "Bad argument @ 'animate' [expected number at argument 1, got "..type(f).."]")
    assert(type(t) == "number", "Bad argument @ 'animate' [expected number at argument 2, got "..type(t).."]")
    assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
    assert(type(duration) == "number", "Bad argument @ 'animate' [expected function at argument 4, got "..type(duration).."]")
    assert(type(onChange) == "function", "Bad argument @ 'animate' [expected function at argument 5, got "..type(onChange).."]")
    table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
    return #anims
end

function destroyAnimation(a)
    if anims[a] then
        table.remove(anims, a)
    end
end

addEventHandler("onClientRender", root, function( )
    local now = getTickCount( )
    for k,v in ipairs(anims) do
        v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
        if now >= v.start+v.duration then
            if type(v.onEnd) == "function" then
                v.onEnd( )
            end
            table.remove(anims, k)
        end
    end
end)




function gui()
    dxDrawRectangle(686*px, 327*py, 507*px, 394*py, tocolor(20, 20, 20, 220), false)
    dxDrawRectangle(screenW * 0.3568, screenH * 0.3028, screenW * 0.2646, screenH * 0.0306, tocolor(0, 183, 138), false)

    dxDrawText("Usuwanie organizacji", screenW * 0.4396+1, screenH * 0.3065+1, screenW * 0.5427+1, screenH * 0.3296+1, tocolor(0,0,0, a), 1.00, font1, "center", "center", false, false, false, false, false)
    dxDrawText("Usuwanie organizacji", screenW * 0.4396, screenH * 0.3065, screenW * 0.5427, screenH * 0.3296, tocolor(255, 255, 255, a), 1.00, font1, "center", "center", false, false, false, false, false)

    dxDrawText("Witaj "..name.."!\nTutaj za?o?ysz swoj? organizacje.\nKoszt to 850.000 $\nAby za?o?y? organizacje musisz posiada? 1500 RP!", screenW * 0.3677+1, screenH * 0.3407+1, screenW * 0.6135+1, screenH * 0.4907+1, tocolor(0,0,0, a), 1.00, font11, "center", "center", false, false, false, false, false)
    dxDrawText("Witaj "..name.."!\nTutaj za?o?ysz swoj? organizacje.\nKoszt to 850.000 $\nAby za?o?y? organizacje musisz posiada? 1500 RP!", screenW * 0.3677, screenH * 0.3407, screenW * 0.6135, screenH * 0.4907, tocolor(222,222,222, a), 1.00, font11, "center", "center", false, false, false, false, false)

        if isMouseIn(screenW * 0.3854, screenH * 0.5935, screenW * 0.2120, screenH * 0.0454) then
            --dxDrawImage(screenW * 0.3854, screenH * 0.5935, screenW * 0.2120, screenH * 0.0454, ":im-zakladanieorg/anuluj.png", 0, 0, 0, tocolor(0, 183, 138), false)
            dxDrawText("Anuluj", screenW * 0.4385, screenH * 0.6065, screenW * 0.5417, screenH * 0.6296, tocolor(0, 183, 138), 1.00, font12, "center", "center", false, false, false, false, false)   
            else 
                --dxDrawImage(screenW * 0.3854, screenH * 0.5935, screenW * 0.2120, screenH * 0.0454, ":im-zakladanieorg/anuluj.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
                dxDrawText("Anuluj", screenW * 0.4385, screenH * 0.6065, screenW * 0.5417, screenH * 0.6296, tocolor(255, 255, 255, 255), 1.00, font12, "center", "center", false, false, false, false, false)  
            end 
            if isMouseIn(screenW * 0.3854, screenH * 0.5352, screenW * 0.2120, screenH * 0.0454) then 
                --dxDrawImage(screenW * 0.3854, screenH * 0.5352, screenW * 0.2120, screenH * 0.0454, ":im-zakladanieorg/stworz.png", 0, 0, 0, tocolor(0, 183, 138), false)
                dxDrawText("Usu?", screenW * 0.4385, screenH * 0.5481, screenW * 0.5417, screenH * 0.5713, tocolor(0, 183, 138), 1.00, font12, "center", "center", false, false, false, false, false)
            else 
                --dxDrawImage(screenW * 0.3854, screenH * 0.5352, screenW * 0.2120, screenH * 0.0454, ":im-zakladanieorg/stworz.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
                dxDrawText("Usu?", screenW * 0.4385, screenH * 0.5481, screenW * 0.5417, screenH * 0.5713, tocolor(255, 255, 255, 255), 1.00, font12, "center", "center", false, false, false, false, false)
            end
end

addEventHandler("onClientMarkerHit", resourceRoot, function(el)
if el ~= localPlayer then return end
if isCursorShowing ( el ) then return end
addEventHandler("onClientRender", getRootElement(), gui)
showCursor(true)
guiSetVisible(podanaNazwa, true)
animate(0, 239, "Linear", 800, function(value) a = value end)

end)

addEventHandler("onClientMarkerLeave", resourceRoot, function(el)
if el ~= localPlayer then return end
removeEventHandler("onClientRender", getRootElement(), gui)
showCursor(false)
guiSetVisible(podanaNazwa, false)
end)

addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" then
if isMouseIn(screenW * 0.3854, screenH * 0.5352, screenW * 0.2120, screenH * 0.0454) and guiGetVisible(podanaNazwa) then
local nazwa = guiGetText(podanaNazwa)
if nazwa:len() < 2 then
exports['noti']:showBox("info","Zbyt ma?o znak?w.")
return
end
if nazwa:len() > 15 then
exports['noti']:showBox("info","Zbyt du?o znak?w.")
return
end
triggerServerEvent("zalozs", localPlayer, nazwa)
end
end
end)

addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" then
if isMouseIn(screenW * 0.3854, screenH * 0.5935, screenW * 0.2120, screenH * 0.0454) and guiGetVisible(podanaNazwa) then
removeEventHandler("onClientRender", getRootElement(), gui)
showCursor(false)
guiSetVisible(podanaNazwa, false)
showCursor(false)
end
end
end)


Tylko chodzi mi jak wykona? export do bazy aby usuwa?o tak?e sprawdzenie czy j? w og?le ma.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-29, 18:30


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-29, 18:47


TheHeniu







Wiek: 23
Na forum: 3585 dni
Posty: 25
Nick w MP: Arbuziik

Piwa: 607

Respekt: 60

Wilq, mo?esz poda? jaki? przyk?ad ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-29, 19:15


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

DELETE FROM customers WHERE country = "France"


Postaw piwo autorowi tego posta
 

 
Tagi: organizacja
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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