MatheusKJ Posted July 19, 2019 Share Posted July 19, 2019 (edited) Queria saber como eu posso por uma letra para mudar as chats exemplo: Aperto x e mudas os chats tipo Fora do Rp, Anonimo, olx, Local entre outras.Eu uso esse chat cada letra é um chat mais eu queria so uma letra. - ------------------------------------------------------------------------------------------- function getPlayerID(player) return getElementData(player,"ID") end function getPlayerIDG(thePlayer) return getElementData(thePlayer,"ID") end -------------------------------------------------------------------------------------------- DistanciaDoChatLocal = 80 -- Metros ComandoDoChatGlobal = "rp" -- Ex /g Mensagem ComandoDoChatGlobal2 = "twitter" -- Ex /g Mensagem ComandoDoChatGlobal3 = "olx" -- Ex /g Mensagem ComandoDoChatGlobal4 = "anonimo" -- Ex /g Mensagem ValorDoChatGlobal = 0 -- Dinheiro -------------------------------------------------------------------------------------------- -- Config do Chat Local addEventHandler("onPlayerChat", root, function(tresc, msgtype) if (msgtype == 0) then cancelEvent() local x,y,z = getElementPosition(source) for key, gracze in ipairs(getElementsByType("player")) do local x2,y2,z2 = getElementPosition(gracze) if getElementData (source, "ChatLocal:Delay", true) then outputChatBox ( MensagemFalandoRapidoDemaisLocal, source, 255, 255, 255, true ) return end if ( getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 ) < DistanciaDoChatLocal ) then local int = getElementInterior ( source ) local dim = getElementDimension ( source ) local int2 = getElementInterior ( gracze ) local dim2 = getElementDimension ( gracze ) if ( int == int2 and dim == dim2 ) then conta = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Console" ) ) then outputChatBox("#ffffff[#FFFFFFLocal#ffffff] #106FE7*Staff #ffffff"..getPlayerName(source).. "[ID:"..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Administrador" ) ) then outputChatBox("#ffffff[#FFFFFFLocal#ffffff] #106FE7*Staff #FFFFFF"..getPlayerName(source).."[ID:"..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador3" ) ) then outputChatBox("#ffffff[#FFFFFFLocal#ffffff] #106FE7*Staff #FFFFFF"..getPlayerName(source).."[ID:"..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador2" ) ) then outputChatBox("#ffffff[#FFFFFFLocal#ffffff] #106FE7*Staff #FFFFFF"..getPlayerName(source).."[ID:"..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador1" ) ) then outputChatBox("#ffffff[#FFFFFFLocal#ffffff] #106FE7*Staff #FFFFFF"..getPlayerName(source).."[ID:"..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Vip" ) ) then outputChatBox("#ffffff[#FFFFFFLocal#ffffff] #40E0D0*Vip Simples #FFFFFF"..getPlayerName(source).."[ID:"..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Vip2" ) ) then outputChatBox("#ffffff[#FFFFFFLocal#ffffff] #00FFFF*Vip Avançado #FFFFFF"..getPlayerName(source).."[ID:"..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then outputChatBox("#ffffff[#FFFFFFLocal#ffffff] "..getPlayerName(source).. "[ID:"..getPlayerID(source).."]: #ffffff"..tresc, gracze, 255, 255, 255, true) end end end end end setElementData (source, "ChatLocal:Delay",true) setTimer (setElementData, 100, 1, source, "ChatLocal:Delay", false) end) -------------------------------------------------------------------------------------------- -- Config do Chat Global function adminchat ( thePlayer, _, ... ) local message = table.concat ( { ... }, " " ) if ( isPlayerOnGroup ( thePlayer ) ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerOnGroup ( player ) ) then if ( isPlayerMuted(thePlayer) ) then outputChatBox ( MensagemVoceEstaMutadoGlobal, thePlayer, 255, 255, 255, true ) return end if getElementData (thePlayer, "ChatGlobal:Delay1", true) then outputChatBox ( MensagemFalandoRapidoDemaisGlobal, thePlayer, 255, 255, 255, true ) return end local money = getPlayerMoney(thePlayer) if (money < ValorDoChatGlobal ) then outputChatBox ( MensagemDinheiroInsuficienteGlobal, thePlayer, 255, 255, 255, true ) return end conta = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Console" ) ) then outputChatBox("#ffffff[#FFFFFFFora Do RP#ffffff] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).. "[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Administrador" ) ) then outputChatBox("#ffffff[#FFFFFFFora Do RP#ffffff] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador3" ) ) then outputChatBox("#ffffff[#FFFFFFFora Do RP#ffffff] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador2" ) ) then outputChatBox("#ffffff[#FFFFFFFora Do RP#ffffff] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador1" ) ) then outputChatBox("#ffffff[#FFFFFFFora Do RP#ffffff] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Vip" ) ) then outputChatBox("#ffffff[#FFFFFFFora Do RP#ffffff] #40E0D0*Vip Simples #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Vip2" ) ) then outputChatBox("#ffffff[#FFFFFFFora Do RP#ffffff] #00FFFF*Vip Avançado #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then outputChatBox("#ffffff[#FFFFFFFora Do RP#ffffff] "..getPlayerName(thePlayer).. "[ID:"..getPlayerID(thePlayer).."]: #ffffff#ffffff"..message, player, 255, 255, 255, true) end end end end setElementData ( thePlayer, "ChatGlobal:Delay1",true ) setTimer ( setElementData, 100, 1, thePlayer, "ChatGlobal:Delay1", false ) end addCommandHandler ( ComandoDoChatGlobal, adminchat ) -------------------------------------------------------------------------------------------- -- Chat Twitter function adminchat2 ( thePlayer, _, ... ) local message = table.concat ( { ... }, " " ) if ( isPlayerOnGroup ( thePlayer ) ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerOnGroup ( player ) ) then if getElementData (thePlayer, "ChatGlobal:Delay1", true) then outputChatBox ( MensagemFalandoRapidoDemaisGlobal, thePlayer, 255, 255, 255, true ) return end conta = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Console" ) ) then outputChatBox("#14B4E7[#14B4E7Twitter#14B4E7] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).. "[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Admin" ) ) then outputChatBox("#14B4E7[#14B4E7Twitter#14B4E7] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador3" ) ) then outputChatBox("#14B4E7[#14B4E7Twitter#14B4E7] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador2" ) ) then outputChatBox("#14B4E7[#14B4E7Twitter#14B4E7] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador1" ) ) then outputChatBox("#14B4E7[#14B4E7Twitter#14B4E7] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Vip" ) ) then outputChatBox("#14B4E7[#14B4E7Twitter#14B4E7] #40E0D0*Vip Simples #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Vip2" ) ) then outputChatBox("#14B4E7[#14B4E7Twitter#14B4E7] #00FFFF*Vip Avançado #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then outputChatBox("#14B4E7[#14B4E7Twitter#14B4E7] #ffffff"..getPlayerName(thePlayer).. "[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) end end end end setElementData ( thePlayer, "ChatGlobal:Delay2",true ) setTimer ( setElementData, 100, 1, thePlayer, "ChatGlobal:Delay2", false ) end addCommandHandler ( ComandoDoChatGlobal2, adminchat2 ) ----------------------------------------------------------- -- Chat olx function adminchat3 ( thePlayer, _, ... ) local message = table.concat ( { ... }, " " ) if ( isPlayerOnGroup ( thePlayer ) ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerOnGroup ( player ) ) then if getElementData (thePlayer, "ChatGlobal:Delay1", true) then outputChatBox ( MensagemFalandoRapidoDemaisGlobal, thePlayer, 255, 255, 255, true ) return end conta = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Console" ) ) then outputChatBox("#FF00EA[#FF00EAOLX#FF00EA] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).. "[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Admin" ) ) then outputChatBox("#FF00EA[#FF00EAOLX#FF00EA] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador3" ) ) then outputChatBox("#FF00EA[#FF00EAOLX#FF00EA] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador2" ) ) then outputChatBox("#FF00EA[#FF00EAOLX#FF00EA] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderador1" ) ) then outputChatBox("#FF00EA[#FF00EAOLX#FF00EA] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Vip" ) ) then outputChatBox("#FF00EA[#FF00EAOLX#FF00EA] #40E0D0*Vip Simples #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Vip2" ) ) then outputChatBox("#FF00EA[#FF00EAOLX#FF00EA] #00FFFF*Vip Avançado #ffffff"..getPlayerName(thePlayer).."[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then outputChatBox("#FF00EA[#FF00EAOLX#FF00EA] #106FE7*Staff #ffffff"..getPlayerName(thePlayer).. "[ID:"..getPlayerID(thePlayer).."]: #ffffff"..message, player, 255, 255, 255, true) end end end end setElementData ( thePlayer, "ChatGlobal:Delay2",true ) setTimer ( setElementData, 100, 1, thePlayer, "ChatGlobal:Delay2", false ) end addCommandHandler ( ComandoDoChatGlobal3, adminchat3 ) -------------------------------------------------------------- -- Chat olx function adminchat4 ( thePlayer, _, ... ) local message = table.concat ( { ... }, " " ) if ( isPlayerOnGroup ( thePlayer ) ) then for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerOnGroup ( player ) ) then if getElementData (thePlayer, "ChatGlobal:Delay1", true) then outputChatBox ( MensagemFalandoRapidoDemaisGlobal, thePlayer, 255, 255, 255, true ) return end conta = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Console" ) ) then outputChatBox("#838b83@Anónimo: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Admin" ) ) then outputChatBox("#838b83@Anónimo: #ffffff: "..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "SuperModerator" ) ) then outputChatBox("#838b83@Anónimo: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Moderator" ) ) then outputChatBox("#838b83@Anónimo: #ffffff"..message, player, 255, 255, 255, true) elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then outputChatBox("#838b83@Anónimo: #ffffff"..message, player, 255, 255, 255, true) end end end end setElementData ( thePlayer, "ChatGlobal:Delay2",true ) setTimer ( setElementData, 100, 1, thePlayer, "ChatGlobal:Delay2", false ) end addCommandHandler ( ComandoDoChatGlobal4, adminchat4 ) --------------------------------------------------------------------- function isPlayerOnGroup ( thePlayer ) local account = getPlayerAccount ( thePlayer ) local inGroup = false for _, group in ipairs ( { "Everyone" } ) do if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) then inGroup = true break end end return inGroup end -------------------------------------------------------------------------------------------- Edited July 19, 2019 by DNL291 Código adicionado com a formatação Lua Link to comment
DNL291 Posted July 19, 2019 Share Posted July 19, 2019 Movido para: Portuguese / Português > Programação em Lua. @MatheusKJ Link to comment
Other Languages Moderators Lord Henry Posted July 19, 2019 Other Languages Moderators Share Posted July 19, 2019 @MatheusKJ Utilize o botão <> do fórum para postar códigos. Link to comment
MatheusKJ Posted July 19, 2019 Author Share Posted July 19, 2019 Vocês podem me ajudar ? Link to comment
Other Languages Moderators Lord Henry Posted July 20, 2019 Other Languages Moderators Share Posted July 20, 2019 Você pode usar bindKey na tecla X e cada vez que apertar, faz um setElementData no jogador. Dependendo dessa data, vai usar automaticamente determinado chat. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now