Jump to content

كود شباب


Recommended Posts

السلام عليكم

بدي كود

الي هو للشات بوكس

مثلا

outputChatBox("text",root,255,255,255,true) 

آبي اخلي يطلع في الشات بوكس مو للكل

فقط ل قروب معين مثلا

groups = {"Console","Admin"} 

مثلا يطلع بالشات فقط للقروبين ذول كيف اسويها ممكن شباب ؟

Link to comment
    addEventHandler("onPlayerLogin", root, 
    function () 
        if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(source)),aclGetGroup('Console')) then 
            bindKey(source,"u","down","chatbox","AdminChat") 
        end 
    end) 
      
    addEventHandler("onResourceStart", resourceRoot, 
    function () 
        for index, player in pairs(getElementsByType("player")) do 
             if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(player)),aclGetGroup('Console')) then 
                bindKey(player,"u","down","chatbox","AdminChat") 
            end 
        end 
    end) 
      
    function onChat(player,_,...) 
         if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(player)),aclGetGroup('Console')) then 
            local msg = table.concat({...}, " ") 
            local nick = getPlayerName(player) 
            for _, v in ipairs(getElementsByType("player")) do 
                 if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(v)),aclGetGroup('Console')) then 
                    outputChatBox("(AdminChat) "..nick..": #ffffff"..msg,v,255,100,0,true) 
                end 
            end 
        end 
    end 
    addCommandHandler("AdminChat",onChat) 

Link to comment

شوف شو سويت لكن ما ضبط معي

شوف

g = {"Console","Admin"} 
addEventHandler("onPlayerLogin", root, 
    function () 
        for _,g in ipairs(g) do 
        if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(source)),aclGetGroup(g)) then 
            bindKey(source,"u","down","chatbox","AdminChat") 
        end 
    end 
end) 
      
    addEventHandler("onResourceStart", resourceRoot, 
    function () 
        for index, player in pairs(getElementsByType("player")) do 
                for _,g in ipairs(g) do 
             if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(player)),aclGetGroup(g)) then 
                bindKey(player,"u","down","chatbox","AdminChat") 
            end 
        end 
    end 
end) 
      
    function onChat(player,_,...) 
         if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(player)),aclGetGroup('Console')) then 
            local msg = table.concat({...}, " ") 
            local nick = getPlayerName(player) 
            for _, v in ipairs(getElementsByType("player")) do 
            for _,g in ipairs(g) do 
                 if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(v)),aclGetGroup(g)) then 
                    outputChatBox("#ffffff(AdminChat) "..nick..": #ffffff"..msg,v,255,100,0,true) 
                end 
            end 
        end 
    end 
end 
    addCommandHandler("AdminChat",onChat) 

سويت جدول عن القروبات

لكن في مشكلة

ان الكونسول يشوف الكلام الي يكتبه غيره لكن غيره ما يشوف وكذا ومشاكل

انا توي مبتدأ ماعرف كثير ممكن تساعدوني ؟

Link to comment
شوف شو سويت لكن ما ضبط معي

شوف

g = {"Console","Admin"} 
addEventHandler("onPlayerLogin", root, 
    function () 
        for _,g in ipairs(g) do 
        if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(source)),aclGetGroup(g)) then 
            bindKey(source,"u","down","chatbox","AdminChat") 
        end 
    end 
end) 
      
    addEventHandler("onResourceStart", resourceRoot, 
    function () 
        for index, player in pairs(getElementsByType("player")) do 
                for _,g in ipairs(g) do 
             if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(player)),aclGetGroup(g)) then 
                bindKey(player,"u","down","chatbox","AdminChat") 
            end 
        end 
    end 
end) 
      
    function onChat(player,_,...) 
         if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(player)),aclGetGroup('Console')) then 
            local msg = table.concat({...}, " ") 
            local nick = getPlayerName(player) 
            for _, v in ipairs(getElementsByType("player")) do 
            for _,g in ipairs(g) do 
                 if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(v)),aclGetGroup(g)) then 
                    outputChatBox("#ffffff(AdminChat) "..nick..": #ffffff"..msg,v,255,100,0,true) 
                end 
            end 
        end 
    end 
