Tokio Posted July 5, 2017 Share Posted July 5, 2017 function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") groupName = names["group"] end end end end outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) Sometimes working the "asay xy" cmd, sometimes not working. How to fix this bug? Link to comment
keymetaphore Posted July 5, 2017 Share Posted July 5, 2017 Where is the table 'names' specified? Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 Just now, Gourmet. said: Where is the table 'names' specified? local names = { ["Admin"] = "Tulajdonos", ["LathatatlanAdmin"] = "Tulajdonos", ["FoAdmin"] = "FőAdmin", ["LFoAdmin"] = "FőAdmin", ["Adminseged"] = "AdminSegéd", ["LathatatlanAdminseged"] = "AdminSegéd", ["KisAdmin"] = "Admin", ["Fejleszto"] = "Fejlesztő", ["Moderator"] = "Moderátor", ["LathatatlanModi"] = "Moderátor" } Link to comment
keymetaphore Posted July 5, 2017 Share Posted July 5, 2017 Forgot to mention, are there any errors in /debugscript 3? Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 Just now, Gourmet. said: Forgot to mention, are there any errors in /debugscript 3? I do not see anything in debugscript 3 Link to comment
keymetaphore Posted July 5, 2017 Share Posted July 5, 2017 local names = { ["Admin"] = "Tulajdonos", ["LathatatlanAdmin"] = "Tulajdonos", ["FoAdmin"] = "FőAdmin", ["LFoAdmin"] = "FőAdmin", ["Adminseged"] = "AdminSegéd", ["LathatatlanAdminseged"] = "AdminSegéd", ["KisAdmin"] = "Admin", ["Fejleszto"] = "Fejlesztő", ["Moderator"] = "Moderátor", ["LathatatlanModi"] = "Moderátor" } function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") groupName = names["group"] outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end end end end end addCommandHandler("asay", adminuzi) @50cent Not tested though. Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 4 minutes ago, Gourmet. said: local names = { ["Admin"] = "Tulajdonos", ["LathatatlanAdmin"] = "Tulajdonos", ["FoAdmin"] = "FőAdmin", ["LFoAdmin"] = "FőAdmin", ["Adminseged"] = "AdminSegéd", ["LathatatlanAdminseged"] = "AdminSegéd", ["KisAdmin"] = "Admin", ["Fejleszto"] = "Fejlesztő", ["Moderator"] = "Moderátor", ["LathatatlanModi"] = "Moderátor" } function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") groupName = names["group"] outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end end end end end addCommandHandler("asay", adminuzi) @50cent Not tested though. Now when i type for example "/asay asd" output often instead of once sorry for my bad english :c Link to comment
keymetaphore Posted July 5, 2017 Share Posted July 5, 2017 local names = { ["Admin"] = "Tulajdonos", ["LathatatlanAdmin"] = "Tulajdonos", ["FoAdmin"] = "FőAdmin", ["LFoAdmin"] = "FőAdmin", ["Adminseged"] = "AdminSegéd", ["LathatatlanAdminseged"] = "AdminSegéd", ["KisAdmin"] = "Admin", ["Fejleszto"] = "Fejlesztő", ["Moderator"] = "Moderátor", ["LathatatlanModi"] = "Moderátor" } function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") groupName = names["group"] outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,v,0,0,0,true) end end end end end addCommandHandler("asay", adminuzi) Should work. 1 Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 4 minutes ago, Gourmet. said: local names = { ["Admin"] = "Tulajdonos", ["LathatatlanAdmin"] = "Tulajdonos", ["FoAdmin"] = "FőAdmin", ["LFoAdmin"] = "FőAdmin", ["Adminseged"] = "AdminSegéd", ["LathatatlanAdminseged"] = "AdminSegéd", ["KisAdmin"] = "Admin", ["Fejleszto"] = "Fejlesztő", ["Moderator"] = "Moderátor", ["LathatatlanModi"] = "Moderátor" } function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") groupName = names["group"] outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,v,0,0,0,true) end end end end end addCommandHandler("asay", adminuzi) Should work. Thank you! Link to comment
koragg Posted July 5, 2017 Share Posted July 5, 2017 @Gourmet. what did you edit in his first posted script? I didn't see any problems, share please Link to comment
keymetaphore Posted July 5, 2017 Share Posted July 5, 2017 Just now, koragg said: @Gourmet. what did you edit in his first posted script? I didn't see any problems, share please I'm pretty sure that I just changed the position of outputChatBox() and set it not to output to root but v - the player in that loop. This is not the most effective solution, but it works. 1 Link to comment
Tokio Posted July 6, 2017 Author Share Posted July 6, 2017 13 hours ago, Gourmet. said: local names = { ["Admin"] = "Tulajdonos", ["LathatatlanAdmin"] = "Tulajdonos", ["FoAdmin"] = "FőAdmin", ["LFoAdmin"] = "FőAdmin", ["Adminseged"] = "AdminSegéd", ["LathatatlanAdminseged"] = "AdminSegéd", ["KisAdmin"] = "Admin", ["Fejleszto"] = "Fejlesztő", ["Moderator"] = "Moderátor", ["LathatatlanModi"] = "Moderátor" } function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") groupName = names["group"] outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,v,0,0,0,true) end end end end end addCommandHandler("asay", adminuzi) Should work. Wait, lol! Yesterday was still good, but today it does not work at all the cmd. Wtf? Link to comment
keymetaphore Posted July 6, 2017 Share Posted July 6, 2017 2 minutes ago, 50cent said: Wait, lol! Yesterday was still good, but today it does not work at all the cmd. Wtf? Man, are you sure that no one has access to your FTP and do you trust all admins? It can't just stop working. Have you edited anything? Please post the current code, meta.xml and server log where the resource could been restarted or interfered with. Maybe you have changed ACL? Link to comment
Tokio Posted July 6, 2017 Author Share Posted July 6, 2017 1 minute ago, Gourmet. said: Man, are you sure that no one has access to your FTP and do you trust all admins? It can't just stop working. Have you edited anything? Please post the current code, meta.xml and server log where the resource could been restarted or interfered with. Maybe you have changed ACL? i sure that no one has access to my FTP! i just edited the output nothing else. function getFixedName(player) if isElement(player) then local hisName = getPlayerName(player) if hisName then result = string.gsub(hisName, '#%x%x%x%x%x%x', '') if result then return result end end end end local names = { ["Admin"] = "Tulajdonos", ["LathatatlanAdmin"] = "Tulajdonos", ["FoAdmin"] = "FőAdmin", ["LFoAdmin"] = "FőAdmin", ["Adminseged"] = "AdminSegéd", ["LathatatlanAdminseged"] = "AdminSegéd", ["KisAdmin"] = "Admin", ["Fejleszto"] = "Fejlesztő", ["Moderator"] = "Moderátor", ["LathatatlanModi"] = "Moderátor" } function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then message = table.concat({...}, " ") groupName = names[group] outputChatBox("#0088FF[SUPERFUN-Rangos]#d8001f "..groupName.." "..getFixedName(thePlayer)..": "..message,v,0,0,0,true) end end end end end addCommandHandler("asay", adminuzi) this is the current code, <meta> <script src="asay.lua" type="server"/> </meta> and this is meta i does not change anything in ACL Link to comment
keymetaphore Posted July 6, 2017 Share Posted July 6, 2017 (edited) Is the resource running? Anything in /debugscript 3? Make sure that you are LOGGED IN Edited July 6, 2017 by Gourmet. Link to comment
Tokio Posted July 6, 2017 Author Share Posted July 6, 2017 21 minutes ago, Gourmet. said: Is the resource running? Anything in /debugscript 3? Make sure that you are LOGGED IN The resource running, and I do not see anything in debugscript 3 Yeah, i logged in Link to comment
keymetaphore Posted July 6, 2017 Share Posted July 6, 2017 (edited) function adminuzi(thePlayer, commandName, ...) outputDebugString("function is working P1") for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then outputDebugString("P2") if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then outputDebugString("P3 - acl valid") message = table.concat({...}, " ") groupName = names[group] outputChatBox("#0088FF[SUPERFUN-Rangos]#d8001f "..groupName.." "..getFixedName(thePlayer)..": "..message,v,0,0,0,true) end end end end end addCommandHandler("asay", adminuzi) Try that and tell me what outputs in your /debugscript 3. Maybe something shows up when the resource starts? at debugscript 3 ) Edited July 6, 2017 by Gourmet. Link to comment
Tokio Posted July 6, 2017 Author Share Posted July 6, 2017 29 minutes ago, Gourmet. said: function adminuzi(thePlayer, commandName, ...) outputDebugString("function is working P1") for i,v in pairs(getElementsByType( "player" )) do for group, serverGroupName in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if group then outputDebugString("P2") if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group )) then outputDebugString("P3 - acl valid") message = table.concat({...}, " ") groupName = names[group] outputChatBox("#0088FF[SUPERFUN-Rangos]#d8001f "..groupName.." "..getFixedName(thePlayer)..": "..message,v,0,0,0,true) end end end end end addCommandHandler("asay", adminuzi) Try that and tell me what outputs in your /debugscript 3. Maybe something shows up when the resource starts? at debugscript 3 ) output this in debugscript 3: http://imgur.com/a/WTD1D but the word does not output in chatbox ._. No, nothing shows up when i start the script Link to comment
keymetaphore Posted July 6, 2017 Share Posted July 6, 2017 4 minutes ago, 50cent said: output this in debugscript 3: http://imgur.com/a/WTD1D but the word does not output in chatbox ._. No, nothing shows up when i start the script That is probably caused due to that function getFixedName. See what happens if you remove it. Link to comment
Tokio Posted July 6, 2017 Author Share Posted July 6, 2017 2 minutes ago, Gourmet. said: That is probably caused due to that function getFixedName. See what happens if you remove it. Lol, the script now working again Link to comment
Tokio Posted July 6, 2017 Author Share Posted July 6, 2017 1 hour ago, Gourmet. said: That is probably caused due to that function getFixedName. See what happens if you remove it. when i reconnect, the script does not work again, wtf? Link to comment
keymetaphore Posted July 6, 2017 Share Posted July 6, 2017 You gotta log in, I guess. Link to comment
Tokio Posted July 6, 2017 Author Share Posted July 6, 2017 5 minutes ago, Gourmet. said: You gotta log in, I guess. when i connect to the server, i login immediately, because i have a login panel Link to comment
pa3ck Posted July 6, 2017 Share Posted July 6, 2017 (edited) Try with simple words like "hello", maybe you go over the character limit of outputChatBox Edit: What is the purpose of this script? You do /asay and every single player sees the message, right? If so change this outputChatBox("#0088FF[SUPERFUN-Rangos]#d8001f "..groupName.." "..getFixedName(thePlayer)..": "..message,v,0,0,0,true) To this: outputChatBox("#0088FF[SUPERFUN-Rangos]#d8001f "..groupName.." "..getFixedName(thePlayer)..": "..message,root,0,0,0,true) And you don't need the for loop with players anyway.. Edited July 6, 2017 by pa3ck Link to comment
Tokio Posted July 6, 2017 Author Share Posted July 6, 2017 (edited) 34 minutes ago, pa3ck said: Try with simple words like "hello", maybe you go over the character limit of outputChatBox Edit: What is the purpose of this script? You do /asay and every single player sees the message, right? If so change this outputChatBox("#0088FF[SUPERFUN-Rangos]#d8001f "..groupName.." "..getFixedName(thePlayer)..": "..message,v,0,0,0,true) To this: outputChatBox("#0088FF[SUPERFUN-Rangos]#d8001f "..groupName.." "..getFixedName(thePlayer)..": "..message,root,0,0,0,true) And you don't need the for loop with players anyway.. Yeah, but with 'root' flood again the message Edited July 6, 2017 by 50cent 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