Tokio Posted July 4, 2017 Share Posted July 4, 2017 local titles = { "AdminSegéd", "Moderátor", "SzuperModerátor", "Admin", "FőAdmin", "Tulajdonos", "Fejlesztő" } function getPlayerAdminTitle() local text = titles if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then text = "Tulajdonos" elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("FoAdmin")) then text = "FőAdmin" elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Adminseged")) then text = "AdminSegéd" elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("KisAdmin")) then text = "Admin" elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Fejleszto")) then text = "Fejlesztő" elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then text = "Moderátor" end end 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 function adminuzi(thePlayer, commandName, ...) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) or isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("FoAdmin")) or isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Adminseged")) or isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("KisAdmin")) or isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Fejleszto")) or isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Moderator")) then if not (...) then outputChatBox("#00FF7F[Használat]:#FFFFFF /".. commandName .." [üzenet]", thePlayer, 0, 206, 209,true) else local adminrang = getPlayerAdminTitle(thePlayer) message = table.concat({...}, " ") local playerName = getFixedName ( thePlayer ) outputChatBox("#0088FF[SUPERFUN-Admin]#d8001f "..playerName..": "..message,getRootElement(),0,0,0,true) end end end addCommandHandler("asay", adminuzi, false, false) i have this script, and i get this warnings/error: How to fix this? Link to comment
itHyperoX Posted July 4, 2017 Share Posted July 4, 2017 I highly recommend you to use setElementData, getElementData for administrator system! If you want, you can use feel free , and if you need more help you can PM me! --< Belépéskor >-- addEventHandler("onPlayerLogin", getRootElement(),function(_, account) tonumber(setElementData(source, "acc.admin", tonumber(getAccountData(account, "acc.admin"))) or 0) end) --< Mentés >-- addEventHandler('onPlayerQuit',root,function( account ) local account = eventName == 'onPlayerLogout' and account or getPlayerAccount(source) if (account) and (not isGuestAccount(account)) then setAccountData(account,'acc.admin',getElementData(source,'acc.admin') or 0) end end) Link to comment
Tokio Posted July 4, 2017 Author Share Posted July 4, 2017 8 minutes ago, TheMOG said: I highly recommend you to use setElementData, getElementData for administrator system! If you want, you can use feel free , and if you need more help you can PM me! --< Belépéskor >-- addEventHandler("onPlayerLogin", getRootElement(),function(_, account) tonumber(setElementData(source, "acc.admin", tonumber(getAccountData(account, "acc.admin"))) or 0) end) --< Mentés >-- addEventHandler('onPlayerQuit',root,function( account ) local account = eventName == 'onPlayerLogout' and account or getPlayerAccount(source) if (account) and (not isGuestAccount(account)) then setAccountData(account,'acc.admin',getElementData(source,'acc.admin') or 0) end end) i just want, when i type "/asay xy" output in chatbox the player's rank and for example instead of admin show "Tulajdonos" sorry for my very bad english Link to comment
kikos500 Posted July 5, 2017 Share Posted July 5, 2017 (edited) local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "Moderátor" } local players = {} function adminuzi(thePlayer, commandName, ...) for i,v in pairs(aclGroupList()) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer), v) then if aclGroupGetName(v) == "Everyone" then return end players[thePlayer] = aclGroupGetName(v) end end local message = table.concat({...}, " ") outputChatBox("#0088FF["..players[thePlayer].."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) Edited July 5, 2017 by kikos500 1 Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 (edited) Thank you:D 3 hours ago, kikos500 said: local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "Moderátor" } local players = {} function adminuzi(thePlayer, commandName, ...) for i,v in pairs(aclGroupList()) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer), v) then if aclGroupGetName(v) == "Everyone" then return end players[thePlayer] = aclGroupGetName(v) end end local message = table.concat({...}, " ") outputChatBox("#0088FF["..players[thePlayer].."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) i got new warnings/error: how to fix? Edited July 5, 2017 by 50cent fixed the problem Link to comment
Gordon_G Posted July 5, 2017 Share Posted July 5, 2017 (edited) local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "Moderátor" } local players = {} function adminuzi(thePlayer, commandName, ...) for i,v in pairs(aclGroupList()) do if isGuestAccount( getPlayerAccount( v ) ) then return end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer), aclGetGroup( v )) then players[thePlayer] = aclGroupGetName(v) end end local message = table.concat({...}, " ") outputChatBox("#0088FF["..players[thePlayer].."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) Edited July 5, 2017 by Gordon_G Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 4 minutes ago, Gordon_G said: local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "Moderátor"}local players = {}function adminuzi(thePlayer, commandName, ...) for i,v in pairs(aclGroupList()) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer), aclGetGroup( v )) then players[thePlayer] = aclGroupGetName(v) end end local message = table.concat({...}, " ") outputChatBox("#0088FF["..players[thePlayer].."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true)endaddCommandHandler("asay", adminuzi) same problem Link to comment
Gordon_G Posted July 5, 2017 Share Posted July 5, 2017 (edited) local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "Moderátor" } function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, _ in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer), aclGetGroup( group )) then local message = table.concat({...}, " ") outputChatBox("#0088FF["..group.."]#d8001f "..getPlayerName(v)..": "..message,getRootElement(),0,0,0,true) end end end end addCommandHandler("asay", adminuzi) Edited July 5, 2017 by Gordon_G Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 5 minutes ago, Gordon_G said: local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "Moderátor" } local players = {} function adminuzi(thePlayer, commandName, ...) for i,v in pairs(names) do if isGuestAccount( getPlayerAccount( v ) ) then return end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer), aclGetGroup( v )) then players[thePlayer] = aclGroupGetName(v) end end local message = table.concat({...}, " ") outputChatBox("#0088FF["..players[thePlayer].."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 5 minutes ago, Gordon_G said: I've juste done an edit. now i got only this warning Link to comment
Gordon_G Posted July 5, 2017 Share Posted July 5, 2017 local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "Moderátor" } function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, _ in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then local message = table.concat({...}, " ") outputChatBox("#0088FF["..group.."]#d8001f "..getPlayerName(v)..": "..message,getRootElement(),0,0,0,true) end end end end addCommandHandler("asay", adminuzi) It should work now. 1 Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 2 minutes ago, Gordon_G said: local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "Moderátor" } function adminuzi(thePlayer, commandName, ...) for i,v in pairs(getElementsByType( "player" )) do for group, _ in pairs( names ) do if isGuestAccount( getPlayerAccount( v ) ) then return end if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then local message = table.concat({...}, " ") outputChatBox("#0088FF["..group.."]#d8001f "..getPlayerName(v)..": "..message,getRootElement(),0,0,0,true) end end end end addCommandHandler("asay", adminuzi) It should work now. working, but does not show "Tulajdonos" instead of admin Link to comment
Gordon_G Posted July 5, 2017 Share Posted July 5, 2017 Oh, okey, i'll change that. local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "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 isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then local message = table.concat({...}, " ") outputChatBox("#0088FF["..serverGroupName.."]#d8001f "..getPlayerName(v)..": "..message,getRootElement(),0,0,0,true) end end end end addCommandHandler("asay", adminuzi) 1 Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 1 minute ago, Gordon_G said: Oh, okey, i'll change that. local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "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 isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then local message = table.concat({...}, " ") outputChatBox("#0088FF["..serverGroupName.."]#d8001f "..getPlayerName(v)..": "..message,getRootElement(),0,0,0,true) end end end end addCommandHandler("asay", adminuzi) Thank you!! Link to comment
Gordon_G Posted July 5, 2017 Share Posted July 5, 2017 (edited) You're welcome. Edited July 5, 2017 by Gordon_G 1 Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 9 minutes ago, Gordon_G said: You're welcome. Lol, i put this script in my server, and write in the name of everyone, how to fix this? Just i have admin rank Link to comment
itHyperoX Posted July 5, 2017 Share Posted July 5, 2017 (edited) "..getPlayerName(v).." change to "..getPlayerName(thePlayer).." Edited July 5, 2017 by TheMOG Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 7 minutes ago, TheMOG said: "..getPlayerName(v).." change to "..getPlayerName(thePlayer).." i changed, but now just with my name flood the chat And i only once type this: "/asay a" Link to comment
koragg Posted July 5, 2017 Share Posted July 5, 2017 (edited) local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "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 isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") groupName = names["group"] end end end outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) Edited July 5, 2017 by koragg not sure about the groupName = names["group"] part Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 7 minutes ago, koragg said: local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "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 isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup( group ) then message = table.concat({...}, " ") end end end outputChatBox("#0088FF["..serverGroupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) Link to comment
koragg Posted July 5, 2017 Share Posted July 5, 2017 (edited) local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "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"] end end end end outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) If this^ doesn't work try making it: groupName = names[group] or groupName = names["'"..group.."'"] Edited July 5, 2017 by koragg 1 Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 9 minutes ago, koragg said: local names = { ["Admin"] = "Tulajdonos", ["Moderator"] = "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"] end end end end outputChatBox("#0088FF["..groupName.."]#d8001f "..getPlayerName(thePlayer)..": "..message,getRootElement(),0,0,0,true) end addCommandHandler("asay", adminuzi) If this^ doens't work try making it: groupName = names[group] or groupName = names["'"group"'"] Thank you, now work fine! Link to comment
Tokio Posted July 5, 2017 Author Share Posted July 5, 2017 2 hours ago, koragg said: You're welcome Lol, now i have a new problem. The script working, but sometimes the /asay xy command does not working, wtf?! When i restart the resource many times then working again, but just for a few minutes, and does not working again. Wtf, how to fix this problem? 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