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

Wysłany: 2016-12-15, 21:57


OliTheMLGPro







Wiek: 28
Na forum: 3476 dni
Posty: 1
Nick w MP: OliTheMLGPro



Respekt: 50

Witam i? na serwerze mam skrypt na ORGANIZACJE z It's your world i kompletnie nie wiem jakie s? do tego skryptu komendy?! Czy mogliby?cie pom?c? Bardzo Prosz?.



local zaproszenia = {}
local max_people_in_org 15 ---- MAKSYMALNA LICZBA LUDZI W ORGANIZACJI!
function findPlayer(plr,cel)
    local target=nil
    if (tonumber(cel) ~= nilthen
        for _,thePlayer in ipairs(getElementsByType("player")) do
            if getElementData(thePlayer,"player:uid") == tonumber(celthen target thePlayer end
        end
    else -- podano fragment nicku
        for _,thePlayer in ipairs(getElementsByType("player")) do
            if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x"""), cel:lower(), 0truethen
                if (targetthen
                    outputChatBox("Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter."plr)
                    return nil
                end
                target=thePlayer
            end
        end
    end
    if target and getElementData(target,"p:inv"then return nil end
    return target
end

addEvent("lidero:editUser"true)
addEventHandler("lidero:editUser"resourceRoot, function(text,rank,faction)
    local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?"text)
    if not result1 or #result1 < 0 then outputChatBox("* Podany u?ytkownik nie istnieje w bazie danych.", client, 255, 0, 0) return end 
    local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;"factiontext) -- pobieramy tylko JEDEN rekord
    if not result2 or #result2 < 0 then outputChatBox("*Podany u?ytkownik nie znajduje si? w tej organizacji",client,255,0,0) return end
    local ranke=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;"factiongetElementData(client,"player:uid")) -- pobieramy tylko JEDEN rekord
    if not ranke or #ranke < 0 then outputChatBox("*Nie znajdujesz si? w tej organizacji!",client,255,0,0) return end
    if tonumber(ranke[1].rank) <= and (tonumber(rank) > 2then outputChatBox("*Posiadasz za ma?? range!",client,255,0,0) return end
    local query1=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_organizations SET rank=? WHERE uid=? AND code=?"ranktextfaction)
    local nazwa exports["ogrpg-db"]:dbGet("SELECT name FROM ogrpg_organization_list WHERE id=?"faction)
    local nazwa nazwa[1].name
    if query1 then
    local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?"faction)
        triggerClientEvent(client,"lidero:refresh",resourceRoot,resulted)
        outputChatBox("* Pomy?lnie zmieniono rang? graczowi "..result1[1].login.." o uid: "..text.." na "..rank.." w organizacji."client)
    end
    local target findPlayer(client,text)
    if target then outputChatBox("Twoja przynaleznosc w organizacji :"..nazwa.." zostala zaaktualizowana. Aby odej?? wpisz /opusc",targetend
end)
addEvent("lidero:addUser"true)
addEventHandler("lidero:addUser"resourceRoot, function(text,faction)
    if string.len(text) <= 0 then return end
    local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?"text)
    if not result1 or #result1 < 0 then outputChatBox("* Podany u?ytkownik nie istnieje w bazie danych.", client, 255, 0, 0) return end
    local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?"textfaction)
    if result2 and #result2 > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w tej organizacji.", client, 255, 0, 0) return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?"faction)
    if result and #result >= max_people_in_org then outputChatBox("* Posiadasz ju? maksymaln? liczbe ludzi w organizacji.", client, 255, 0, 0) return end
    local result3=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=?"text)
    if result3 and #result3 > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w innej organizacji.", client, 255, 0, 0) return end
    local target=findPlayer(client,text)
    local nazwa exports["ogrpg-db"]:dbGet("SELECT name FROM ogrpg_organization_list WHERE id=?"faction)
    local nazwa nazwa[1].name
    if target then
        if zaproszenia[targetthen outputChatBox("**Gracz ju? dosta? zaproszenie!",client) return end
        if zaproszenia[target] and isTimer(zaproszenia[target][3]) then killTimer(zaproszenia[target][3]) end
        zaproszenia[target] = {faction,client,setTimer(function() zaproszenia[target] = nil end ,10000,1),nazwa}
        outputChatBox("* Zosta?e? zaproszony do organizacji o nazwie :"..nazwa.."!",target,0,255,0)
        outputChatBox("* Masz 10 sekund na zaakceptowanie zaproszenia! (Wpisz /akceptuj)",target,0,255,0)
    end
end)
addEvent("lidero:deleteUser"true)
addEventHandler("lidero:deleteUser"resourceRoot, function(text,faction)
    local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?"text)
    if not result1 or #result1 < 0 then outputChatBox("* Podany u?ytkownik nie istnieje w bazie danych.", client, 255, 0, 0) return end 
    local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;"factiontext) -- pobieramy tylko JEDEN rekord
    if not result2 or #result2 < 0 then outputChatBox("*Podany u?ytkownik nie znajduje si? w tej organizacji",client,255,0,0) return end
    local query1=exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_organizations WHERE uid=? AND code=?",textfaction)
    local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?"faction)
    local nazwa exports["ogrpg-db"]:dbGet("SELECT name FROM ogrpg_organization_list WHERE id=?"faction)
    local nazwa nazwa[1].name
    triggerClientEvent(client,"lidero:refresh",resourceRoot,resulted)
    outputChatBox("* Pomy?lnie usunieto gracza "..result1[1].login.." o uid: "..text.." z organizacji" client)
    local target findPlayer(client,text)
    if target then outputChatBox("Twoja przynaleznosc w organizacji :"..nazwa.." zostala zaaktualizowana.",target); setElementData(target,"player:organization",falseend
end)

addCommandHandler("panel-organizacji",function (plr,cmd,...)
    local uid=getElementData(plr,"player:uid")
    if not uid then return end
    local code=getElementData(plr,"player:organization:id")
    if not code then return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?"uid,code) -- pobieramy tylko JEDEN rekord
    if result and #result > 0 then
        if result[1].rank <= 2 then outputChatBox("*Brak uprawnien do panelu organizacji",plr) return end
    local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations JOIN ogrpg_organization_list ON ogrpg_organizations.code=ogrpg_organization_list.id and ogrpg_organizations.code=? JOIN ogrpg_users on ogrpg_users.id = ogrpg_organizations.uid order by ogrpg_organizations.rank desc",code)
        triggerClientEvent(plr"lidero:showGUI"resourceRoot,coderesulted)
    end
end)
addCommandHandler("akceptuj",function (plr,cmd)
    local uid=getElementData(plr,"player:uid")
    if not uid then return end
    if not zaproszenia[plrthen outputChatBox("*Nie masz zaproszenia do organizacji lub przedawni?o si?!!",plr,255,0,0) return end
    local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?"uid)
    if not result1 or #result1 < 0 then outputChatBox("*Wystapil blad # Brak Ciebie w bazie danych!.", plr, 255, 0, 0) return end 
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?"uid,  zaproszenia[plr][1])
    if result and #result > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w tej organizacji.", client, 255, 0, 0) return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=?"uid)
    if result and #result > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w innej organizacji.", client, 255, 0, 0) return end
    local query1=exports["ogrpg-db"]:dbSet("INSERT ogrpg_organizations (uid,code) VALUES (?,?)",uidzaproszenia[plr][1])
    if isElement(zaproszenia[plr][2]) then
    if isTimer(zaproszenia[plr][3]) then killTimer(zaproszenia[plr][3]) end
    local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?"zaproszenia[plr][1])
    triggerClientEvent(zaproszenia[plr][2],"lidero:refresh",resourceRoot,resulted)
    outputChatBox("* Pomy?lnie dodano gracza "..result1[1].login.." o uid: "..uid.." w organizacji na 1 poziom"zaproszenia[plr][2])
    end
    outputDebugString("Organizacja : "..zaproszenia[plr][4].." UID :"..uid)
    outputChatBox("Akceptowales zaproszenie do organizacji o nazwie :"..zaproszenia[plr][4]..". Aby odej?? wpisz /opusc",plr) 
    setElementData(plr,"player:organization:id",zaproszenia[plr][1])
    setElementData(plr,"player:organization",zaproszenia[plr][4])
    exports['ogrpg-db']:dbSet("UPDATE ogrpg_organizations SET actived=curdate() WHERE uid=?"getElementData(plr,"player:uid"))
    zaproszenia[plr] = nil
end)
addCommandHandler("opusc",function (plr,cmd)
    local uid=getElementData(plr,"player:uid")
    if not uid then return end
    local code=getElementData(plr,"player:organization:id")
    local nazwa=getElementData(plr,"player:organization")
    if not code then outputChatBox("Nie jestes w ?adnej organizacji!",plr) return end
    local query1=exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_organizations WHERE uid=? AND code=?",uidcode)
    outputChatBox("Twoja przynaleznosc w organizacji :"..nazwa.." zostala zaaktualizowana.",plr); setElementData(plr,"player:organization",falsesetElementData(plr,"player:organization:id",false)
end)

addCommandHandler("ustawspawn",function (plr,cmd)
    local uid=getElementData(plr,"player:uid")
    if not uid then return end
    local code=getElementData(plr,"player:organization:id")
    if not code then outputChatBox("Nie jestes w ?adnej organizacji!",plr) return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?"uid,code) -- pobieramy tylko JEDEN rekord
    if result and #result > 0 then
        if result[1].rank <= 3 then outputChatBox("*Nie jestes g?ownym liderem",plr) return end
    end
    local int getElementInterior(plr)
    local dim getElementDimension(plr)
    local x,y,getElementPosition(plr)
    if int 0 then  outputChatBox("Spawn nie moze byc w interiorze!",plr) return end
    if dim 0 then  outputChatBox("Spawn nie moze byc w innym dimensionie!",plr) return end
    local query1=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_organization_list set spawn=? where id=?", ("%s,%s,%s"):format(x,y,z),code)
    outputChatBox("Spawn w twojej organizacji zostal zaaktualizowany.",plr)
    for _,p in pairs(getElementsByType('player')) do
        local gan getElementData(p,"player:organization:id")
        if gan == code then
            outputChatBox("Spawn w twojej organizacji zostal zaaktualizowany.",p)
        end
    end
end)

function globalMessage(plrcmd, ...)
    local frakcja=getElementData(plr,'player:organization')
    if not frakcja then
        return
    end
    local msg table.concat ( { ... }, " " )
    local admins=getElementsByType('player')
    for i,v in pairs(admins) do
    local pfrakcje=getElementData(v,'player:organization')
        if frakcja == pfrakcje then
            outputChatBox("[Radio] ("..getElementData(plr,"id")..") "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..msgv0255240false)
        end
    end
end
addCommandHandler("organizacja"globalMessage)




addEventHandler("onResourceStart"root, function() 
local players=getElementsByType('player')
for _p in pairs(players) do
bindKey(p"o""down""chatbox""organizacja")
end
end)

addEventHandler"onPlayerSpawn"getRootElement(),
    function (_)
    bindKey(source"o""down""chatbox""organizacja")
    end
)


Komentarz marcin778 dodany 2016-12-19, 18:09Stosuj znaczniki [lua][/lua]
Ostatnio zmieniony przez marcin778 2016-12-19, 18:10, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-15, 22:21


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Wstaw tutaj kod odpowiedzialny za te organizacje.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-16, 10:20


SzeregowyTWK

:D CISNE LUDZI






Wiek: 31
Na forum: 3461 dni
Posty: 11
Nick w MP: neymar



Respekt: 50

Wszystko masz w kodzie :) , organizacje>s_zarzadzanie.lua. I tam masz ju? wszystkie komendy :) wystarczy poszuka?, polecam notepad++.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-19, 18:01


Luqas

.lua <3






Wiek: 25
Na forum: 3455 dni
Posty: 84
Nick w MP: Luqas

Piwa: 10

Respekt: 80

Witaj!

Znalaz?em w kodzie nast?puj?ce komendy:

/panel-organizacji
/akceptuj
/opusc
/ustawspawn
/organizacja


?atwo je wyszuka?, wystarczy wyszuka? funkcji "addCommandHandler" i znajdziesz :)

Podpis
Pomogłem? Postaw Piwo lub/i respekt ^^


 Mój Youtube (klik)
Moje skrypty:
- Pay'n'Spray -

Postaw piwo autorowi tego posta
 

 
Tagi: 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 » Organizacje 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