John_Scott Posted November 30, 2013 Share Posted November 30, 2013 Hi, I made a resource to i can write to the chat as admin. (/asay [message]). When i write the command, for example: /asay one two, the script write to the chat onty "one", so always just the first word. My resource: function sendMsg(playersource, cmd, msg) local accName = getAccountName ( getPlayerAccount ( playersource ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then local msg = tostring(msg) if msg then outputChatBox(msg, getRootElement(), 255, 0, 0) else outputChatBox("Használat: /asay <üzenet>", player) --Usage end else outputChatBox ( "#ffffff[#DF3A01Z-Land DayZ#ffffff]: #FF0000Nincs jogosultságod a parancs használatához!", 255, 255, 255, true ) --No permission end end addCommandHandler ( "asay", sendMsg ) Thanks for help! Link to comment
myonlake Posted November 30, 2013 Share Posted November 30, 2013 (edited) It's because of the fact that 'msg' only receives one value. Therefore you have to make it receive multiple arguments at once by making it an array like so. Server-side addCommandHandler("asay", function(player, cmd, ...) local account = getPlayerAccount(player) local accountName = getAccountName(account) if (not account) or (not accountName) or (account and accountName and not isObjectInACLGroup("user." .. accountName, aclGetGroup("Admin"))) then outputChatBox("#ffffff[#DF3A01Z-Land DayZ#ffffff]: #FF0000Nincs jogosultságod a parancs használatához!", player, 245, 20, 20, true) return end local message = table.concat({...}, " ") if (message) and (#message > 0) then outputChatBox(message, root, 255, 0, 0, false) else outputChatBox("Használat: /asay <üzenet>", player, 245, 20, 20, false) end end ) Edited November 30, 2013 by Guest Link to comment
John_Scott Posted November 30, 2013 Author Share Posted November 30, 2013 Not working I enter "/asay test message" and nothing. Link to comment
myonlake Posted November 30, 2013 Share Posted November 30, 2013 Works like a charm here. Make sure you've logged in and you're within the "Admin" ACL group. Link to comment
John_Scott Posted November 30, 2013 Author Share Posted November 30, 2013 Works like a charm here. Make sure you've logged in and you're within the "Admin" ACL group. Yes, i'm in ADMIN account and not working Link to comment
myonlake Posted November 30, 2013 Share Posted November 30, 2013 That's quite weird because I am logged in within the Admin ACL group and it works just fine. Re-copy the code and try again. http://puu.sh/5xBOh.png Link to comment
John_Scott Posted November 30, 2013 Author Share Posted November 30, 2013 (edited) That's quite weird because I am logged in within the Admin ACL group and it works just fine. Re-copy the code and try again. http://puu.sh/5xBOh.png Okay, now working, thanks! Edited November 30, 2013 by Guest Link to comment
myonlake Posted November 30, 2013 Share Posted November 30, 2013 If it's doing nothing, then you've never started the resource or you have the wrong script in there. Have you re-copied and pasted the code? 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