Jump to content

Question


Baseplate

Recommended Posts

addEventHandler('onPlayerChat', root, 
    function(message) 
        cancelEvent() 
        local fX, fY, fZ = getElementPosition(source) 
        message = string.format('(%s)%s:#ffffff %s', getZoneName(fX, fY, fZ, true), getPlayerName(source), message) 
        outputChatBox(message, root, 255, 255, 255, true) 
    end 
end 

Link to comment
addEventHandler('onPlayerChat', root, 
    function(message) 
        cancelEvent() 
        local fX, fY, fZ = getElementPosition(source) 
        message = string.format('(%s)%s:#ffffff %s', getZoneName(fX, fY, fZ, true), getPlayerName(source), message) 
        outputChatBox(message, root, 255, 255, 255, true) 
    end 
end 

Wouldn't that output this:

(Los Santos)Jaysds1: Hey ???

try this:

addEventHandler("onPlayerChat",root,function(msg) 
     cancelEvent() 
     local x,y,z = getElementPosition(localPlayer) 
     local zone = getZoneName(x,y,z,true) 
     local curZone 
     if zone=="Los Santos" then 
           curZone = "LS" 
      elseif zone == "Las Venturas" then 
           curZone = "LV" 
      elseif zone == "San Fierro" then 
           curZone = "SF" 
      else 
           curZone = zone 
      end 
      outputChatBox("("..curZone..")"..getPlayerName(source)..":"..msg) 
end) 

Link to comment
addEventHandler("onPlayerChat",root, 
  function(msg) 
     cancelEvent() 
     local playerTeam = getPlayerTeam( source ) 
     local r, g, b = getTeamColor( playerTeam ) 
     localPlayer = getPlayerFromName ( msg ) 
     local x,y,z = getElementPosition ( source ) 
     local zone = getZoneName(x,y,z,true) 
     local curZone 
     if zone=="Los Santos" then 
           curZone = "LS" 
      elseif zone == "Las Venturas" then 
           curZone = "LV" 
      elseif zone == "San Fierro" then 
           curZone = "SF" 
      else 
           curZone = zone 
      end 
      outputChatBox("("..curZone..")"..getPlayerName(source)..":"..msg) 
end) 

:S

Link to comment
addEventHandler("onPlayerChat",root, 
  function(msg) 
     cancelEvent() 
     local playerTeam = getPlayerTeam( source ) 
     local r, g, b = getTeamColor( playerTeam ) 
     localPlayer = getPlayerFromName ( msg ) 
     local x,y,z = getElementPosition ( source ) 
     local zone = getZoneName(x,y,z,true) 
     local curZone 
     if zone=="Los Santos" then 
           curZone = "LS" 
      elseif zone == "Las Venturas" then 
           curZone = "LV" 
      elseif zone == "San Fierro" then 
           curZone = "SF" 
      else 
           curZone = zone 
      end 
      outputChatBox("("..curZone..")"..getPlayerName(source)..":"..msg) 
end) 

:S

local zoneNames = {['Los Santos'] = 'LS', ['San Fierro'] = 'SF', ['Las Venturas'] = 'LV'} 
  
addEventHandler('onPlayerChat', root, 
    function(message) 
        cancelEvent() 
        local fX, fY, fZ = getElementPosition(source) 
        message = string.format('(%s)%s:#ffffff%s', zoneNames[getZoneName(fX, fY, fZ, true)], getPlayerNametagText(source), message) 
        outputChatBox(message, root, 255, 255, 255, true) 
    end 
) 

?

Link to comment
addEventHandler('onPlayerChat', root, 
function(message,type) 
     if type == 0 then 
          cancelEvent() 
          local fX, fY, fZ = getElementPosition(source) 
          local r, g, b = getTeamColor(getPlayerTeam(source)) 
          message = string.format('#%02X%02X%02X(%s)%s:#ffffff%s', r or 255, g or 255, b or 255, zoneNames[getZoneName(fX, fY, fZ, true)], getPlayerName(source), message) 
          outputChatBox(message, root, 255, 255, 255, true) 
     end 
end) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...