MTA Team 0xCiBeR Posted February 9, 2013 MTA Team Share Posted February 9, 2013 Hola que tal, bueno he sacado la idea del resource de la comunidad orangechat, y pues he diseñado un script para hacer que cuando metes #(seguido de tu mensaje) salga: [PUBLIC](nombre):(Mensaje) Bueno si no eres del staff todo anda bien, ahora el problema es que quiero que cuando un miembro del staff usa el # aparezca su tag ademas del public. Aca el script completo function rangedChat( message, messageType ) local r, g, b = getPlayerNametagColor(source) local global = string.find(message, "#", 1, true) if messageType == 0 then -- If it's normal chat (i.e. not PM or team) if global then local players = getElementsByType("player") message = string.gsub(message, "#", "") for index, player in ipairs ( players ) do outputChatBox( "[PUBLIC] ".. getPlayerName(source) .. ": " ..message, player, r, g, b, true) end elseif messageType == 0 and isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Moderator" ) ) then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) for index, player in ipairs ( players ) do outputChatBox ( "[PUBLIC]""#FF0000[#FF0000[PDz]~Mod#FF0000]#FF0000 " .. getPlayerName(source) .. ": " .. message, getRootElement(), r, g, b, true ) end elseif messageType == 0 and isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "SuperModerator" ) ) then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) for index, player in ipairs ( players ) do outputChatBox ( "[PUBLIC]""#FF0000[#FF0000[PDz]~SMod#FF0000]#FF0000 " .. getPlayerName(source) .. ": " .. message, getRootElement(), r, g, b, true ) end elseif messageType == 0 and isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Admin" ) ) then cancelEvent ( ) local r, g, b = getPlayerNametagColor(source) for index, player in ipairs ( players ) do outputChatBox ("[PUBLIC]""#000000[#000000[PDz]~Admin#000000]#000000 " .. getPlayerName(source) .. ": " .. message, getRootElement(), r, g, b, true ) end end elseif messageType == 2 then -- If it's team chat local playerTeam = getPlayerTeam(source) -- Find what team the player is local teamMates = getPlayersInTeam( playerTeam ) -- Find his team mates for index, teamMate in ipairs( teamMates ) do -- For each of his team mates, do this: outputChatBox( "[RADIO] " .. getPlayerName(source) .. " dice: " ..message, teamMate, r, g, b, true) end end end end end end addEventHandler ( "onPlayerChat", root, rangedChat ) Cual sera el error?=0 me ayudan=? Link to comment
Castillo Posted February 9, 2013 Share Posted February 9, 2013 function rangedChat ( message, messageType ) local r, g, b = getPlayerNametagColor ( source ) local accountName = getAccountName ( getPlayerAccount ( source ) ) local playerName = getPlayerName ( source ) local global = string.find ( message, "#", 1, true ) if ( messageType == 0 ) then -- If it's normal chat (i.e. not PM or team) if ( global ) then local message = string.gsub ( message, "#", "", 1 ) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) ) then outputChatBox ( "[PUBLIC]#FF0000[#FF0000[PDz]~Mod#FF0000]#FF0000 ".. playerName ..": ".. message, root, r, g, b, true ) elseif ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "SuperModerator" ) ) ) then outputChatBox ( "[PUBLIC]#FF0000[#FF0000[PDz]~SMod#FF0000]#FF0000 ".. playerName ..": ".. message, root, r, g, b, true ) elseif ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then outputChatBox ("[PUBLIC]#000000[#000000[PDz]~Admin#000000]#000000 ".. playerName ..": ".. message, root, r, g, b, true ) else outputChatBox ( "[PUBLIC] ".. playerName ..": ".. message, root, r, g, b, true ) end cancelEvent ( ) end elseif ( messageType == 2 ) then -- If it's team chat local playerTeam = getPlayerTeam ( source ) -- Find what team the player is local teamMates = getPlayersInTeam ( playerTeam ) -- Find his team mates for _, teamMate in ipairs ( teamMates ) do -- For each of his team mates, do this: outputChatBox ( "[RADIO] ".. playerName .." dice: ".. message, teamMate, r, g, b, true ) end cancelEvent ( ) end end addEventHandler ( "onPlayerChat", root, rangedChat ) Link to comment
MTA Team 0xCiBeR Posted February 9, 2013 Author MTA Team Share Posted February 9, 2013 Bien solid, gracias ahora si, pero me da doble mensaje, Uso una funcion para detener el chat por default? Link to comment
MTA Team 0xCiBeR Posted February 9, 2013 Author MTA Team Share Posted February 9, 2013 copio el script denuevo? Link to comment
Castillo Posted February 9, 2013 Share Posted February 9, 2013 Si te digo que lo copies de nuevo, a vos que te parece que quiero que copies? Link to comment
MTA Team 0xCiBeR Posted February 9, 2013 Author MTA Team Share Posted February 9, 2013 Bueno no sabia de que hablabas Bien ya me funciono, Gracias Link to comment
Castillo Posted February 9, 2013 Share Posted February 9, 2013 Yo no veo nada mas para copiar. De nada. Link to comment
MTA Team 0xCiBeR Posted February 9, 2013 Author MTA Team Share Posted February 9, 2013 Solid una consulta, que cambio para que Solo la parte de PUBLIC aparezca del color del Team en que el player esta ?? Link to comment
Castillo Posted February 9, 2013 Share Posted February 9, 2013 Usa: https://wiki.multitheftauto.com/wiki/RGBToHex Link to comment
MTA Team 0xCiBeR Posted February 9, 2013 Author MTA Team Share Posted February 9, 2013 Mmm no entiendo como aplicas eso al script que te pase, ocea para que la parte de [PUBLIC] y la de [RADIO] aparezca en el color que corresponde al Color del Team.Agradeceria que me lo demostraras Link to comment
Castillo Posted February 9, 2013 Share Posted February 9, 2013 El script ese ya lo hace, lo acabo de probar y [PUBLIC] aparece con mi color. Link to comment
MTA Team 0xCiBeR Posted February 10, 2013 Author MTA Team Share Posted February 10, 2013 Jo*** perdon es que se me olvido de meterme a un team Gracias igual Link to comment
Recommended Posts