lpiob / MTA-XyzzyRP

Gamemod RP do gry Multi Theft Auto, napisany głównie w języku LUA, w oparciu o bazę danych MySQL. Stworzony oryginalnie w 2012 roku i rozwijany dalej na potrzeby serwera http://lss-rp.pl/
Other
44 stars 96 forks source link

Nie działa mi /admins #338

Open Komel123 opened 8 years ago

Komel123 commented 8 years ago

Witam, nie wiem z jakich powodów, ale nie działa mi /admins

Komel123 commented 8 years ago

--[[ @author Lukasz Biegaj wielebny@bestplay.pl @author Karer karer.programmer@gmail.com @author WUBE wube@lss-rp.pl @copyright 2011-2013 Lukasz Biegaj wielebny@bestplay.pl @license Dual GPLv2/MIT ]]--

function cmd_admins(plr) local supporterzy={} local admini={} local pracownik={} local rcon={} for i,v in ipairs(getElementsByType("player")) do if (isRCON(v)) then local t local login=getElementData(v,"auth:login") if (login) then t=login.."("..getElementData(v,"id")..")" --[[ if (getElementData(v,"pmoff")) then t=login.."(-)" else t=login.."("..getElementData(v,"id")..")" end ]]-- table.insert(rcon,t) end elseif (isPracownik(v)) then local t local login=getElementData(v,"auth:login") if (login) then t=login.."("..getElementData(v,"id")..")" --[[ if (getElementData(v,"pmoff")) then t=login.."(-)" else t=login.."("..getElementData(v,"id")..")" end ]]-- table.insert(pracownik,t) end elseif (isAdmin(v)) then local t local login=getElementData(v,"auth:login") if (login) then t=login.."("..getElementData(v,"id")..")" --[[ if (getElementData(v,"pmoff")) then t=login.."(-)" else t=login.."("..getElementData(v,"id")..")" end ]]-- table.insert(admini,t) end

elseif (isSupport(v)) then
  local t
  local login=getElementData(v,"auth:login")
  if (login) then
    t=login.."("..getElementData(v,"id")..")"

--[[ if (getElementData(v,"pmoff")) then t=login.."(-)" else t=login.."("..getElementData(v,"id")..")" end ]]--

    table.insert(supporterzy,t)
  end
end

