Julian09123 Posted July 19, 2013 Share Posted July 19, 2013 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 Link to comment
Castillo Posted July 19, 2013 Share Posted July 19, 2013 addCommandHandler getElementsByType ( "player" ) getPlayerAccount getAccountName isObjectInACLGroup outputChatBox Link to comment
Sasu Posted July 19, 2013 Share Posted July 19, 2013 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 ) Link to comment
Julian09123 Posted July 19, 2013 Author Share Posted July 19, 2013 Sasuke gracias anda pero yo estoy en adm osea pongo /admins y salgo yo pero no dice Level: Julian,Otros players como hago eso? Link to comment
Sasu Posted July 19, 2013 Share Posted July 19, 2013 Sasuke gracias anda pero yo estoy en adm osea pongo /admins y salgo yo pero no dice Level: Julian,Otros playerscomo hago eso? Modifica los ACL que yo puse por los tuyos. Y dime que dice en debugscript 3. Link to comment
Julian09123 Posted July 19, 2013 Author Share Posted July 19, 2013 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 Link to comment
Sasu Posted July 19, 2013 Share Posted July 19, 2013 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) Link to comment
Julian09123 Posted July 19, 2013 Author Share Posted July 19, 2013 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) Link to comment
MTA Team 0xCiBeR Posted July 19, 2013 MTA Team Share Posted July 19, 2013 te da algun error? Link to comment
Julian09123 Posted July 20, 2013 Author Share Posted July 20, 2013 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) Link to comment
AlvareZ_ Posted July 20, 2013 Share Posted July 20, 2013 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) Link to comment
FraN-724 Posted July 20, 2013 Share Posted July 20, 2013 OT: @AlvareZ_ te saldría más fácil usar elseif enves de tantos if . Link to comment
AlvareZ_ Posted July 20, 2013 Share Posted July 20, 2013 Te recuerdo que eso no lo cree yo Link to comment
FraN-724 Posted July 20, 2013 Share Posted July 20, 2013 Jaja pero lo editaste supongo ? Link to comment
AlvareZ_ Posted July 20, 2013 Share Posted July 20, 2013 ÑO, solo le agregue un ouput Link to comment
Sasu Posted July 20, 2013 Share Posted July 20, 2013 OT: @AlvareZ_ te saldría más fácil usar elseif enves de tantos if . Yo hize el script. De que forma mas facil lo harias? Yo tambien quiero aprender Link to comment
MTA Team 0xCiBeR Posted July 20, 2013 MTA Team Share Posted July 20, 2013 OT: @AlvareZ_ te saldría más fácil usar elseif enves de tantos if . Yo hize el script. De que forma mas facil lo harias? Yo tambien quiero aprender usando "elseif" pero solo te ahorras los end..Es lo mismo Link to comment
Sasu Posted July 21, 2013 Share Posted July 21, 2013 OT: @AlvareZ_ te saldría más fácil usar elseif enves de tantos if . Yo hize el script. De que forma mas facil lo harias? Yo tambien quiero aprender 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. Link to comment
FraN-724 Posted July 21, 2013 Share Posted July 21, 2013 Hey calma tio, solo lo dije en algunos casos no usar tantos If's. Link to comment
Sasu Posted July 21, 2013 Share Posted July 21, 2013 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 . Seria tonto enojarse porque alguien le corrije. Link to comment
Bc# Posted July 21, 2013 Share Posted July 21, 2013 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 . Seria tonto enojarse porque alguien le corrije. 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 Link to comment
Sasu Posted July 21, 2013 Share Posted July 21, 2013 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 . Seria tonto enojarse porque alguien le corrije. 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 . Link to comment
Recommended Posts