Jump to content

Ayuda Mensaje Privado


#Dv^

Recommended Posts

Hola!

Como puedo hacer que este sistema de MP (Mensaje privado) que se mandan entre un player y otro player puedan verlos solo los staff, es decir que el staff (Admin, Mod,Smod) pueda ver algo así "(Mp) Nick > Zack : Oye, cómo estás?"

Pero que solo el staff lo vea, los demás que se manden mp´s normalmente

Este es el script del Mp

  
  
function privateMessage(thePlayer,commandName,sendToName,...) 
    local pmWords = { ... } 
    local pmMessage = table.concat( pmWords, " " ) 
    if sendToName then 
        if (getPlayerFromParticalName (sendToName)) then 
        toPlayer = (getPlayerFromParticalName (sendToName)) 
            if not (toPlayer == thePlayer) then 
                if not (pmMessage == "") then 
                    outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: "..getPlayerName(thePlayer).." #2971D5 > #FFFFFF " .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, thePlayer, 255, 255, 255, true) 
                    outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: "..getPlayerName(thePlayer).." #2971D5 > #FFFFFF " .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, toPlayer, 255, 255, 255, true) 
                     
                 
                     
                else 
                    outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: Sintaxis inválida! Usa:#FFFFFF /pm [nombre del jugador] [mensaje]", thePlayer, 255, 255, 255, true) 
                    return false 
                end 
            else 
                outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: No te puedes mandar MP a ti mismo#FFFFFF!", thePlayer, 255, 255, 255, true) 
                return false 
            end 
        else 
            outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: Jugador no encontrado! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) 
            return false 
        end 
    else 
        outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: Sintaxis inválida! Usa:#FFFFFF /mp [nombre del jugador] [mensaje]", thePlayer, 255, 255, 255, true) 
        return false 
    end 
end 
addCommandHandler("mp", privateMessage) 
  
  
function getPlayerFromParticalName(thePlayerName) 
    local thePlayer = getPlayerFromName(thePlayerName) 
    if thePlayer then 
        return thePlayer 
    end 
    for _,thePlayer in ipairs(getElementsByType("player")) do 
        if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then 
            return thePlayer 
        end 
    end 
return false 
end 
  
  

Se los agradezco!

Link to comment
  
pm_ACL = {"Admin", "SuperModerator", "Moderator"}; 
  
  
  
function privateMessage(thePlayer,commandName,sendToName,...) 
    local pmWords = { ... } 
    local pmMessage = table.concat( pmWords, " " ) 
    if sendToName then 
        if (getPlayerFromParticalName (sendToName)) then 
        toPlayer = (getPlayerFromParticalName (sendToName)) 
            if not (toPlayer == thePlayer) then 
                if not (pmMessage == "") then 
                    outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: "..getPlayerName(thePlayer).." #2971D5 > #FFFFFF " .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, thePlayer, 255, 255, 255, true) 
                    outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: "..getPlayerName(thePlayer).." #2971D5 > #FFFFFF " .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, toPlayer, 255, 255, 255, true) 
            for _, players in ipairs(getElementsByType("player")) do  
                if ( not isGuestAccount(getPlayerAccount(players)) and players ~= toPlayer and players ~= thePlayer ) then 
                    for _, aclName in ipairs(pm_ACL) do 
                            if ( isObjectInACLGroup("user."..(getAccountName(getPlayerAccount(players))), aclGetGroup(aclName))) then 
                            break outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: "..getPlayerName(thePlayer).." #2971D5 > #FFFFFF " .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, players, 255, 255, 255, true) 
                            end 
                        end 
                end 
            end 
                else 
                    outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: Sintaxis inválida! Usa:#FFFFFF /pm [nombre del jugador] [mensaje]", thePlayer, 255, 255, 255, true) 
                    return false 
                end 
            else 
                outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: No te puedes mandar MP a ti mismo#FFFFFF!", thePlayer, 255, 255, 255, true) 
                return false 
            end 
        else 
            outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: Jugador no encontrado! #FFFF00(#FFFFFF"..sendToName.."#FFFF00)", thePlayer, 255, 255, 255, true) 
            return false 
        end 
    else 
        outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: Sintaxis inválida! Usa:#FFFFFF /mp [nombre del jugador] [mensaje]", thePlayer, 255, 255, 255, true) 
        return false 
    end 