end outputChatBox("RCON:", plr, 100,0,0) if (#rcon>0) then outputChatBox(" " .. table.concat(rcon,", "), plr) else outputChatBox(" brak", plr) end outputChatBox("Administracja:", plr, 255,0,0) if (#admini>0) then outputChatBox(" " .. table.concat(admini,", "), plr) else outputChatBox(" brak", plr) end

outputChatBox("Pracownicy Techniczni:", plr, 100,100,255) if (#supporterzy>0) then outputChatBox(" " .. table.concat(Pracownicy Techniczni,", "), plr) else outputChatBox(" brak", plr) end outputChatBox("Support:", plr, 100,100,255) if (#pracownik>0) then outputChatBox(" " .. table.concat(pracownik,", "), plr) else outputChatBox(" brak", plr) end end addCommandHandler("admins", cmd_admins, false, false)

local function outputChatBoxSplitted(text, target, c1,c2,c3, ca) if (string.len(text)<128) then outputChatBox(text, target, c1,c2,c3,ca) return end local t="" for i,v in string.gmatch(text,"(.)") do if (string.len(t)>0 and string.len(t)+string.len(i)>=128) then outputChatBox(t, target, c1,c2,c3,ca) t=" " end t=t..i end if (string.len(t)>0 and t~=" ") then outputChatBox(t, target, c1,c2,c3,ca) end

end

addCommandHandler("losowanie",function(player,cmd,yes,no) if (not yes) or (not no) then outputChatBox("(( /losowanie [JEZELI TAK] [JEZELI NIE] ))",player) return end local rand = math.random(1,2) if rand==1 then --yes message = yes else--no message = no end local character = getElementData(player,"character") if (not character) then outputChatBox("Najpierw dołącz do gry", player, 255, 0, 0,true) return end local x,y,z = getElementPosition(player) exports["lss-admin"]:gameView_add("IC " .. character.imie .. " " .. character.nazwisko .. "/"..getPlayerID(player)..": /do - /losowanie " .. message) local strefa = createColSphere(x,y,z,30) local gracze = getElementsWithinColShape(strefa, "player")

    for i,v in ipairs(gracze) do
        if (getElementInterior(v)==getElementInterior(player) and getElementDimension(v)==getElementDimension(player)) then
            outputChatBoxSplitted( " * " .. message .. " #A0A0A0((" .. character.imie .. " " .. character.nazwisko .. " - /losowanie))", v, 0x41, 0x69, 0xE1, true)
            triggerClientEvent(v, "onCaptionedEvent", root, message, 10)
            for i2,v2 in ipairs(getElementsByType("player")) do
                if (getCameraTarget(v2)==v and v~=v2) then
                    triggerClientEvent(v2, "onCaptionedEvent", root, message, 10)
                    outputChatBoxSplitted( " * " .. message .. " #A0A0A0((" .. character.imie .. " " .. character.nazwisko .. " - /losowanie))", v2, 0x41,  0x69, 0xE1, true) -- aqq
                end
            end
        end
    end
    destroyElement(strefa)

end) Takie cos jest napisane.

Jaccck commented 8 years ago

Źle podstawiasz dane, nie rozumiesz zbytnio kodu. Tutaj masz kod ode mnie, powinien działać - jeśli nie, podaj błędy z db3. Są to wycinki, które musisz podmienić.

Drobna instrukcja do jakiej grupy gracz musi należeć (w ACL) aby wyświetlało go na liście:

nazwa z listy - nazwa z ACL

RCON - RCON Pracownik Techniczny - PTechniczny Administrator - Administrator Supporter - Support


_commandsmisc.lua `function cmd_admins(plr) local supporterzy={} local admini={} local ptechniczni={} local rconi={} for i,v in ipairs(getElementsByType("player")) do if (isRCON(v)) then local t local login=getElementData(v,"auth:login") if (login) then t=login.."("..getElementData(v,"id")..")" table.insert(rconi,t) end elseif(isPTech(v)) then local t local login=getElementData(v,"auth:login") if (login) then t=login.."("..getElementData(v,"id")..")" table.insert(ptechniczni,t) end elseif (isAdmin(v)) then local t local login=getElementData(v,"auth:login") if (login) then t=login.."("..getElementData(v,"id")..")" table.insert(admini,t) end

    elseif (isSupport(v)) then
        local t
        local login=getElementData(v,"auth:login")
        if (login) then
            t=login.."("..getElementData(v,"id")..")"
            table.insert(supporterzy,t)
        end
    end
end
outputChatBox("RCONi:", plr, 255,0,0)
if (#rconi>0) then
    outputChatBox("  " .. table.concat(rconi,", "), plr)
else
    outputChatBox("  brak", plr)
end

outputChatBox("Pracownicy Techniczni:", plr, 150,150,50)
if (#ptechniczni>0) then
    outputChatBox("  " .. table.concat(ptechniczni,", "), plr)
else
    outputChatBox("  brak", plr)
end

outputChatBox("Admini:", plr, 100,0,0)
if (#admini>0) then
    outputChatBox("  " .. table.concat(admini,", "), plr)
else
    outputChatBox("  brak", plr)
end

outputChatBox("Support:", plr, 100,100,255)
if (#supporterzy>0) then
    outputChatBox("  " .. table.concat(supporterzy,", "), plr)
else
    outputChatBox("  brak", plr)
end

end addCommandHandler("admins", cmd_admins, false, false)`

utils.lua `function isAdmin(plr) local accName = getAccountName ( getPlayerAccount ( plr ) ) if accName and isObjectInACLGroup ("user."..accName, aclGetGroup ( "Administrator" ) ) then return true end return false end

function isRCON(plr) local accName = getAccountName ( getPlayerAccount ( plr ) ) if accName and isObjectInACLGroup ("user."..accName, aclGetGroup ( "RCON" ) ) then return true end return false end

function isPTech(plr) local accName = getAccountName ( getPlayerAccount ( plr ) ) if accName and isObjectInACLGroup ("user."..accName, aclGetGroup ( "PTechniczny" ) ) then return true end return false end

function isInvisibleAdmin(plr) local accName = getAccountName ( getPlayerAccount ( plr ) ) if accName and isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) and not isObjectInACLGroup ("user."..accName, aclGetGroup ( "Administrator" ) ) then return true end return false end

function isSupport(plr) local accName = getAccountName ( getPlayerAccount ( plr ) ) if accName and isObjectInACLGroup ("user."..accName, aclGetGroup ( "Support" ) ) then return true end return false end`

Komel123 commented 8 years ago

Powiem krótko, nie działa to.

Komel123 commented 8 years ago

[2016-05-13 20:08:07] SCRIPT ERROR: [XyzzyRP]/lss-core/commands_misc.lua:11: '=' expected near '' [2016-05-13 20:08:07] ERROR: Loading script failed: [XyzzyRP]/lss-core/commands_misc.lua:11: '=' expected near ''