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

Wysłany: 2016-02-07, 21:35


Bananek_PL







Wiek: 24
Na forum: 3855 dni
Posty: 6
Nick w MP: Bananek_PL

Piwa: 5

Respekt: 60

Chcia?bym pod??czy? AC pod duty.

Duty.

-- Ustawienia MySQL
addEventHandler("onResourceStart"resourceRoot, function()
    local baza "NAZWA TWOJEJ BAZY"
    local host "HOST"
    local user "U?YTKOWNIK MYSQL"
    local pass "HAS?O MYSQL"

    db dbConnect("mysql""dbname="..baza..";host="..hostuserpass"share=1") -- Po??czenie z serwerem MySQL.
end)



-- Reszta zasobu
addCommandHandler("duty", function(plr,cmd)
    local q dbQuery(db"SELECT level FROM admins WHERE serial=?"getPlayerSerial(plr))
    local w dbPoll(q, -1)
    if and #w > 0 then
        if not getElementData(plr"duty"then
            if w[1].level == 1 then -- Je?eli kolumna 'level' ma warto?? 1 to nadajemy rangmoderatora.
                setElementData(plr"duty"1)
                outputChatBox("Logujesz si? na duty moderatora."plr)
            elseif w[1].level == 2 then -- Je?eli kolumna 'level' ma warto?? 2 to nadajemy rangadministratora.
                setElementData(plr"duty"2)
                outputChatBox("Loguejsz si? na duty administratora."plr)
            elseif w[1].level == 3 then -- Je?eli kolumna 'level' ma warto?? 3 to nadajemy rangadministratora RCON.
                setElementData(plr"duty"3)
                outputChatBox("Logujesz si? na duty administratora RCON."plr)
            end
        else
            removeElementData(plr"duty")
            outputChatBox("Wylogowujesz si? z duty."plr)
        end
    else
        outputChatBox("Nie jeste? w ekipie serwera."plr)
    end
end)



--[[
    Informacje:
    Aby zas?b dzia?apoprawniemusisz dodatabel? do MySQL z nazw'admins' (bez apostrof?wz kolumnami: 
    serial typ VARCHAR d?ugo?? 255
    level typ INT d?ugo?? 1
    
    Aby dodagracza do administracjidodaj do MySQL serial gracza oraz level
    Level 1 Moderator
    Level 2 Administrator
    Level 3 Administrator RCON
    
    Aby pobraranggracza przy nprobieniu komend:
    
    aby sprawdzi?, czy gracz jest moderatorem wpisujemy:
        if getElementData(plr"duty") == 1 then
            Reszta Twojego kodu.
        end
    aby sprawdzi?, czy gracz jest administratorem wpisujemy:
        if getElementData(plr"duty") == 2 then
            Reszta Twojego kodu.
        end
    aby sprawdzi?, czy gracz jest administratorem RCON wpisujemy:
        if getElementData(plr"duty") == 3 then
            Reszta Twojego kodu
        end
]]--


AC.

addCommandHandler("mc", function(plrcmd, ...)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(plr)), aclGetGroup("Moderator")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(plr)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(plr)), aclGetGroup("RCON")) then
if ... then
    local msg table.concat({...}, " ")
    for kv in ipairs(getElementsByType("player")) do
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Moderator")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(plr)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(plr)), aclGetGroup("RCON")) then
            outputChatBox("#006600M> #006600"..getPlayerName(plr).."#FFFFFF: "..msgv,255,255,255,true)
        end
    end
end
end
end)



addCommandHandler("ac", function(plrcmd, ...)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(plr)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(plr)), aclGetGroup("RCON")) then
if ... then
    local msg table.concat({...}, " ")
    for kv in ipairs(getElementsByType("player")) do
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(plr)), aclGetGroup("RCON")) then
            outputChatBox("#FF0000A> #FF0000"..getPlayerName(plr).."#FFFFFF: "..msgv255,255,255,true)
        end
    end
end
end
end)



addCommandHandler("rc", function(plrcmd, ...)
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(plr)), aclGetGroup("RCON")) then 
if ... then
    local msg table.concat({...}, " ")
    for kv in ipairs(getElementsByType("player")) do
        if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("RCON")) then
            outputChatBox("#660000R> #660000"..getPlayerName(plr).."#FFFFFF: "..msgv255,255,255,true)
        end
    end
end
end
end)


[ Dodano: 2016-02-07, 21:37 ]
Poda?em kod bez autor?w, bo za du?o by go by?o.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-02-13, 14:57












POST ZOSTAŁ UKRYTY Z POWODU ZŁAMANIA REG. LUB OCZEKUJE NA AKCEPTACJĘ


 

 
Tagi: podłączenie :: pod :: duty.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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