Jump to content

/admins


Recommended Posts

Posted

Hola amigo, buen dia.

Hoy me preguntaba como podria hacer cuando pongo /admins

Te salga

Level 1:

Level2: claro si hay online

Level 3 y

level 4

Yo ya edite el ACL entonces quiero hacer eso.Porfavor ayudenme plz gracias

Skype: Juliang09123

Posted
addCommandHandler 
getElementsByType ( "player" ) 
getPlayerAccount 
getAccountName 
isObjectInACLGroup 
outputChatBox 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function viewAdmin(source) 
    local lv1 = {} 
    local lv2 = {} 
    local lv3 = {} 
    local lv4 = {} 
    for i,v in ipairs(getElementsByType("player")) do 
        local accV = getPlayerAccount(v) 
        local accName = getAccountName(accV) 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Lv4" ) ) then 
            table.insert(lv4, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Lv3" ) ) then 
            table.insert(lv3, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Lv2" ) ) then 
            table.insert(lv2, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Lv1" ) ) then 
            table.insert(lv1, getPlayerName(v)) 
        end 
    end 
    if #lv1 ~= 0 then 
        outputChatBox(table.concat(lv1, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 1: Ninguno", source, 0, 255, 0) 
    end 
    if #lv2 ~= 0 then 
        outputChatBox(table.concat(lv2, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 2: Ninguno", source, 0, 255, 0) 
    end 
    if #lv3 ~= 0 then 
        outputChatBox(table.concat(lv3, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 3: Ninguno", source, 0, 255, 0) 
    end 
    if #lv4 ~= 0 then 
        outputChatBox(table.concat(lv4, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 4: Ninguno", source, 0, 255, 0) 
    end 
end 
addCommandHandler("admins", viewAdmin) 

( No testeado )

State: Inactive

Posted
Sasuke gracias anda pero yo estoy en adm osea pongo /admins y salgo yo pero no dice Level: Julian,Otros players

como hago eso?

Modifica los ACL que yo puse por los tuyos. Y dime que dice en debugscript 3.

State: Inactive

Posted

Sasuke Lo que yo digo es que cuando pongo /admins

Salgo yo pero Sale el Nombre solo Julian no sale Level 4: Julian solo sale asi level 1 : None level 2: none level : None y abajo Julian

y quiero que salga como Level 4 :Julian, otros players

Skype: Juliang09123

Posted

Lo siento, me olvide de esi. Toma:

function viewAdmin(source) 
    local lv1 = {} 
    local lv2 = {} 
    local lv3 = {} 
    local lv4 = {} 
    for i,v in ipairs(getElementsByType("player")) do 
        local accV = getPlayerAccount(v) 
        local accName = getAccountName(accV) 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Lv4" ) ) then 
            table.insert(lv4, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Lv3" ) ) then 
            table.insert(lv3, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Lv2" ) ) then 
            table.insert(lv2, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Lv1" ) ) then 
            table.insert(lv1, getPlayerName(v)) 
        end 
    end 
    if #lv1 ~= 0 then 
        outputChatBox("Level 1: "..table.concat(lv1, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 1: Ninguno", source, 0, 255, 0) 
    end 
    if #lv2 ~= 0 then 
        outputChatBox("Level 2: "..table.concat(lv2, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 2: Ninguno", source, 0, 255, 0) 
    end 
    if #lv3 ~= 0 then 
        outputChatBox("Level 3: "..table.concat(lv3, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 3: Ninguno", source, 0, 255, 0) 
    end 
    if #lv4 ~= 0 then 
        outputChatBox("Level 4: "..table.concat(lv4, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 4: Ninguno", source, 0, 255, 0) 
    end 
end 
addCommandHandler("admins", viewAdmin)  

State: Inactive

Posted

Mira en el acl tengo Level 1 2 ,3 4

Y lo edite y no anda ahora

function viewAdmin(source) 
    local Lvl1 = {} 
    local Lvl2 = {} 
    local lvl3 = {} 
    local lvl4 = {} 
    for i,v in ipairs(getElementsByType("player")) do 
        local accV = getPlayerAccount(v) 
        local accName = getAccountName(accV) 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 4" ) ) then 
            table.insert(lv4, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 3" ) ) then 
            table.insert(lv3, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 2" ) ) then 
            table.insert(lv2, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 1" ) ) then 
            table.insert(lv1, getPlayerName(v)) 
        end 
    end 
    if #lv1 ~= 0 then 
        outputChatBox("Level 1: "..table.concat(lv1, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 1: Ninguno", source, 0, 255, 0) 
    end 
    if #lv2 ~= 0 then 
        outputChatBox("Level 2: "..table.concat(lv2, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 2: Ninguno", source, 0, 255, 0) 
    end 
    if #lv3 ~= 0 then 
        outputChatBox("Level 3: "..table.concat(lv3, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 3: Ninguno", source, 0, 255, 0) 
    end 
    if #lv4 ~= 0 then 
        outputChatBox("Level 4: "..table.concat(lv4, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 4: Ninguno", source, 0, 255, 0) 
    end 
end 
addCommandHandler("admins", viewAdmin) 

Skype: Juliang09123

  • MTA Team
Posted

te da algun error?

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted

Fixeado solamente como le agrego para que Diga Admins online: y abajo los Level: tata level 2: tata

?

function viewAdmin(source) 
    local lv1 = {} 
    local lv2 = {} 
    local lv3 = {} 
    local lv4 = {} 
    for i,v in ipairs(getElementsByType("player")) do 
        local accV = getPlayerAccount(v) 
        local accName = getAccountName(accV) 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 4" ) ) then 
            table.insert(lv4, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 3" ) ) then 
            table.insert(lv3, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 2" ) ) then 
            table.insert(lv2, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 1" ) ) then 
            table.insert(lv1, getPlayerName(v)) 
        end 
    end 
    if #lv1 ~= 0 then 
        outputChatBox("Level 1: "..table.concat(lv1, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 1: Ninguno", source, 0, 255, 0) 
    end 
    if #lv2 ~= 0 then 
        outputChatBox("Level 2: "..table.concat(lv2, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 2: Ninguno", source, 0, 255, 0) 
    end 
    if #lv3 ~= 0 then 
        outputChatBox("Level 3: "..table.concat(lv3, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 3: Ninguno", source, 0, 255, 0) 
    end 
    if #lv4 ~= 0 then 
        outputChatBox("Level 4: "..table.concat(lv4, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 4: Ninguno", source, 0, 255, 0) 
    end 
end 
addCommandHandler("admins", viewAdmin) 

Skype: Juliang09123

Posted
function viewAdmin(source) 
    local lv1 = {} 
    local lv2 = {} 
    local lv3 = {} 
    local lv4 = {} 
    for i,v in ipairs(getElementsByType("player")) do 
        local accV = getPlayerAccount(v) 
        local accName = getAccountName(accV) 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 4" ) ) then 
            table.insert(lv4, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 3" ) ) then 
            table.insert(lv3, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 2" ) ) then 
            table.insert(lv2, getPlayerName(v)) 
        elseif isObjectInACLGroup ("user."..accName, aclGetGroup ( "Level 1" ) ) then 
            table.insert(lv1, getPlayerName(v)) 
        end 
    end 
        outputChatBox("Admins Online:", source, 0, 255, 0) 
    if #lv1 ~= 0 then 
        outputChatBox("Level 1: "..table.concat(lv1, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 1: Ninguno", source, 0, 255, 0) 
    end 
    if #lv2 ~= 0 then 
        outputChatBox("Level 2: "..table.concat(lv2, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 2: Ninguno", source, 0, 255, 0) 
    end 
    if #lv3 ~= 0 then 
        outputChatBox("Level 3: "..table.concat(lv3, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 3: Ninguno", source, 0, 255, 0) 
    end 
    if #lv4 ~= 0 then 
        outputChatBox("Level 4: "..table.concat(lv4, ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level 4: Ninguno", source, 0, 255, 0) 
    end 
end 
addCommandHandler("admins", viewAdmin) 

bandera_de_Venezuela.png

Posted
OT: @AlvareZ_ te saldría más fácil usar elseif enves de tantos if xD.

Yo hize el script. De que forma mas facil lo harias? Yo tambien quiero aprender :D

State: Inactive

  • MTA Team
Posted
OT: @AlvareZ_ te saldría más fácil usar elseif enves de tantos if xD.

Yo hize el script. De que forma mas facil lo harias? Yo tambien quiero aprender :D

usando "elseif" pero solo te ahorras los end..Es lo mismo

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted
OT: @AlvareZ_ te saldría más fácil usar elseif enves de tantos if xD.

Yo hize el script. De que forma mas facil lo harias? Yo tambien quiero aprender :D

usando "elseif" pero solo te ahorras los end..Es lo mismo

En mi script, ya no es mas posible colocar mas elseif. Si quieres intentalo. Corrigeme si me equivoco.

State: Inactive

Posted
Hey calma tio, solo lo dije en algunos casos no usar tantos If's.

Use los if's necesarios. Y no estoy enojado, es porque yo escribo asi xD. Seria tonto enojarse porque alguien le corrije. :D

State: Inactive

Posted
Hey calma tio, solo lo dije en algunos casos no usar tantos If's.

Use los if's necesarios. Y no estoy enojado, es porque yo escribo asi xD. Seria tonto enojarse porque alguien le corrije. :D

Podrías haber hecho un script mucho mas corto si usaras un for para los outPutChatBox si hubieses guardado los datos como Lv[1], Lv[2], Lv[3] y Lv[4]. Si lo hubieses hecho así el for te abría quedado así mira:

  
for i=1,4 do 
     if #lv[i] ~= 0 then 
        outputChatBox("Level "..#lv[i]..": "..table.concat(lv[i], ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level "..#lv[i]..": Ninguno", source, 0, 255, 0) 
    end 
end 

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted
Hey calma tio, solo lo dije en algunos casos no usar tantos If's.

Use los if's necesarios. Y no estoy enojado, es porque yo escribo asi xD. Seria tonto enojarse porque alguien le corrije. :D

Podrías haber hecho un script mucho mas corto si usaras un for para los outPutChatBox si hubieses guardado los datos como Lv[1], Lv[2], Lv[3] y Lv[4]. Si lo hubieses hecho así el for te abría quedado así mira:

  
for i=1,4 do 
     if #lv[i] ~= 0 then 
        outputChatBox("Level "..#lv[i]..": "..table.concat(lv[i], ", "), source, 0, 255, 0) 
    else 
        outputChatBox("Level "..#lv[i]..": Ninguno", source, 0, 255, 0) 
    end 
end 

Mmmm. No se me ocurrio. Muchas gracias :D .

State: Inactive

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...