Jump to content

local?


z24d

Recommended Posts

السلام عليكم ورحمة الله وبركاتةة#

انا اليوم عدلت علا الوكال شات علأ انه يطلع رسالة الشخص للأدمن بس ماظبط!؟

سيرفر

chat_range=70 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"u","down","chatbox","Local Chat") 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"u","down","chatbox","Local Chat") 
  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 q1 = getTeamName(getPlayerTeam(player)) 
local r,g,b = getTeamColor(getPlayerTeam(player)) 
  for _,v in ipairs(getElementsByType("player")) do 
    if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then 
      outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,v,r,g,b,true) 
    end 
  end 
end 
addCommandHandler("Local",onChat) 
  
  
  
  
  
function( thePlayer ) 
    if ( isPlayerOnGroup ( thePlayer ) ) then 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        if ( isPlayerOnGroup ( player ) ) then 
        outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,player,r,g,b,true) 
            end 
        end 
    end 
end 
) 
  
function isPlayerOnGroup ( thePlayer ) 
    local account = getPlayerAccount ( thePlayer ) 
    local inGroup = false 
    for _, group in ipairs ( { "Console", "Admin1", "SuperModerator1", "Moderator1", "Moderator2", "Master", "Moafek", "Sozr", "SuperModerator2", "msol.beot", "Super.Admin", "FDR", "Mangres", "m5fe", "Super.Police", "Big.Admin", "msol", "Head.Admin" } ) do   
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) or 
        hasObjectPermissionTo(getAccountName ( account ),"function.Slap",false) then 
            inGroup = true 
            break 
        end 
    end 
  
    return inGroup 
end 
  
  
  
  
  

Link to comment
السلام عليكم ورحمة الله وبركاتةة#

انا اليوم عدلت علا الوكال شات علأ انه يطلع رسالة الشخص للأدمن بس ماظبط!؟

سيرفر

chat_range=70 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"u","down","chatbox","Local Chat") 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"u","down","chatbox","Local Chat") 
  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 q1 = getTeamName(getPlayerTeam(player)) 
local r,g,b = getTeamColor(getPlayerTeam(player)) 
  for _,v in ipairs(getElementsByType("player")) do 
    if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then 
      outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,v,r,g,b,true) 
    end 
  end 
end 
addCommandHandler("Local",onChat) 
  
  
  
  
  
function( thePlayer ) 
    if ( isPlayerOnGroup ( thePlayer ) ) then 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        if ( isPlayerOnGroup ( player ) ) then 
        outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,player,r,g,b,true) 
            end 
        end 
    end 
end 
) 
  
function isPlayerOnGroup ( thePlayer ) 
    local account = getPlayerAccount ( thePlayer ) 
    local inGroup = false 
    for _, group in ipairs ( { "Console", "Admin1", "SuperModerator1", "Moderator1", "Moderator2", "Master", "Moafek", "Sozr", "SuperModerator2", "msol.beot", "Super.Admin", "FDR", "Mangres", "m5fe", "Super.Police", "Big.Admin", "msol", "Head.Admin" } ) do   
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) or 
        hasObjectPermissionTo(getAccountName ( account ),"function.Slap",false) then 
            inGroup = true 
            break 
        end 
    end 
  
    return inGroup 
end 
  
  
  
  
  

bindKey(source,"u","down","chatbox","Local Chat") 

الساينتكس غلط

source = XX

Link to comment
السلام عليكم ورحمة الله وبركاتةة#

انا اليوم عدلت علا الوكال شات علأ انه يطلع رسالة الشخص للأدمن بس ماظبط!؟

سيرفر

chat_range=70 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"u","down","chatbox","Local Chat") 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"u","down","chatbox","Local Chat") 
  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 q1 = getTeamName(getPlayerTeam(player)) 
local r,g,b = getTeamColor(getPlayerTeam(player)) 
  for _,v in ipairs(getElementsByType("player")) do 
    if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then 
      outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,v,r,g,b,true) 
    end 
  end 
end 
addCommandHandler("Local",onChat) 
  
  
  
  
  
function( thePlayer ) 
    if ( isPlayerOnGroup ( thePlayer ) ) then 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        if ( isPlayerOnGroup ( player ) ) then 
        outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,player,r,g,b,true) 
            end 
        end 
    end 
end 
) 
  
function isPlayerOnGroup ( thePlayer ) 
    local account = getPlayerAccount ( thePlayer ) 
    local inGroup = false 
    for _, group in ipairs ( { "Console", "Admin1", "SuperModerator1", "Moderator1", "Moderator2", "Master", "Moafek", "Sozr", "SuperModerator2", "msol.beot", "Super.Admin", "FDR", "Mangres", "m5fe", "Super.Police", "Big.Admin", "msol", "Head.Admin" } ) do   
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) or 
        hasObjectPermissionTo(getAccountName ( account ),"function.Slap",false) then 
            inGroup = true 
            break 
        end 
    end 
  
    return inGroup 
end 
  
  
  
  
  

bindKey(source,"u","down","chatbox","Local Chat") 

الساينتكس غلط

source = XX