end 
addCommandHandler("mp", privateMessage) 
  
  
function getPlayerFromParticalName(thePlayerName) 
    local thePlayer = getPlayerFromName(thePlayerName) 
    if thePlayer then 
        return thePlayer 
    end 
    for _,thePlayer in ipairs(getElementsByType("player")) do 
        if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then 
            return thePlayer 
        end 
    end 
return false 
end 
  
  

Link to comment
                            if ( isObjectInACLGroup("user."..(getAccountName(getPlayerAccount(players))), aclGetGroup(aclName))) then 
                            outputChatBox("#2971D5[#4E5861MP#2971D5]#FFFFFF: "..getPlayerName(thePlayer).." #2971D5 > #FFFFFF " .. getPlayerName(toPlayer) .. "#FFFFFF: " .. pmMessage, players, 255, 255, 255, true) 
                            break 
                            end 

Link to comment

Gracias Gaberiel!

El mismo problema tengo con el Local Chat

Traté de agregarlo solo para el staff, para quienes hablar por local el staff pueda verlo tambien, por que por local chat solo lo ven los que estan cerca del player que hablar por local, pero me da error y no entiendo por que

    chat_range=100 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"u","down","chatbox","Local") 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"u","down","chatbox","Local") 
  end 
end) 
  
function isPlayerInRangeOfPoint(player,x,y,z,range) 
   local px,py,pz=getElementPosition(player) 
   return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range 
end 
  
function onChat(player,_,...) 
  local px,py,pz=getElementPosition(player) 
  local msg = table.concat({...}, " ") 
  local nick=getPlayerName(player) 
  local tag = getElementData(player, "ID") or 0 
local r,g,b = getTeamColor(getPlayerTeam(player)) 
  for _,v in ipairs(getElementsByType("player")) do 
    if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then 
      outputChatBox("#00FF00[Local]#cccccc[".. tag .."]#FFFFFF "..nick..": #FFFFFF"..msg,v,r,g,b,true) 
       for _, players in ipairs(getElementsByType("player")) do 
                if ( not isGuestAccount(getPlayerAccount(players)) and players ~= toPlayer and players ~= thePlayer ) then 
                    for _, aclName in ipairs(pm_ACL) do 
                                  if ( isObjectInACLGroup("user."..(getAccountName(getPlayerAccount(players))), aclGetGroup(aclName))) then 
                            outputChatBox("Local Staff "..getPlayerName(thePlayer).."#FFFFFF: " .. msg, v, 255, 255, 255, true) 
                            break 
                            end 
    end 
  end 
end 
addCommandHandler("Local",onChat) 
  

Edited by Guest
Link to comment
  
    chat_range=100 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"u","down","chatbox","Local") 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"u","down","chatbox","Local") 
  end 
end) 
  
function isPlayerInRangeOfPoint(player,x,y,z,range) 
   local px,py,pz=getElementPosition(player) 
   return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range 
end 
  
function onChat(player,_,...) 
  local px,py,pz=getElementPosition(player) 
  local msg = table.concat({...}, " ") 
  local nick=getPlayerName(player) 
  local tag = getElementData(player, "ID") or 0 
  
  for _,v in ipairs(getElementsByType("player")) do 
    if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) or isPlayerAdmin(v) then 
      outputChatBox("#00FF00[Local]#cccccc[".. tag .."]#FFFFFF "..nick..": #FFFFFF"..msg,v,255,0,0,true) 
    
    end 
  end 
end 
addCommandHandler("Local",onChat) 
  
isAdmin_ACL = {"Admin", "SuperModerator", "Moderator"}; 
  
function isPlayerAdmin (player) 
    if (player and isElement(player) and not isGuestAccount(getPlayerAccount(player)) ) then 
        for _, aclName in ipairs(isAdmin_ACL) do 
            if ( isObjectInACLGroup("user."..(getAccountName(getPlayerAccount(player))), aclGetGroup(aclName)) ) then 
                return true; 
            end 
        end 
        return false; 
    end 
end 

Link to comment
  • Recently Browsing   0 members

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