maauroo Posted July 26, 2013 Share Posted July 26, 2013 Hola. Nesesito su ayuda, Le quiero poner ID a los tag o player name, no se como es el tema. Tipo Sa:Mp se entiende? Ej: [0][ADMIN][M]aauroo Script(No lo hise yo) function chatbox(text, msgtype) local r,g,b = getPlayerNametagColor(source) local name = getPlayerName(source) local accountname = getAccountName (getPlayerAccount(source)) local Account = getPlayerAccount ( source ) if (msgtype == 0) then if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then cancelEvent() outputChatBox("#cc0000[ADMIN] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [ADMIN] " .. getPlayerName ( source ).. ": " .. text) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "SuperModerator" ) ) then cancelEvent() outputChatBox("#ffcc00[ultra Moderador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [ultra Moderador] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" ) ) then cancelEvent() outputChatBox("#00ff00[Moderador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Moderador " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ) ) then cancelEvent() outputChatBox("#cccccc[Consola] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Consola] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Everyone" ) ) then cancelEvent() if isGuestAccount ( Account ) then outputChatBox("#ffffff[invitado] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [invitado] " .. getPlayerName ( source ).. ": " .. text ) else outputChatBox("#00b6f2[Jugador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Jugador] " .. getPlayerName ( source ).. ": " .. text ) end end end end addEventHandler("onPlayerChat", getRootElement(), chatbox) Link to comment
Chaz-CR Posted July 26, 2013 Share Posted July 26, 2013 Que problema te da en el debugscript? Link to comment
maauroo Posted July 26, 2013 Author Share Posted July 26, 2013 No es un problema. Quiero Agragar A los jugadores La ID. El Titulo me parece q esta mal. Link to comment
AlvareZ_ Posted July 26, 2013 Share Posted July 26, 2013 No estoy seguro de que esto sea lo que ser debe usar pero intenta function chatbox(text, msgtype) local r,g,b = getPlayerNametagColor(source) local name = getPlayerName(source) local accountname = getAccountName (getPlayerAccount(source)) local Account = getPlayerAccount ( source ) local jugadorID = getElementID(source) if (msgtype == 0) then if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#cc0000[ADMIN] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [ADMIN] " .. getPlayerName ( source ).. ": " .. text) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "SuperModerator" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#ffcc00[ultra Moderador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [ultra Moderador] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#00ff00[Moderador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Moderador " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#cccccc[Consola] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Consola] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Everyone" ) ) then cancelEvent() if isGuestAccount ( Account ) then outputChatBox("[".. jugadorID .."]#ffffff[invitado] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [invitado] " .. getPlayerName ( source ).. ": " .. text ) else outputChatBox("[".. jugadorID .."]#00b6f2[Jugador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Jugador] " .. getPlayerName ( source ).. ": " .. text ) end end end end addEventHandler("onPlayerChat", getRootElement(), chatbox) Link to comment
Chaz-CR Posted July 26, 2013 Share Posted July 26, 2013 Le diste los permisos de admin al resource? outputChatBox("[".. jugadorID .."]#cccccc[Consola] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Consola] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Everyone" ) ) El Everyone es para cualquier jugador que se loguee,no se porque le pones consola, deberia ser player o algo asi, edita los parentesis que son para cada cosa, por ejemplo los acl Everyone son para los Players logueados entonces por ejemplo quita Consola y pon Jugador y asi tu te manejas con las salidas del chat! Link to comment
maauroo Posted July 26, 2013 Author Share Posted July 26, 2013 No Aparece La id Ese es el problema. Donde esta el error? Link to comment
AlvareZ_ Posted July 26, 2013 Share Posted July 26, 2013 Usa un elseif, es decir que eso seria del Invitado Link to comment
AlvareZ_ Posted July 26, 2013 Share Posted July 26, 2013 No Aparece La id Ese es el problema. Donde esta el error? Probaste lo que te pase ? Link to comment
maauroo Posted July 26, 2013 Author Share Posted July 26, 2013 Si lo probe pero no funciona. osea no aparece la ID. Link to comment
Chaz-CR Posted July 26, 2013 Share Posted July 26, 2013 Le diste los permisos acl de admin al resources? prueba con eso, sino postea todo el resource y el meta! Link to comment
AlvareZ_ Posted July 26, 2013 Share Posted July 26, 2013 Hm bueno sigamos intentando function chatbox(text, msgtype) local r,g,b = getPlayerNametagColor(source) local name = getPlayerName(source) local accountname = getAccountName (getPlayerAccount(source)) local Account = getPlayerAccount ( source ) local jugadorID = getPlayerFromID(source) if (msgtype == 0) then if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#cc0000[ADMIN] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [ADMIN] " .. getPlayerName ( source ).. ": " .. text) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "SuperModerator" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#ffcc00[ultra Moderador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [ultra Moderador] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#00ff00[Moderador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Moderador " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#cccccc[Consola] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Consola] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Everyone" ) ) then cancelEvent() if isGuestAccount ( Account ) then outputChatBox("[".. jugadorID .."]#ffffff[invitado] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [invitado] " .. getPlayerName ( source ).. ": " .. text ) else outputChatBox("[".. jugadorID .."]#00b6f2[Jugador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Jugador] " .. getPlayerName ( source ).. ": " .. text ) end end end end addEventHandler("onPlayerChat", getRootElement(), chatbox) Link to comment
Chaz-CR Posted July 26, 2013 Share Posted July 26, 2013 *Offtopic: me siento ignorado mejor me voy! Link to comment
Cuervo_fi Posted July 26, 2013 Share Posted July 26, 2013 *Offtopic: me siento ignorado mejor me voy! talves te ignoran ya que comentas cosas no necesarias.. Link to comment
Sasu Posted July 26, 2013 Share Posted July 26, 2013 EDIT: Lo acabo de testear, y funciona perfectamente. getPlayerID --[[ Funcion getPlayerID Argumentos: source -- El jugador de quien quieres obtener el ID Devolucion: Devuelve un numero con la ID del jugador ]] function getPlayerID(source) local ID = false if source and isElement(source) then if getElementType(source) == "player" then for i,v in ipairs(getElementsByType("player")) do if v == source then ID = i break end end else return false end else return false end return ID end function chatbox(text, msgtype) local r,g,b = getPlayerNametagColor(source) local name = getPlayerName(source) local accountname = getAccountName (getPlayerAccount(source)) local Account = getPlayerAccount ( source ) local jugadorID = tostring(getPlayerID(source)) if (msgtype == 0) then if isGuestAccount ( Account ) then cancelEvent() outputChatBox("[".. jugadorID .."]#ffffff[invitado] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [invitado] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#cc0000[ADMIN] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [ADMIN] " .. getPlayerName ( source ).. ": " .. text) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "SuperModerator" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#ffcc00[ultra Moderador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [ultra Moderador] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#00ff00[Moderador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Moderador " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#cccccc[Consola] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Consola] " .. getPlayerName ( source ).. ": " .. text ) elseif isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Everyone" ) ) then cancelEvent() outputChatBox("[".. jugadorID .."]#00b6f2[Jugador] "..RGBToHex(r,g,b)..name..": #ffffff"..text, getRootElement(),0,0,0,true) outputServerLog( "CHAT: [Jugador] " .. getPlayerName ( source ).. ": " .. text ) end end end addEventHandler("onPlayerChat", getRootElement(), chatbox) Recuerda tener la funcion useful "RGBToHex" o sino te dara error. Si no la tienes, aqui esta: function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end RGBToHex Link to comment
maauroo Posted July 27, 2013 Author Share Posted July 27, 2013 Funciona perfecto, Hay una manera de mostrar la ID en la lista de Boton "Tab" donde se muestran los jugadores??? Link to comment
Sasu Posted July 27, 2013 Share Posted July 27, 2013 Agrega: exports.scoreboard:scoreboardAddColumn("ID", root, 10, _, 1) function giveID() for i,v in ipairs(getElementsByType("player")) do setElementData(v, "ID", i) end end addEventHandler("onResourceStart", resourceRoot, giveID) addEventHandler("onPlayerJoin", root, giveID) addEventHandler("onPlayerQuit", root, giveID) Link to comment
maauroo Posted July 27, 2013 Author Share Posted July 27, 2013 Por ultimo. Yo quiero crear un cmd por ejemplo /Ban (ID Jugador) Como Lo Puedo hacer? Me dejarian una guia ? EDIT: Tengo problema con la ID. El problema es q NO le queda la ID correcta Al jugador. Se entiende? PorEj: Hay 4 Jugadores Mauro(1) Juansito(2) Seba(3) Carlos(4) Sale Seba del server y queda asi el error: Mauro(1) Juansito(2) Carlos(3) Se entiende ? Link to comment
Sasu Posted July 27, 2013 Share Posted July 27, 2013 Ahi ya tendrias que crearlo por SQLite o MySQL y obtener la ID. Link to comment
maauroo Posted July 28, 2013 Author Share Posted July 28, 2013 ES dificil hacerlo? como empiezo? Link to comment
Recommended Posts