xeon17 Posted August 14, 2014 Share Posted August 14, 2014 How i can make my admin chat to work by bindkey ''‚'' ( ‚ ) function adminchat ( thePlayer, _, ... ) local message = table.concat ( { ... }, " " ) local account = getPlayerAccount(thePlayer) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) for i, v in pairs ( acls ) do if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "ORGANIZADOR" ) )) then outputChatBox ( "#FF0000[Organizador] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "MODERADOR" ) )) then outputChatBox ( "#FF0000[Moderador] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "ADMINISTADOR" ) )) then outputChatBox ( "#FF0000[Administrador] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "COLABORADOR" ) )) then outputChatBox ( "#FF0000[Colaborador] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "Console" ) )) then outputChatBox ( "#FF0000[Console] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end end end end addCommandHandler ( "ac", adminchat ) I tried but dosen't work ,help Et-win :DDDDD Link to comment
Et-win Posted August 14, 2014 Share Posted August 14, 2014 How you want to chat via a bind... You can't enter a message by then... Link to comment
TAPL Posted August 14, 2014 Share Posted August 14, 2014 MTA hard-coded commandschatbox: Opens the chatbox for input https://wiki.multitheftauto.com/wiki/Control_names https://wiki.multitheftauto.com/wiki/BindKey Link to comment
tosfera Posted August 14, 2014 Share Posted August 14, 2014 How you want to chat via a bind... You can't enter a message by then... You can bind a key to a chatbox. ^^ bindKey ( source, key, "down", "chatbox", function ); edit; ^ up was faster. Link to comment
xeon17 Posted August 14, 2014 Author Share Posted August 14, 2014 local acls = { "ORGANIZADOR", "MODERADOR", "ADMINISTADOR", "COLABORADOR", "Console" } function adminchat ( thePlayer, _, ... ) local message = table.concat ( { ... }, " " ) local account = getPlayerAccount(thePlayer) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) for i, v in pairs ( acls ) do if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "ORGANIZADOR" ) )) then outputChatBox ( "#FF0000[Organizador] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "MODERADOR" ) )) then outputChatBox ( "#FF0000[Moderador] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "ADMINISTADOR" ) )) then outputChatBox ( "#FF0000[Administrador] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "COLABORADOR" ) )) then outputChatBox ( "#FF0000[Colaborador] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end if (isObjectInACLGroup ( "user."..accountName, aclGetGroup ( "Console" ) )) then outputChatBox ( "#FF0000[Console] #FFFF00".. getPlayerName ( thePlayer ) .." : #FFFFFF".. message, player, 255, 255, 255, true ) end end end end addCommandHandler ( "ac", adminchat ) function isAllownedPlayer(player) local account = getPlayerAccount(player) if (not account or isGuestAccount(account)) then return false end local accountName = getAccountName(account) for i, v in pairs ( acls ) do if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then return true end end outputChatBox("#FFF000[sERVER]#FFFFFF You aren't an admin.", player, 255,255,255, true) return false end bindKey ( source, u , "down", "chatbox", function ); Link to comment
tosfera Posted August 14, 2014 Share Posted August 14, 2014 'source' is nothing outside a function. Make it bind when players spawn, or when an admin logs in. Also, the 'u' should be a string and your 'function' should be replaced with the name of your function. Link to comment
xeon17 Posted August 14, 2014 Author Share Posted August 14, 2014 It's first time i work with bindkey and this stuff , i don't understand how it work... function Bind ( source ) if not (isAllownedPlayer(source)) then return end bindKey ( source, adminchat , "down", "chatbox", bind ) end addEventHandler("onPlayerLogin", root, Bind) Link to comment
Max+ Posted August 14, 2014 Share Posted August 14, 2014 --serverside , addEventHandler ( 'onPlayerLogin', resourceRoot, function ( player ) if not ( isAllownedPlayer(player)) then return end bindKey ( player, 'u', 'down', 'chatbox', adminchat ) end ) Link to comment
TAPL Posted August 14, 2014 Share Posted August 14, 2014 --serverside , addEventHandler ( 'onPlayerLogin', resourceRoot, function ( player ) if not ( isAllownedPlayer(player)) then return end bindKey ( player, 'u', 'down', 'chatbox', adminchat ) end ) Never try to help anyone when you don't even know the basics. Link to comment
xeon17 Posted August 30, 2014 Author Share Posted August 30, 2014 I tried this but dosen't work addEventHandler ( 'onPlayerJoin', root, function () bindKey ( source, 'u', 'down', 'chatbox', adminchat ) end) bug: [2014-08-30 17:03:26] WARNING: (GW)Admin-Chat\admin-chat.lua:38: Bad argument @ 'bindKey' [Expected string at argument 5, got function] Link to comment
Anubhav Posted August 30, 2014 Share Posted August 30, 2014 addEventHandler ( 'onPlayerJoin', root, function () bindKey ( source, 'u', 'down', adminchat ) end) Link to comment
xeon17 Posted August 30, 2014 Author Share Posted August 30, 2014 Now when i press ''U'' it's output ''down'' in chat , no work as chatbox. Link to comment
xeon17 Posted August 30, 2014 Author Share Posted August 30, 2014 Ah the problem was the argument 5° was name of function , should be name of command. Problem solved. 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