bool bindKey ( player thePlayer, string key, string keyState, string commandName, [ string arguments ] ) 

-_- انت غلطان الكلنت هو مافيه

player thePlayer 

شف السنتاكس حق السيرفر والكلنت بعدين تكلم ,

Link to comment

كودكـ كذا بيصير شغال ذذذ بس أنا مافهمت آيش تبي بتحقق اللاعبين؟

chat_range=70 
  
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 q1 = getTeamName(getPlayerTeam(player)) 
local r,g,b = getTeamColor(getPlayerTeam(player)) 
  for _,v in ipairs(getElementsByType("player")) do 
    if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then 
      outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,v,r,g,b,true) 
    end 
  end 
end 
addCommandHandler("Local",onChat) 
Link to comment

Groups = { "Console", "Admin1", "SuperModerator1", "Moderator1", "Moderator2", "Master", "Moafek", "Sozr", "SuperModerator2", "msol.beot", "Super.Admin", "FDR", "Mangres", "m5fe", "Super.Police", "Big.Admin", "msol", "Head.Admin" } 
chat_range=70 
  
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 q1 = getTeamName(getPlayerTeam(player)) 
local r,g,b = getTeamColor(getPlayerTeam(player)) 
  for _,v in ipairs(getElementsByType("player")) do 
   if ( isPlayerOnGroup ( v ) ) then 
    if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then 
      outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,v,r,g,b,true) 
       end 
    end 
  end 
end 
addCommandHandler("Local",onChat) 
  
function isPlayerOnGroup ( thePlayer ) 
    local account = getPlayerAccount ( thePlayer ) 
    local inGroup = false 
    for _, group in ipairs ( Groups ) do   
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) or 
        hasObjectPermissionTo(getAccountName ( account ),"function.Slap",false) then 
            inGroup = true 
            break 
        end 
    end 
      return inGroup 
end 
Link to comment
السلام عليكم ورحمة الله وبركاتةة#

انا اليوم عدلت علا الوكال شات علأ انه يطلع رسالة الشخص للأدمن بس ماظبط!؟

سيرفر

chat_range=70 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"u","down","chatbox","Local Chat") 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"u","down","chatbox","Local Chat") 
  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 q1 = getTeamName(getPlayerTeam(player)) 
local r,g,b = getTeamColor(getPlayerTeam(player)) 
  for _,v in ipairs(getElementsByType("player")) do 
    if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then 
      outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,v,r,g,b,true) 
    end 
  end 
end 
addCommandHandler("Local",onChat) 
  
  
  
  
  
function( thePlayer ) 
    if ( isPlayerOnGroup ( thePlayer ) ) then 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        if ( isPlayerOnGroup ( player ) ) then 
        outputChatBox("(" .. q1 .. ")  "..nick.." #E0FFFF: "..msg,player,r,g,b,true) 
            end 
        end 
    end 
end 
) 
  
function isPlayerOnGroup ( thePlayer ) 
    local account = getPlayerAccount ( thePlayer ) 
    local inGroup = false 
    for _, group in ipairs ( { "Console", "Admin1", "SuperModerator1", "Moderator1", "Moderator2", "Master", "Moafek", "Sozr", "SuperModerator2", "msol.beot", "Super.Admin", "FDR", "Mangres", "m5fe", "Super.Police", "Big.Admin", "msol", "Head.Admin" } ) do   
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) ) or 
        hasObjectPermissionTo(getAccountName ( account ),"function.Slap",false) then 
            inGroup = true 
            break 
        end 
    end 
  
    return inGroup 
end 
  
  
  
  
  

bindKey(source,"u","down","chatbox","Local Chat") 

الساينتكس غلط

source = XX

الحشيش تمام؟

Link to comment
Groups = {"Console", "Admin1", "SuperModerator1", "Moderator1", "Moderator2", "Master", "Moafek", "Sozr", "SuperModerator2", "msol.beot", "Super.Admin", "FDR", "Mangres", "m5fe", "Super.Police", "Big.Admin", "msol", "Head.Admin"} 
chat_range = 70 
  
addEventHandler("onPlayerJoin", root, 
function() 
    bindKey(source, "u", "down", "chatbox", "Local") 
end) 
  
