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

Wysłany: 2017-10-21, 12:23


Husky123







Wiek: 20
Na forum: 3320 dni
Posty: 45
Nick w MP: fabeN

Piwa: 750

Respekt: 60

Pomo?e mi kto? zrobi? org na paczce OWN bo chce zrobi? serwer na tej paczce.
Ale nie dzia?aj? mi Organizacje.

Tak wiem, ?e nie ten dzia? tylko potrzebuje szybko pomocy.

Napiscie w jakim skrypcie jest b??d i jak go naprawi? b?d? wdzi?czny.


Zrobi?em takie ?eczy ale i tak nie dzia?a?o:
-doda?em si? do organizacji.

Oto kody

--[[
    System kont graczy w oparciu o MySQL
    @author value <value2k@gmail.com>
    Nie masz prawa u?ytego kodu bez mojej zgody
]]
addEvent("onPlayerAccountLogin"true)
local defpos "-1503.07,920.32,7.19, 90, 0, 0" -- Domy?lna pozycja musi byw stringu!

function auth(usernamepassword)
    if not username then
        exports.rpg_noti:createNotification(source"error""B??d podczas pr?by logowania, zg?o? to administratorowi na forum [ERR01]")
        return
    end
    if not password then
        exports.rpg_noti:createNotification(source"error""B??d podczas pr?by logowania, zg?o? to administratorowi na forum [ERR02]")
        return
    end
    local q exports.rpg_mysql:mysql_query("SELECT * FROM rpg_accounts WHERE username=? AND password=?"usernamemd5(password))
    if #q > 1 then -- Znaleziono wi?cej ni? 1 usera o podanej kombinacji loginu i has?a
        exports.rpg_noti:createNotification(source"error""B??d podczas pr?by logowania, zg?o? to administratorowi na forum [ERR03]")
    elseif #q < 1 then -- Nie znaleziono ?adnego usera o podanej kombinacji loginu i has?a
        exports.rpg_noti:createNotification(source"error""Podana kombinacja nazwy u?ytkownika i has?a jest b??dna")
    else -- Jest tylko jeden userHura!
        for i,p in pairs(getElementsByType("player")) do
        if q[1].uid == getElementData(p"user:uid"then
            exports.rpg_noti:createNotification(source"error""Niestety ale kto? jest ju? zalogowany na podanym koncie")
            return
        end
        end
        local player source
        fadeCamera(playerfalse)
        setPlayerName(playerq[1].username)
        triggerClientEvent(player"cursor:off"player)

        setElementData(player"user:uid"q[1].uid)
        setElementData(player"user:username"q[1].username)
        --setElementData(player"user:email"q[1].email)
        setElementData(player"user:regdate"q[1].regdate)
        setElementData(player"user:lastlogin"q[1].lastlogin)
        setElementData(player"user:serial"q[1].serial)
        setElementData(player"user:ip"q[1].ip)
        setElementData(player"user:skin"q[1].skin)
        setElementData(player"user:money"q[1].money)
        setElementData(player"user:bankmoney"q[1].bankmoney)
        setElementData(player"user:gamescore"q[1].gamescore)
        setElementData(player"user:job"q[1].job)
        setElementData(player"user:jobmoney"q[1].jobmoney)
        setElementData(player"user:pjA"q[1].pjA)
        setElementData(player"user:pjB"q[1].pjB)
        setElementData(player"user:pjC"q[1].pjC)
        setElementData(player"user:pjCE"q[1].pjCE)
        setElementData(player"user:onlinetime"q[1].onlinetime)
        setElementData(player"user:aduty"false)
        setElementData(player"user:licensegornik"q[1].lickag)
        setElementData(player"user:org"q[1].organizacja)
        setElementData(player"user:orgrank"q[1].orgrank)
        setElementData(player"user:fid"q[1].frakcja)
        setElementData(player"user:frank"q[1].franga)
        setElementData(player"user:ftime"q[1].ftime)

        if string.len(q[1].serial) < 1 then
            local serial getPlayerSerial(player)
            local q2 exports.rpg_mysql:mysql_query("UPDATE rpg_accounts SET serial=? WHERE uid=?"serialq[1].uid)
            if not q2 then
                exports.rpg_noti:createNotification(source"error""B??d podczas pr?by logowania, zg?o? to administratorowi na forum [ERR10]")
                return
            end
        end

        if string.len(q[1].ip) < 1 then
            local ip getPlayerIP(player)
            local q3 exports.rpg_mysql:mysql_query("UPDATE rpg_accounts SET ip=? WHERE uid=?"ipq[1].uid)
            if not q3 then
                exports.rpg_noti:createNotification(source"error""B??d podczas pr?by logowania, zg?o? to administratorowi na forum [ERR11]")
                return
            end
        end

        local q2 exports.rpg_mysql:mysql_query("SELECT * FROM rpg_admins WHERE user=?"q[1].uid)
        if #q2 > 0 then
            setElementData(player"user:admin"q2[1].level)
            setElementData(player"user:aperm"q2[1])
        else
            setElementData(player"user:admin"0)
            setElementData(player"user:aperm"false)
        end

        local oq exports.rpg_mysql:mysql_query("SELECT * FROM rpg_organizacje WHERE uid=?"q[1].nazwa)
        if #oq > 0 then
        setElementData(player"user:org"oq[1].nazwa)
        setElementData(player"user:orgrank"oq)
      else
        setElementData(player"user:org"false)
        setElementData(player"user:orgrank"false)
           end


        local qtuner exports.rpg_mysql:mysql_query("SELECT * FROM rpg_tunerzy WHERE uid=?"q[1].uid)
        if #qtuner > 0 then
            setElementData(player"user:tuning"true)
        else
            setElementData(player"user:tuning"false)
        end

        local pd split(q[1].premium" ")
        local pd1 split(pd[1], "-")
        local pd2 split(pd[2], ":")
        local ts1 getTimestamp()
        local ts2 getTimestamp(pd1[1], pd1[2], pd1[3], pd2[1], pd2[2], pd2[3])
        if ts1 <= ts2 then
            local fs ts2 ts1
            local p_left math.floor(fs/86400)
            if p_left 1 then
                p_left math.floor(fs/3600)
                if p_left 1 then
                    p_left math.floor(fs/60).." min."
                else
                    p_left p_left.." godz."
                end
            else
                    p_left p_left.." d."
            end
            outputChatBox("[#FFFF00#PREMIUM#FFFFFF] Posiadasz ulepszenie konta do statusu premium jeszcze na "..p_leftplayer255255255true)
            setElementData(player"user:premium"true)
            setPlayerNametagColor(player2552000)
            setElementData(player"user:premium:ts"ts2)
        else
            setElementData(player"user:premium"false)
        end

        local timer setTimer(function ()
            setElementData(player"user:onlinetime"getElementData(player"user:onlinetime")+1)
            local cts getTimestamp()
            if getElementData(player"user:premium"then
                local pts getElementData(player"user:premium:ts") or 0
                if pts cts then
                    outputChatBox("[#FFFF00#PREMIUM#FFFFFF] Twoje ulepszenie do konta premium dobiega ko?ca!"player255255255true)
                    setElementData(player"user:premium"false)
                end
            end
        end600000)
        setElementData(player"user:timer"timer)

        setTimer(function ()
            fadeCamera(playertrue)
            local pos split(q[1].position",")
            spawnPlayer(playerpos[1], pos[2], pos[3], pos[4], q[1].skinpos[5], pos[6])

            setElementHealth(playerq[1].health)
            setPedArmor(playerq[1].armor)

            toggleControl(player"fire"false)
            setCameraTarget(playerplayer)
            setElementData(player"user:logged"true)
            setElementData(player"hud:enabled"true)
            if tonumber(pos[5]) < 1 then
                showPlayerHudComponent(player"clock"false)
                showPlayerHudComponent(player"health"true)
                showPlayerHudComponent(player"armour"true)
                showPlayerHudComponent(player"breath"true)
                showPlayerHudComponent(player"money"false)
                showPlayerHudComponent(player"weapon"true)
                showPlayerHudComponent(player"ammo"true)
                showPlayerHudComponent(player"radar"true)
                showPlayerHudComponent(player"area_name"false)
                showPlayerHudComponent(player"vehicle_name"false)
            end
            showChat(playertrue)
        end20001)

    end
end
addEvent("auth"true)
addEventHandler("auth"getRootElement(), auth)

function register(usernamepasswordemail)
    if not username then
        exports.rpg_noti:createNotification(source"error""B??d podczas pr?by rejestracji, zg?o? to administratorowi na forum [ERR04]")
        return
    end
    if not password then
        exports.rpg_noti:createNotification(source"error""B??d podczas pr?by rejestracji, zg?o? to administratorowi na forum [ERR05]")
        return
    end
    local q1 exports.rpg_mysql:mysql_query("SELECT username FROM rpg_accounts WHERE username=?"username)
    if not q1 then
        exports.rpg_noti:createNotification(source"error""B??d podczas pr?by rejestracji, zg?o? to administratorowi na forum [ERR09]")
        return
    elseif #q1 > 0 then
        exports.rpg_noti:createNotification(source"error""Podana nazwa u?ytkownika jest ju? w u?ytku")
        return
    end
    local ip getPlayerIP(source)
    local serial getPlayerSerial(source)
    local q3 exports.rpg_mysql:mysql_query("INSERT INTO rpg_accounts SET username=?, password=?, serial=?, ip=?, position=?, lickag=0"usernamemd5(password), serialipdefpos)
    if q3 then
        triggerClientEvent(source"switchLogin"source)
        exports.rpg_noti:createNotification(source"info""Twoje konto zosta?o utworzone, mo?esz si? teraz zalogowa?!")
    else
        exports.rpg_noti:createNotification(source"error""B??d podczas pr?by rejestracji, zg?o? to administratorowi na forum [ERR07]")
    end
end
addEvent("register"true)
addEventHandler("register"getRootElement(), register)

addEvent("wybral:wyjscie"true)
addEventHandler("wybral:wyjscie"getRootElement(), function()
kickPlayer(source"Console""Pomy?lnie wyszed?e? z servera")
end)

addEventHandler("onPlayerQuit"getRootElement(), function ()
    local uid getElementData(source"user:uid")
    if not uid then return end
    local money getElementData(source"user:money")
    local bankmoney getElementData(source"user:bankmoney")
    local gamescore getElementData(source"user:gamescore")
    local lickag getElementData(source"user:licensegornik")
    if not lickag then lickag 0 end
    local skin getElementData(source"user:skin")
    local hajszfrakcji getElementData(source"user:factionmoney")
    local x,y,getElementPosition(source)
    local _,_,rz getElementRotation(source)
    local int getElementInterior(source)
    local dim getElementDimension(source)
    local health getElementHealth(source)
    local armor getPedArmor(source)
    local pos x..", "..y..", "..z..", "..rz..", "..int..", "..dim
    local job getElementData(source"user:job") or 0
    local jobmoney getElementData(source"user:jobmoney") or 0
    local onlinetime getElementData(source"user:onlinetime")
    local timer getElementData(source"user:timer")
    if timer then
    killTimer(timer)
    else return end
    local q exports.rpg_mysql:mysql_query("UPDATE rpg_accounts SET money=?, bankmoney=?, gamescore=?, skin=?, position=?, health=?, armor=?, job=?, jobmoney=?, onlinetime=?, lickag=?, ftime=? WHERE uid=?"moneybankmoneygamescoreskinposhealtharmorjobjobmoneyonlinetimelickaghajszfrakcjiuid)
    outputDebugString("[rpg_accounts] Zapisywanie gracza o UID "..uid.."! Problemy (Je?eli brak - Jest git!) :")
    if not q then
        outputDebugString("[rpg_accounts] Wyst?pi? problem z zapisywaniem gracza o UID "..uid)
    end
    outputDebugString("[rpg_accounts] Koniec funkcji zapisywania gracza o UID "..uid)
end)

addCommandHandler("zapiszfull", function(player)
if getElementData(player"user:duty") == 3 then
    for i,source2 in pairs(getElementsByType("player")) do
    local uid getElementData(source2"user:uid")
    if not uid then return end
    local money getElementData(source2"user:money")
    local bankmoney getElementData(source2"user:bankmoney")
    local gamescore getElementData(source2"user:gamescore")
    local lickag getElementData(source2"user:licensegornik")
    if not lickag then lickag 0 end
    local skin getElementData(source2"user:skin")
    local x,y,getElementPosition(source2)
    local hajszfrakcji getElementData(source2"user:factionmoney")
    local _,_,rz getElementRotation(source2)
    local int getElementInterior(source2)
    local dim getElementDimension(source2)
    local health getElementHealth(source2)
    local armor getPedArmor(source2)
    local pos x..", "..y..", "..z..", "..rz..", "..int..", "..dim
    local job getElementData(source2"user:job") or 0
    local jobmoney getElementData(source2"user:jobmoney") or 0
    local onlinetime getElementData(source2"user:onlinetime")
    local timer getElementData(source2"user:timer")
    killTimer(timer)
    local q exports.rpg_mysql:mysql_query("UPDATE rpg_accounts SET money=?, bankmoney=?, gamescore=?, skin=?, position=?, health=?, armor=?, job=?, jobmoney=?, onlinetime=?, lickag=?, ftime=? WHERE uid=?"moneybankmoneygamescoreskinposhealtharmorjobjobmoneyonlinetimeuid)
    outputDebugString("[rpg_accounts] Zapisywanie wszystkich graczy! Problemy (Je?eli brak - Jest git!) :")
    if not q then
        outputDebugString("[rpg_accounts] Wyst?pi? problem z zapisywaniem gracza o UID "..uid)
      end
    outputDebugString("[rpg_accounts] Koniec funkcji zapisywania graczy!")
    end
  end
end)


----------------
---- UTILS ----
----------------
function getKoncowka(timek1k2k3)
    if time == 0 then
        return k1
    elseif time == 1 then
        return k2
    else
        return k3
    end
end

function getTimestamp(yearmonthdayhourminutesecond)
    -- initiate variables
    local monthseconds = { 267840024192002678400259200026784002592000267840026784002592000267840025920002678400 }
    local timestamp 0
    local datetime getRealTime()
    yearmonthday year or datetime.year 1900month or datetime.month 1day or datetime.monthday
    hourminutesecond hour or datetime.hourminute or datetime.minutesecond or datetime.second

    -- calculate timestamp
    for i=1970year-do timestamp timestamp + (isLeapYear(i) and 31622400 or 31536000end
    for i=1month-do timestamp timestamp + ((isLeapYear(year) and == 2) and 2505600 or monthseconds[i]) end
    timestamp timestamp 86400 * (day 1) + 3600 hour 60 minute second

    timestamp timestamp 3600 --GMT+1 compensation
    if datetime.isdst then timestamp timestamp 3600 end

    return timestamp
end

function isLeapYear(year)
    if year then year math.floor(year)
    else year getRealTime().year 1900 end
    return ((year == and year 100 ~= 0) or year 400 == 0)
end

--[[
AutorAsper <nezymr69@gmail.com>
Dla servera Own World!
Zakaz uzywania skryptu bez zgody autora!
]]

addEvent("org:dodajgracz"true)
addEventHandler("org:dodajgracz"root, function(nickorg)
local target findPlayer(sourcenick)
if not target then return end
if getElementData(target"user:org"then
exports.rpg_noti:createNotification(source"error"getPlayerName(target).." posiada organizacje.")
return
end
exports.rpg_mysql:mysql_query("INSERT INTO rpg_organizacje SET uid=?, organizacja=?, rank=?, nick=?"getElementData(target"user:uid"), org"1"getPlayerName(target))
exports.rpg_noti:createNotification(source"info"getPlayerName(target).." zosta? dodany do organizacji.")
outputChatBox("Zosta?e? dodany do organizacji "..orgtarget)
setElementData(target"user:org"org)
setElementData(target"user:orgrank"1)
end)

addEvent("org:kickgracz"true)
addEventHandler("org:kickgracz"root, function(nickorg)
local target findPlayer(sourcenick)
if not target then return end
if not getElementData(target"user:org"then
exports.rpg_noti:createNotification(source"error"getPlayerName(target).." nie posiada organizacji.")
return
end
if org ~= getElementData(target"user:org"then
exports.rpg_noti:createNotification(source"error"getPlayerName(target).." nie znajduje si? w tej organizacji.")
return
end
if getElementData(target"user:orgrank") == 4 then
exports.rpg_noti:createNotification(source"error""Nie mo?esz wyrzuci? lidera!")
return
end
exports.rpg_mysql:mysql_query("DELETE FROM rpg_organizacje WHERE organizacja=? AND uid=?"getElementData(target"user:org"), getElementData(target"user:uid"))
exports.rpg_noti:createNotification(source"info"getPlayerName(target).." zosta? wyrzucony z organizacji.")
outputChatBox("Zosta?e? wyrzucony z organizacji "..(getElementData(target"user:org") or "..."), target)
setElementData(target"user:org"false)
setElementData(target"user:orgrank"false)
end)

addEvent("org:infogracz"true)
addEventHandler("org:infogracz"root, function(nickorg)
local target findPlayer(sourcenick)
if not target then return end
if org ~= getElementData(target"user:org"then
exports.rpg_noti:createNotification(source"error"getPlayerName(target).." nie znajduje si? w tej organizacji.")
return
end
local result exports.rpg_mysql:mysql_query("SELECT * FROM rpg_organizacje WHERE uid=? AND organizacja=?"getElementData(target"user:uid"), getElementData(target"user:org"))
outputChatBox("Nick: "..result[1].nick..", DBID: "..result[1].uid..", Ranga: "..result[1].rank..""source5020050)
end)

addEvent("org:editgracz"true)
addEventHandler("org:editgracz"root, function(nickrangaorgrangaja)
local target findPlayer(plrnick)
if not target then return end
if not getElementData(target"user:org") == org then
exports.rpg_noti:createNotification(source"error"getPlayerName(target).." nie znajduje si? w tej organizacji.")
return
end
if getElementData(target"user:orgrank") == 4 then
exports.rpg_noti:createNotification(source"error""Nie mo?esz edytowa? lidera.")
return
end
if ranga == 4 then
exports.rpg_noti:createNotification(source"error""Maksymalna ranga to 3 = V-Lider.")
return
end
if ranga 1 then
exports.rpg_noti:createNotification(source"error""Minimalna ranga to 1.")
return
end
if rangaja == and ranga == 3 then
exports.rpg_noti:createNotification(source"error""Nie mo?esz nikomu da? V-Lidera.")
return
end
setElementData(target"user:orgrank"ranga)
exports.rpg_noti:createNotification(source"info""Edytowano gracza "..getPlayerName(target).." na rang? "..ranga)
exports.rpg_mysql:mysql_query("UPDATE rpg_organizacje SET rank=? WHERE uid=?"rangagetElementData(target"user:uid"))
end)

addCommandHandler("opuscorganizacje", function(plr)
if not getElementData(plr"user:org"then return end
if getElementData(plr"user:orgrank") == 4 then return end
exports.rpg_mysql:mysql_query("DELETE FROM rpg_organizacje WHERE organizacja=? AND uid=?"getElementData(plr"user:org"), getElementData(plr"user:uid"))
exports.rpg_noti:createNotification(plr"info""Opu?ci?e? organizacje o nazwie "..getElementData(plr"user:org"))
setElementData(plr"user:org"false)
setElementData(plr"user:orgrank"false)
end)

function orgGetPlayers(org)
    local q exports.rpg_mysql:mysql_query("SELECT * FROM rpg_organizacje WHERE organizacja=? ORDER BY rank DESC"org)
    triggerClientEvent(source"uzupelnijListe"sourceq)
end
addEvent("orgGetPlayers"true)
addEventHandler("orgGetPlayers"getRootElement(), orgGetPlayers)

function findPlayer(plrcel)
    local target nil
    if (tonumber(cel) ~= nilthen
        target getElementByID("p"..cel)
    else
        for _,thePlayer in ipairs(getElementsByType("player")) do
            if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x"""), cel:lower(), 1truethen
                if (targetthen
                    outputChatBox("Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter."plr)
                    return nil
                end
                target=thePlayer
            end
        end
    end
    return target
end


Ostatnio zmieniony przez marcin778 2017-10-21, 14:48, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-10-21, 13:01


Husky123







Wiek: 20
Na forum: 3320 dni
Posty: 45
Nick w MP: fabeN

Piwa: 750

Respekt: 60

Tak Wiem tylko potrzebuje szybko odpowiedzi.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-10-21, 13:15


kamilryb1

LUA






Wiek: 21
Na forum: 4266 dni
Posty: 146

Piwa: 319

Respekt: 7,3

Ostrzeżeń: 40%
Ogarnijcie sie z tymi tematami bo to jest dramat - Piszcie w odp. dziale...
Tak wgl to musisz mie? baze danych do tego i podpi??.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-10-21, 13:19


Husky123







Wiek: 20
Na forum: 3320 dni
Posty: 45
Nick w MP: fabeN

Piwa: 750

Respekt: 60

Podpio?em mam organizacje zrobion? w bazy danych robie reconnecta i nie mam organizacji a organizacja jest dodana w bazie danych.

Postaw piwo autorowi tego posta
 

 
Tagi: jak :: zrobić :: organizacje
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Jak zrobić organizacje na gm 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