end 
    addCommandHandler("AdminChat",onChat) 

سويت جدول عن القروبات

لكن في مشكلة

ان الكونسول يشوف الكلام الي يكتبه غيره لكن غيره ما يشوف وكذا ومشاكل

انا توي مبتدأ ماعرف كثير ممكن تساعدوني ؟

مالي خبره لاكن اتوقع من ذا

if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(player)),aclGetGroup('Console')) then 

خله

         if isObjectInACLGroup('user.'..getAccountName(getPlayerAccount(player)),aclGetGroup(g)) then 
  

Link to comment

* Not Tested :

* Server :

ListAclGroup = {  
    { 'Admin' }, 
    { 'Console' }, 
} 
  
addEventHandler ( 'onPlayerLogin', root, 
    for index, Acl in ipairs ( ListAclGroup ) do 
        function ( ) 
            if isObjectInACLGroup ( 'user.'..getAccountName( getPlayerAccount( source ) ), aclGetGroup ( Acl ) ) then 
                bindKey( source,"u","down","chatbox","AdminChat" ) 
        end 
    end 
end ) 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
    for index, player in pairs ( getElementsByType ( "player" ) ) do 
        for index, Acl in ipairs ( ListAclGroup ) do 
            if isObjectInACLGroup ( 'user.'..getAccountName(getPlayerAccount(player)), aclGetGroup ( Acl ) ) then 
                bindKey(player,"u","down","chatbox","AdminChat") 
            end 
        end 
    end 
end ) 
  
function onChat ( player, _, ... ) 
    for index, Acl in ipairs ( ListAclGroup ) do 
        if isObjectInACLGroup ( 'user.'..getAccountName(getPlayerAccount(player)),aclGetGroup( Acl ) ) then 
            local msg = table.concat({...}, " ") 
            local nick = getPlayerName(player) 
        for _, v in ipairs(getElementsByType("player")) do 
            if isObjectInACLGroup ( 'user.'..getAccountName(getPlayerAccount(v)),aclGetGroup( Acl ) ) then 
                    outputChatBox ( "(AdminChat) "..nick..": #ffffff"..msg,v,255,100,0,true ) 
                end 
            end 
        end 
    end 
end 
  
addCommandHandler ( 'AdminChat', onChat ) 
Link to comment
ListAclGroup = { 
    { 'Admin' }, 
    { 'Console' }, 
} 
  
addEventHandler ( 'onPlayerLogin', root, 
        function ( ) 
        for i,Acl in ipairs (ListAclGroup) do 
            if isObjectInACLGroup ( 'user.'..getAccountName( getPlayerAccount( source ) ), aclGetGroup ( Acl ) ) then 
                bindKey( source,"u","down","chatbox","AdminChat" ) 
    end 
  end  
end) 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
    for index, player in pairs ( getElementsByType ( "player" ) ) do 
        for index, Acl in ipairs ( ListAclGroup ) do 
            if isObjectInACLGroup ( 'user.'..getAccountName(getPlayerAccount(player)), aclGetGroup ( Acl ) ) then 
                bindKey(player,"u","down","chatbox","AdminChat") 
            end 
        end 
    end 
end ) 
  
function onChat ( player, _, ... ) 
    for index, Acl in ipairs ( ListAclGroup ) do 
        if isObjectInACLGroup ( 'user.'..getAccountName(getPlayerAccount(player)),aclGetGroup( Acl ) ) then 
            local msg = table.concat({...}, " ") 
            local nick = getPlayerName(player) 
        for _, v in ipairs(getElementsByType("player")) do 
            if isObjectInACLGroup ( 'user.'..getAccountName(getPlayerAccount(v)),aclGetGroup( Acl ) ) then 
                    outputChatBox ( "(AdminChat) "..nick..": #ffffff"..msg,v,255,100,0,true ) 
                end 
            end 
        end 
    end 
end 
  
addCommandHandler ( 'AdminChat', onChat ) 

الخطأ راح

الحين مشكلة بالارقمنت

