PrivateKiller Posted December 25, 2014 Share Posted December 25, 2014 Hey guys! I'm trying to bind adminchat, which is included in admin panel(default one). So, i can't find where is that script saved, because I want to add: addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"m","down","chatbox","ADMINCHAT") --I don't know the right name of Admin chatbox end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"m","down","chatbox","ADMINCHAT") --I don't know the right name of Admin chatbox end end) But that will bind for all players in my server... How can I set that, will bind only players who is in acl group "Admin"? I just want to bind existing AdminChat, because currently, we can only talk through Admin panel... HELP. I need to know where is the script (adminchat) and how to bind only for specified acl group. Thanks Link to comment
Castillo Posted December 25, 2014 Share Posted December 25, 2014 getPlayerAccount getAccountName isObjectInACLGroup Link to comment
PrivateKiller Posted December 25, 2014 Author Share Posted December 25, 2014 getPlayerAccount getAccountName isObjectInACLGroup Solidsnake14, I need someone like u... Do you know where is location of adminchat? (C:\Program Files (x86)\MTA San Andreas 1.4\server\mods\deathmatch\resources\[admin]......)?? Link to comment
Castillo Posted December 25, 2014 Share Posted December 25, 2014 admin/server/admin_server.lua Link to comment
PrivateKiller Posted December 25, 2014 Author Share Posted December 25, 2014 Not working . Bind still won't work. I also tryed to recconect, i restarted the resource,.. everything! Can some1 look at the code and tell me what's wrong? Mabye I should add addCommandHandler("aAdminChat",nofunction)? addEvent ( "aAdminChat", true ) addEventHandler ( "aAdminChat", _root, function ( chat ) if checkClient( true, source, 'aAdminChat' ) then return end for id, player in ipairs(getElementsByType("player")) do if ( aPlayers[player]["chat"] ) then triggerClientEvent ( player, "aClientAdminChat", source, chat ) end end end ) addEventHandler("onPlayerJoin",getRootElement(), function () bindKey(source,"m","down","chatbox","aAdminChat") end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do bindKey(player,"m","down","chatbox","aAdminChat") end end) Link to comment
Tekken Posted December 26, 2014 Share Posted December 26, 2014 try this function adminchat(thePlayer, theCMD, ...) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then local allArgs = {...} local mesajul = table.concat(allArgs, " ") for i,v in ipairs(getElementsByType("player")) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then outputChatBox("#E6FF00 "..getPlayerName(thePlayer)..": #FFFFFF"..tostring(mesajul), v, 255, 255, 255, true) end end end end addCommandHandler("a", adminchat, false) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"h", "down", "chatbox", "a"); end end) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "m", "down", "chatbox", "a"); -- bind key end ) Link to comment
PrivateKiller Posted December 26, 2014 Author Share Posted December 26, 2014 try this function adminchat(thePlayer, theCMD, ...) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then local allArgs = {...} local mesajul = table.concat(allArgs, " ") for i,v in ipairs(getElementsByType("player")) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then outputChatBox("#E6FF00 "..getPlayerName(thePlayer)..": #FFFFFF"..tostring(mesajul), v, 255, 255, 255, true) end end end end addCommandHandler("a", adminchat, false) addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"h", "down", "chatbox", "a"); end end) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "m", "down", "chatbox", "a"); -- bind key end ) Ye, CommandHandler and Evend Handler... That's what I forgot. I already writed some scripts but, where did you find function "h"? You didn't created it...? (15. line): bindKey(player,"h", "down", "chatbox", "a"); Link to comment
Tekken Posted December 27, 2014 Share Posted December 27, 2014 soryy..., forgot to delete my bind function adminchat(thePlayer, theCMD, ...) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then local allArgs = {...} local mesajul = table.concat(allArgs, " ") for i,v in ipairs(getElementsByType("player")) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then outputChatBox("#E6FF00 "..getPlayerName(thePlayer)..": #FFFFFF"..tostring(mesajul), v, 255, 255, 255, true) end end end end addCommandHandler("a", adminchat, false) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "m", "down", "chatbox", "a"); -- bind key end ) Link to comment
PrivateKiller Posted December 27, 2014 Author Share Posted December 27, 2014 Hahahaha, its okay mihayy5 . I'm still kinda learning lua scripting, and I was like: "WHAT THE F*CK :O" Hahahah thanks 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