DefearT Posted August 19, 2013 Share Posted August 19, 2013 Ayuda, quiero utilizar el chat de modo local, yo se que hay resources para eso en la comunidad, pero cuando les doy start y por lo menos yo hablo por chat me sale duplicado el mensaje en chatbox Link to comment
Alexs Posted August 19, 2013 Share Posted August 19, 2013 Ayuda, quiero utilizar el chat de modo local, yo se que hay resources para eso en la comunidad, pero cuando les doy start y por lo menos yo hablo por chat me sale duplicado el mensaje en chatbox Tienes activado el freeroam? Link to comment
DefearT Posted August 19, 2013 Author Share Posted August 19, 2013 Si, lo que quiero hacer un sistema que eh visto en varios servers YA! Como por ejemplo: [GLOBAL] , [LOCAL], [RADIO]! Link to comment
MTA Team 0xCiBeR Posted August 19, 2013 MTA Team Share Posted August 19, 2013 Desactiva freeroam.Por eso te salen duplicados Link to comment
Alexs Posted August 19, 2013 Share Posted August 19, 2013 Si, lo que quiero hacer un sistema que eh visto en varios servers YA! Como por ejemplo: [GLOBAL] , [LOCAL], [RADIO]! Tendrás que quitar eso del freeroam, ya que tiene un sistema de mensajes por chat propio para que el texto sea blanco y no amarillo pálido como es normalmente. Esta es la sección del freeroam que deberías borrar, esta en el archivo fr_server.lua: addEventHandler('onPlayerChat', g_Root, function(msg, type) if type == 0 then cancelEvent() if chatTime[source] and chatTime[source] + tonumber(get("*chat/mainChatDelay")) > getTickCount() then outputChatBox("Stop spamming main chat!", source, 255, 0, 0) return else chatTime[source] = getTickCount() end if get("*chat/blockRepeatMessages") == "true" and lastChatMessage[source] and lastChatMessage[source] == msg then outputChatBox("Stop repeating yourself!", source, 255, 0, 0) return else lastChatMessage[source] = msg end local r, g, b = getPlayerNametagColor(source) outputChatBox(getPlayerName(source) .. ': #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) end end ) Link to comment
DefearT Posted August 20, 2013 Author Share Posted August 20, 2013 Gracias por eso, pero estoy creando un server en otro modo de juego que no es freeroam, ni race, nada es algo que en lo que estoy trabajando, como podria lo que te mencione anteriormente? Link to comment
MTA Team 0xCiBeR Posted August 20, 2013 MTA Team Share Posted August 20, 2013 Hay varios resources en la comunidad que hacen lo que necesitas..Es mas @Yakuza de este foro tiene un localchat si no me equivoco subido..Solo busca localchat, globalchat etc..Y te saldran.. Saludos Link to comment
BorderLine Posted August 20, 2013 Share Posted August 20, 2013 te dejo mi script de sistema de chat completo, De todos modos lo iva a subir a la comunidad. local chatRadius = 70 function sendMessageToNearbyPlayers ( message, messageType ) if ( messageType == 0 ) then local posX, posY, posZ = getElementPosition ( source ) local red, green, blue = getPlayerNametagColor ( source ) local chatSphere = createColSphere ( posX, posY, posZ, chatRadius ) local nearbyPlayers = getElementsWithinColShape ( chatSphere, "player" ) destroyElement ( chatSphere ) for index, nearbyPlayer in ipairs( nearbyPlayers ) do local team = getPlayerTeam(source) if (team) then red, green, blue = getTeamColor( team ) end outputChatBox( "("..#nearbyPlayers..")"..getPlayerName ( source )..": #ffffff".. message, nearbyPlayer, red, green, blue, true ) end cancelEvent ( ) end end addEventHandler ( "onPlayerChat", getRootElement(), sendMessageToNearbyPlayers ) addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"u","down","chatbox","City") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","City") end end) function CityChat(P,_,...) local r, g, b = getPlayerNametagColor ( P ) local city = getElementData ( P, "City" ) local message = table.concat({...}, " ") if ( city and city ~= "Downloading.." ) then for index, playersCity in ipairs ( getElementsByType ( "player" ) ) do if ( getElementData ( playersCity, "City" ) == city ) then if not isPlayerMuted ( P ) then outputChatBox ("("..city..")"..getPlayerName(P) ..": #FFFFFF".. message, playersCity, r, g, b, true ) else exports.errorwindow: show ( P, "error", "You are Muted", 4000, "Error",false) end end end end end addCommandHandler("City",CityChat) function onChatCar(player,_,...) local msg = table.concat({...}, " ") local nick = getPlayerName(player) local r, g, b = getPlayerNametagColor ( player ) local vehicle = getPedOccupiedVehicle(player) local occupants = getVehicleOccupants(vehicle) local seats = getVehicleMaxPassengers(vehicle) if isPedInVehicle (player) then for seat = 0, seats do local occupant = occupants[seat] if occupant and getElementType(occupant)=="player" then outputChatBox("(Car Chat)"..(nick)..": #FFFFFF"..(msg).." ", occupant, r, g, b, true) end end else exports.errorwindow: show ( player, "error", "Debes estar dentro de un vehiculo para usar /cc", 2000, "Error",false) end end addCommandHandler("cc",onChatCar) function onChatGlobal(player,_,...) local msg = table.concat({...}, " ") local nick = getPlayerName(player) local uMoney = getPlayerMoney(player) local r, g, b = getPlayerNametagColor ( player ) if not isPlayerMuted ( player ) then if (uMoney >= 2000 ) then outputChatBox("(Global)"..(nick)..": #FFFFFF"..(msg) , getRootElement(), r, g, b, true ) exports.errorwindow: show ( player, "info", "Taken #ff0000-$2000#ffffff for use Global Chat", 2000, "Informacion",false) takePlayerMoney(player,2000) else exports.errorwindow: show ( player, "error", "You Need #00ff00-$2000#ffffff to use Global Chat", 2000, "Informacion",false) end else exports.errorwindow: show ( player, "error", "You are muted", 4000, "Error",false) end end addCommandHandler("Global",onChatGlobal) function onChatG(player,_,...) local account = getPlayerAccount(player) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then local msg2 = table.concat({...}, " ") local nick2 = getPlayerName(player) local r, g, b = getPlayerNametagColor ( player ) outputChatBox("(Admin)"..(nick2)..": #FFFFFF"..(msg2) , getRootElement(), r, g, b, true ) end end addCommandHandler("Admin",onChatG) function onChatSm(player,_,...) local account = getPlayerAccount(player) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'SuperModerator' ) ) then local msg2 = table.concat({...}, " ") local nick2 = getPlayerName(player) local r, g, b = getPlayerNametagColor ( player ) outputChatBox("(S.Mod)"..(nick2)..": #FFFFFF"..(msg2) , getRootElement(), r, g, b, true ) end end addCommandHandler("Smod",onChatSm) addEventHandler ( "onPlayerChat", getRootElement(), function ( message, messageType ) if messageType == 1 then cancelEvent() end end) Edita lo que puedas Link to comment
DefearT Posted August 22, 2013 Author Share Posted August 22, 2013 Gracias, te lo agradesco. Link to comment
Recommended Posts