Cze??, g?owie si? nad komend? admins.
A dok?adniej nad tym, ?e je?li kto? ma elementdate player:dutyrcon to wy?wietla jego nick w RCONach, m?g?bym otrzyma? jaki? przyk?ad jak to zrobi?? Z g?ry dzi?kuje
Bierzesz wszystkich graczy do p?tli i sprawdzasz czy ma dat?, je?eli ma to dodajesz go do tabeli (jakiejkolwiek) i po sko?czonej p?tli wypisujesz na chacie zawarto?? p?tli
Stw?rzmy sobie pusta tabele do kt?rej b?dziemy mogli 'wkladac' rconow
local rconi = {}
Nast?pnie zr?bmy p?tle dla wszystkich graczy i sprawd?my czy dany gracz ma element dat?
for _, v in ipairs(getElementsByType("player")) do
if getElementData(v, "player:dutyrcon") then
table.insert(rconi, {getPlayerName(v)} -- wrzucamy do tabeli kolejn? tabele z nickiem gracza
end
end
Teraz po wpisaniu komendy wy?wietlmy tabele
outputChatBox ("Dost?pni admini RCON:", plr)
for _,v in ipairs(rconi) do
outputChatBox (v[1], plr)
end
Mniej wi?cej powinna tak wygl?da? ca?a komenda:
addCommandHandler ("admins", function(plr)
for _, v in ipairs(getElementsByType("player")) do
if getElementData(v, "player:dutyrcon") then
table.insert(rconi, {getPlayerName(v)} -- wrzucamy do tabeli kolejn? tabele z nickiem gracza
end
end
outputChatBox ("Dost?pni admini RCON:", plr)
for _,a in ipairs(rconi) do
outputChatBox (a[1], plr)
end
end)
NIE jestem pewny w 100% ?e komenda dzia?a, pisane na telefonie.
function admins(thePlayer)
local rconi = {}
local admini = {}
local mody = {}
local testowemody = {}
for _, v in ipairs(getElementsByType("player")) do
if getElementData(v, "player:dutyrcon") then
table.insert(rconi, (getPlayerName(v)))
elseif getElementData(v, "player:dutyadmin") then
table.insert(admini, (getPlayerName(v)))
elseif getElementData(v, "player:dutymod") then
table.insert(mody, (getPlayerName(v)))
elseif getElementData(v, "player:dutytmod") then
table.insert(testowemody, (getPlayerName(v)))
end
end
outputChatBox("#800000RCONi:", thePlayer, 255, 255, 255, true)
for _,v in ipairs(rconi) do
outputChatBox (v[1], plr)
end
outputChatBox("#FF0000Administratorzy:", thePlayer, 255, 255, 255, true)
for _,v in ipairs(admini) do
outputChatBox (v[1], plr)
end
outputChatBox("#0f6800Moderatorzy:", thePlayer, 255, 255, 255, true)
for _,v in ipairs(mody) do
outputChatBox (v[1], plr)
end
outputChatBox("#68fc23Testowi Moderatorzy:", thePlayer, 255, 255, 255, true)
for _,v in ipairs(testowemody) do
outputChatBox (v[1], plr)
end
outputChatBox(" ", thePlayer)
outputChatBox("#FFFFFFJe?li masz problem, napisz do kogo? z powy?szych os?b", thePlayer, 255, 255, 255, true)
end
addCommandHandler("admins", admins)
I jak wpisuje komende admins, wy?wietlaj? si? tylko kolorowe napisy, bez nick?w a jestem na duty.
function admins(thePlayer)
local rconi = {}
local admini = {}
local mody = {}
local testowemody = {}
for _, v in ipairs(getElementsByType("player")) do
if getElementData(v, "player:dutyrcon") then
table.insert(rconi, {getPlayerName(v)})
elseif getElementData(v, "player:dutyadmin") then
table.insert(admini, {getPlayerName(v)})
elseif getElementData(v, "player:dutymod") then
table.insert(mody, {getPlayerName(v)})
elseif getElementData(v, "player:dutytmod") then
table.insert(testowemody, {getPlayerName(v)})
end
end
outputChatBox("#800000RCONi:", thePlayer, 255, 255, 255, true)
for _,v in ipairs(rconi) do
outputChatBox (v[1], thePlayer)
end
outputChatBox("#FF0000Administratorzy:", thePlayer, 255, 255, 255, true)
for _,v in ipairs(admini) do
outputChatBox (v[1], thePlayer)
end
outputChatBox("#0f6800Moderatorzy:", thePlayer, 255, 255, 255, true)
for _,v in ipairs(mody) do
outputChatBox (v[1], thePlayer)
end
outputChatBox("#68fc23Testowi Moderatorzy:", thePlayer, 255, 255, 255, true)
for _,v in ipairs(testowemody) do
outputChatBox (v[1], thePlayer)
end
outputChatBox(" ", thePlayer)
outputChatBox("#FFFFFFJe?li masz problem, napisz do kogo? z powy?szych os?b", thePlayer, 255, 255, 255, true)
end
addCommandHandler("admins", admins)
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