[01:49:00] WARNING: AdminChat\server.lua:19: Bad argument @ 'aclGetGroup' [Expected string at argument 1, got table] 
[01:49:00] WARNING: AdminChat\server.lua:19: Bad argument @ 'isObjectInACLGroup' [Expected acl-group at argument 2, got boolean] 
[01:49:00] WARNING: AdminChat\server.lua:19: Bad argument @ 'aclGetGroup' [Expected string at argument 1, got table] 
[01:49:00] WARNING: AdminChat\server.lua:19: Bad argument @ 'isObjectInACLGroup' [Expected acl-group at argument 2, got boolean] 

Link to comment

طيب بدلتها والحين الديبق ما تقول اشي

بس بععدو في مشكلة ان الكلام ما يظهر الا لي قروب كونسول

يعني جربت مع اخوي اعطيته كونسول يجيه الكلام

اما اذا مكنش كونسول ما يجي اي شيء يا ليت ياليت تساعدوني ؟؟

Link to comment

إذآ تبيه بس الادمن والكونسل يكتبون والكلام يطلع للكل هذا الكود

    ListAclGroup = { 
    "Admin", 
    "Console" 
    } 
      
      
    addEventHandler ( 'onPlayerLogin', root, 
            function ( ) 
            for i,Acl in ipairs (ListAclGroup) do 
                if isObjectInACLGroup ( 'user.'..getAccountName( getPlayerAccount( source ) ), aclGetGroup ( Acl ) ) then 
                    bindKey( source,"u","down","chatbox","AdminChat" ) 
        end 
      end 
    end) 
      
    addEventHandler ( "onResourceStart", resourceRoot, 
        function ( ) 
        for index, player in pairs ( getElementsByType ( "player" ) ) do 
            for index, Acl in ipairs ( ListAclGroup ) do 
                if isObjectInACLGroup ( 'user.'..getAccountName(getPlayerAccount(player)), aclGetGroup ( Acl ) ) then 
                    bindKey(player,"u","down","chatbox","AdminChat") 
                end 
            end 
        end 
    end ) 
      
    function onChat ( player, _, ... ) 
        for index, Acl in ipairs ( ListAclGroup ) do 
            if isObjectInACLGroup ( 'user.'..getAccountName(getPlayerAccount(player)),aclGetGroup( Acl ) ) then 
                local msg = table.concat({...}, " ") 
                local nick = getPlayerName(player) 
            for _, v in ipairs(getElementsByType("player")) do 
            outputChatBox ( "( Admint ) "..nick..": #ffffff"..msg,v,255,0,0,true ) 
                end 
            end 
        end 
    end 
      
    addCommandHandler ( 'AdminChat', onChat ) 

طبعا الكود لتابل لكن عدلت عليه

Link to comment

الي ابيه ان

يقدرون يكتبون + يقرأون tableكل الاشخاص الي في القروبات الي وضعناها بال

لكن المشكلة انهم ما يقرأون ولا يشوفون غير الكونسول

Link to comment
ListAclGroup = { 
    "Admin", 
    "Console" 
} 
  
function isPlayerInACLGroup(arg) 
    local account = isElement(arg) and getPlayerAccount(arg) or arg 
    if account and not isGuestAccount(account) then 
        local accountName = getAccountName(account) 
        for i, group in ipairs(ListAclGroup) do 
            if isObjectInACLGroup("user."..accountName, aclGetGroup(group)) then 
                return true 
            end 
        end 
    end 
    return false 
end 
  
addEventHandler("onPlayerLogin", root, 
function(_, account) 
    if isPlayerInACLGroup(account) then 
        bindKey(source, "u", "down", "chatbox", "AdminChat") 
    end 
end) 
  
addEventHandler("onResourceStart", resourceRoot, 
function() 
    for i, player in pairs(getElementsByType("player")) do 
        if isPlayerInACLGroup(player) then 
            bindKey(player, "u", "down", "chatbox", "AdminChat") 
        end 
    end 
end) 
  
