#LasoPhaser Posted March 29, 2019 Share Posted March 29, 2019 hey guys how to make a cmd for send message to online admins ? and admins can see all reports by /reports on a gui just give me functions or simple code Link to comment
#LasoPhaser Posted March 29, 2019 Author Share Posted March 29, 2019 @JustinMTA @stPatrick @majqq Plz help me guys Link to comment
XaskeL Posted March 29, 2019 Share Posted March 29, 2019 Describe the task more specifically Link to comment
#LasoPhaser Posted March 29, 2019 Author Share Posted March 29, 2019 1 minute ago, XaskeL said: Describe the task more specifically I mean, the players who report are in a gui There is a window in gui that shows all the reports Did you understand me? @XaskeL Link to comment
Scripting Moderators ds1-e Posted March 29, 2019 Scripting Moderators Share Posted March 29, 2019 38 minutes ago, #LasoPhaser said: I mean, the players who report are in a gui There is a window in gui that shows all the reports Did you understand me? @XaskeL It's edited function from some chat script. -- meta.xml <meta> <script src="server.lua" type="server"/> </meta> -- server.lua function reportFunction(thePlayer, _,...) local word = {...} local message = table.concat(word, " ") local players = getElementsByType("player") for i = 1, #players do local account = getPlayerAccount(players[i]) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Moderator")) then outputChatBox("Report from "..getPlayerName(thePlayer)..": "..message, players[i], 255, 255, 255, true) end end end addCommandHandler("reportmessage", reportFunction) Should work, do not forget to implement antiflood thing for this. And about gui, i can't help you with that, i don't like to make it Link to comment
#LasoPhaser Posted March 29, 2019 Author Share Posted March 29, 2019 Just now, majqq said: It's edited function from some chat script. -- meta.xml <meta> <script src="server.lua" type="server"/> </meta> -- server.lua function reportFunction(thePlayer, _,...) local word = {...} local message = table.concat(word, " ") local players = getElementsByType("player") for i = 1, #players do local account = getPlayerAccount(players[i]) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Moderator")) then outputChatBox("Report from "..getPlayerName(thePlayer)..": "..message, players[i], 255, 255, 255, true) end end end addCommandHandler("reportmessage", reportFunction) Should work, do not forget to implement antiflood thing for this. And about gui, i can't help you with that, i don't like to make it now how to show reports on a gui window ? Link to comment
Scripting Moderators ds1-e Posted March 29, 2019 Scripting Moderators Share Posted March 29, 2019 Just now, #LasoPhaser said: now how to show reports on a gui window ? If script wouldn't be restarted, i would use tables to store them, it's fast + efficient, temporary storage (script keeps data, and after restart it recreates a table) Link to comment
#LasoPhaser Posted March 29, 2019 Author Share Posted March 29, 2019 Just now, majqq said: If script wouldn't be restarted, i would use tables to store them, it's fast + efficient, temporary storage (script keeps data, and after restart it recreates a table) how ? Link to comment
Scripting Moderators ds1-e Posted March 29, 2019 Scripting Moderators Share Posted March 29, 2019 10 minutes ago, #LasoPhaser said: how ? Use loop. An example, of course it can be done better, but you should learn how to use some things. local playerReports = {} function reportFunction(thePlayer, _,...) local word = {...} local message = table.concat(word, " ") local players = getElementsByType("player") for i = 1, #players do local account = getPlayerAccount(players[i]) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Admin")) or isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("Moderator")) then outputChatBox("Report from "..getPlayerName(thePlayer)..": "..message, players[i], 255, 255, 255, true) playerReports[getPlayerName(thePlayer)] = message end end end addCommandHandler("reportmessage", reportFunction) function checkReports() for k, v in pairs(playerReports) do outputChatBox("Player name: "..k..", reports: "..v) end end addCommandHandler("reports", checkReports) I suggest you to read tutorials: 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