addEventHandler("onResourceStart", resourceRoot, 
function() 
    for i, 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 
  
addCommandHandler("Local", 
function(player, _, ...) 
    local px, py, pz = getElementPosition(player) 
    local msg = table.concat({...}, " ") 
    local nick = getPlayerName(player) 
    local team = getPlayerTeam(player) 
    local teamName 
    local r, g, b 
    if team then 
        teamName = getTeamName(team) 
        r, g, b = getTeamColor(team) 
    else 
        teamName = "" 
        r, g, b = 255, 255, 255 
    end 
    for _, v in ipairs(getElementsByType("player")) do 
        if isPlayerInRangeOfPoint(v, px, py, pz, chat_range) or isPlayerOnGroup(v) then 
            outputChatBox("("..teamName..")  "..nick.." #E0FFFF: "..msg, v, r, g, b, true) 
        end 
    end 
end) 
  
function isPlayerOnGroup(player) 
    local account = getPlayerAccount(player) 
    if account and not isGuestAccount(account) then 
        local accName = getAccountName(account) 
        for _, groupName in ipairs (Groups) do 
            local group = aclGetGroup(groupName) 
            if (group and isObjectInACLGroup("user."..accName, group)) or hasObjectPermissionTo(player, "function.Slap", false) then 
                return true 
            end 
        end 
    end 
end 

Link to comment
Groups = {"Console", "Admin1", "SuperModerator1", "Moderator1", "Moderator2", "Master", "Moafek", "Sozr", "SuperModerator2", "msol.beot", "Super.Admin", "FDR", "Mangres", "m5fe", "Super.Police", "Big.Admin", "msol", "Head.Admin"} 
chat_range = 70 
  
addEventHandler("onPlayerJoin", root, 
function() 
    bindKey(source, "u", "down", "chatbox", "Local") 
end) 
  
addEventHandler("onResourceStart", resourceRoot, 
function() 
    for i, 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 
  
addCommandHandler("Local", 
function(player, _, ...) 
    local px, py, pz = getElementPosition(player) 
    local msg = table.concat({...}, " ") 
    local nick = getPlayerName(player) 
    local team = getPlayerTeam(player) 
    local teamName 
    local r, g, b 
    if team then 
        teamName = getTeamName(team) 
        r, g, b = getTeamColor(team) 
    else 
        teamName = "" 
        r, g, b = 255, 255, 255 
    end 
    for _, v in ipairs(getElementsByType("player")) do 
        if isPlayerInRangeOfPoint(v, px, py, pz, chat_range) or isPlayerOnGroup(v) then 
            outputChatBox("("..teamName..")  "..nick.." #E0FFFF: "..msg, v, r, g, b, true) 
        end 
    end 
end) 
  
function isPlayerOnGroup(player) 
    local account = getPlayerAccount(player) 
    if account and not isGuestAccount(account) then 
        local accName = getAccountName(account) 
        for _, groupName in ipairs (Groups) do 
            local group = aclGetGroup(groupName) 
            if (group and isObjectInACLGroup("user."..accName, group)) or hasObjectPermissionTo(player, "function.Slap", false) then 
                return true 
            end 
        end 
    end 
end 

Sankth !!

Link to comment

معليش ماودي أفتح موضوع جديد بس أبي اشوف شسالفة

الحين في مود أسمه

chatbubbles

شلون أسوي الأكسبورت حقة؟

يعني ارسلة رسالة من مود واخلية يطلع المسج فوق مخ الاعب

--كلينت 
local screenX, screenY = guiGetScreenSize() 
local messages = {} -- {text, player, lastTick, alpha, yPos} 
local timeVisible = 8500 
local distanceVisible = 100 
  
function addBubble(text, player, tick) 
    table.insert(messages, {["text"] = text, ["player"] = player, ["tick"] = tick, ["endTime"] = tick + 2000, ["alpha"] = 0}) 
end 
  
function removeBubble() 
    table.remove(messages) 
end 
  
addEvent("onChatIncome", true) 
addEventHandler("onChatIncome", root, 
    function(message, messagetype) 
        addBubble(message, source, getTickCount()) 
    end 
) 
  
addEventHandler("onClientRender", root,  
    function() 
        if #messages > 0 then 
            local tick = getTickCount() 
            local x, y, z = getElementPosition(localPlayer) 
            for i, v in ipairs(messages) do 
                if tick-v.tick < timeVisible then 
                    if getDistanceBetweenPoints3D(x, y, z, getElementPosition(v.player)) < distanceVisible then 
                        v.alpha = v.alpha < 200 and v.alpha + 5 or v.alpha 
                        local bx, by, bz = getPedBonePosition(v.player, 6) 
                        local sx, sy = getScreenFromWorldPosition(bx, by, bz) 
     
                        local elapsedTime = tick - v.tick 
                        local duration = v.endTime - v.tick 
                        local progress = elapsedTime / duration 
                         
                        if sx and sy then 
                            if not v.yPos then v.yPos = sy end 
                            local width = dxGetTextWidth(v.text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold") 
                            local yPos = interpolateBetween ( v.yPos, 0, 0, sy - 22*i, 0, 0, progress, progress > 1 and "Linear" or "OutElastic") 
                             
                            dxDrawRectangle(sx-width/2-.01*screenX, yPos - .03*screenY, width+.02*screenX, 20, tocolor(0, 0, 0, v.alpha)) 
                            dxDrawText(v.text, sx-width/2, yPos - .03*screenY, width, 20, tocolor( 255, 255, 255, v.alpha+50), 1, "default-bold", "left", "top", false, false, false, true) 
                        end 
                    end 
                else 
                    table.remove(messages, i) 
                end 
            end 
        end 
    end 
) 

سيرفر

function sendMessageToClient(message,messagetype) 
    if not wasEventCancelled() then 
        if messagetype == 0 or messagetype == 2 then 
            triggerClientEvent("onChatIncome", source, message, messagetype) 
        end 
    end 
end 
addEventHandler("onPlayerChat",getRootElement(),sendMessageToClient) 

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...