addCommandHandler("AdminChat", 
function(player, _, ...) 
    if isPlayerInACLGroup(player) then 
        local msg = table.concat({...}, " ") 
        local nick = getPlayerName(player) 
        for i, p in ipairs(getElementsByType("player")) do 
            if isPlayerInACLGroup(p) then 
                outputChatBox("( Admint ) "..nick..": #ffffff"..msg, p, 255, 0, 0, true) 
            end 
        end 
    end 
end) 

Link to comment

لم يتم التجربهـ .. :

local ChatGroups_ =  
   { 
     "Admin", 
     "SuperModerator", 
   } 
    
    
addEventHandler ( "onResourceStart", resourceRoot, function (  ) 
    for _,p in ipairs ( getElementsByType ( "player" ) ) do 
        bindKey( p, "u", "down", "chatbox", AdminsChat ) 
    end 
end ) 
  
addEventHandler ( "onPlayerJoin", root, function (  ) 
    bindKey( source, "u", "down", "chatbox", AdminsChat ) 
end ) 
  
addCommandHandler( "AdminsChat", function ( player, _, ... ) 
  if ( not isGuestAccount ( getPlayerAccount ( player ) ) ) then 
   local Player_acc = getAccountName ( getPlayerAccount ( player ) ) 
   local hisMsg     = table.concat ( { ... }, " " ) 
   local hisName    = getPlayerName ( player ) 
   for i = 1, #ChatGroups_ do 
     if ( isObjectInACLGroup( "user."..Player_acc, aclGetGroup ( ChatGroups_ [ i ] ) ) ) then 
       for _,p in ipairs ( getElementsByType ( "player" ) ) do 
         if ( not isGuestAccount ( getPlayerAccount ( p) ) ) then 
           for i = 1, #ChatGroups_ do 
             if ( isObjectInACLGroup( "user."..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( ChatGroups_ [ i ] ) ) ) then 
                  outputChatBox ( "[ Admin ] "..hisName..": #ffffff"..hisMsg, p, 255, 255, 255, true ) 
              end 
            end 
          end 
        end 
      end 
    end 
  end 
end ) 
Link to comment
ListAclGroup = { 
    "Admin", 
    "Console" 
} 
  
function isPlayerInACLGroup(arg) 
    local account = isElement(arg) and getPlayerAccount(arg) or arg 
    if account and not isGuestAccount(account) then 
        local accountName = getAccountName(account) 
        for i, group in ipairs(ListAclGroup) do 
            if isObjectInACLGroup("user."..accountName, aclGetGroup(group)) then 
                return true 
            end 
        end 
    end 
    return false 
end 
  
addEventHandler("onPlayerLogin", root, 
function(_, account) 
    if isPlayerInACLGroup(account) then 
        bindKey(source, "u", "down", "chatbox", "AdminChat") 
    end 
end) 
  
addEventHandler("onResourceStart", resourceRoot, 
function() 
    for i, player in pairs(getElementsByType("player")) do 
        if isPlayerInACLGroup(player) then 
            bindKey(player, "u", "down", "chatbox", "AdminChat") 
        end 
    end 
end) 
  
addCommandHandler("AdminChat", 
function(player, _, ...) 
    if isPlayerInACLGroup(player) then 
        local msg = table.concat({...}, " ") 
        local nick = getPlayerName(player) 
        for i, p in ipairs(getElementsByType("player")) do 
            if isPlayerInACLGroup(p) then 
                outputChatBox("( Admint ) "..nick..": #ffffff"..msg, p, 255, 0, 0, true) 
            end 
        end 
    end 
end) 

كفوو والله حبيبي الله يخليك الكود اشتغل والله انك مجرم

مشكوررر وربي

وش سويت زيادة وش كان خطأئي يعني ممكن تشرح لي ؟

Link to comment

كفوو والله حبيبي الله يخليك الكود اشتغل والله انك مجرم

مشكوررر وربي

وش سويت زيادة وش كان خطأئي يعني ممكن تشرح لي ؟

بـ ما ان الكود صغير نوعا ما

المفروض إنك تقرا الكؤد , وتقرا كودك وتشوف الفرق

و بالتوفيق لك

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