abo_7mod Posted July 16, 2015 Share Posted July 16, 2015 السلام عليكم بدي كود الي هو للشات بوكس مثلا outputChatBox("text",root,255,255,255,true) آبي اخلي يطلع في الشات بوكس مو للكل فقط ل قروب معين مثلا groups = {"Console","Admin"} مثلا يطلع بالشات فقط للقروبين ذول كيف اسويها ممكن شباب ؟ Link to comment
Simple. Posted July 16, 2015 Share Posted July 16, 2015 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
abo_7mod Posted July 16, 2015 Author Share Posted July 16, 2015 طيب لو ابي اسوي جدول كيف اربطه مع اللوب ؟ Link to comment
abo_7mod Posted July 16, 2015 Author Share Posted July 16, 2015 شوف شو سويت لكن ما ضبط معي شوف 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
#Mr.Rajo~,< Posted July 16, 2015 Share Posted July 16, 2015 شوف شو سويت لكن ما ضبط معيشوف 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
i S6O Posted July 16, 2015 Share Posted July 16, 2015 * 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
abo_7mod Posted July 16, 2015 Author Share Posted July 16, 2015 [01:44:40] ERROR: Loading script failed: AdminChat\server.lua:7: unexpected symbol near 'for' Link to comment
abo_7mod Posted July 16, 2015 Author Share Posted July 16, 2015 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
; Mr.T76eM # Posted July 16, 2015 Share Posted July 16, 2015 replace the table ListAclGroup = { "Admin", "Console" } Link to comment
abo_7mod Posted July 16, 2015 Author Share Posted July 16, 2015 طيب بدلتها والحين الديبق ما تقول اشي بس بععدو في مشكلة ان الكلام ما يظهر الا لي قروب كونسول يعني جربت مع اخوي اعطيته كونسول يجيه الكلام اما اذا مكنش كونسول ما يجي اي شيء يا ليت ياليت تساعدوني ؟؟ Link to comment
abo_7mod Posted July 17, 2015 Author Share Posted July 17, 2015 ردو ارجو المساعدةة ارجوككم........................................ U[P] Link to comment
abo_7mod Posted July 17, 2015 Author Share Posted July 17, 2015 ما في اي احد يقدر يفيدني ؟ يا الله ........ Link to comment
#|_oskar_|# Posted July 17, 2015 Share Posted July 17, 2015 ما في اي احد يقدر يفيدني ؟ يا الله ........ انت تبي اى شخص يقدر يكنب و الكونسل والادمن بس يشوفو الكلام ؟ Link to comment
Simple. Posted July 18, 2015 Share Posted July 18, 2015 إذآ تبيه بس الادمن والكونسل يكتبون والكلام يطلع للكل هذا الكود 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
abo_7mod Posted July 18, 2015 Author Share Posted July 18, 2015 الي ابيه ان يقدرون يكتبون + يقرأون tableكل الاشخاص الي في القروبات الي وضعناها بال لكن المشكلة انهم ما يقرأون ولا يشوفون غير الكونسول Link to comment
TAPL Posted July 18, 2015 Share Posted July 18, 2015 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
#DRAGON!FIRE Posted July 18, 2015 Share Posted July 18, 2015 لم يتم التجربهـ .. : 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
abo_7mod Posted July 18, 2015 Author Share Posted July 18, 2015 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
i S6O Posted July 18, 2015 Share Posted July 18, 2015 كفوو والله حبيبي الله يخليك الكود اشتغل والله انك مجرم مشكوررر وربي وش سويت زيادة وش كان خطأئي يعني ممكن تشرح لي ؟ بـ ما ان الكود صغير نوعا ما المفروض إنك تقرا الكؤد , وتقرا كودك وتشوف الفرق و بالتوفيق لك Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now