Ryan2233 Posted June 1, 2018 Share Posted June 1, 2018 Hi. The script I'm trying to make is a player who needs help does /adminreq and he gets a message saying admin is coming and admins, supermoderators and moderators get a message saying they are needed by the person who requested. Current code: function requestAdmin(playerName) exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local account = getPlayerAccount (thePlayer) if isObjectInACLGroup ("user." .. getAccountName(string(account)), aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then outputChatBox("You are required by ".. getPlayerFromName(playerName .. playerName) end end addCommandHandler("adminreq", requestAdmin) But when /adminreq is typed the first message shows but admins dont get the message. Why? (i'm new to lua) Link to comment
WiBox Posted June 1, 2018 Share Posted June 1, 2018 (edited) 6 minutes ago, Ryan2233 said: Hi. The script I'm trying to make is a player who needs help does /adminreq and he gets a message saying admin is coming and admins, supermoderators and moderators get a message saying they are needed by the person who requested. Current code: function requestAdmin(playerName) exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local account = getPlayerAccount (playerName) -- thePlayer ? you need to use playerName as in function (playerName) if isObjectInACLGroup ("user." .. getAccountName(string(account)), aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then outputChatBox("You are required by ".. getPlayerFromName(playerName .. playerName) end end addCommandHandler("adminreq", requestAdmin) But when /adminreq is typed the first message shows but admins dont get the message. Why? (i'm new to lua) Try it now, of using playerName at line 4 you used thePlayer Edited June 1, 2018 by SSKE Link to comment
Ryan2233 Posted June 1, 2018 Author Share Posted June 1, 2018 1 minute ago, SSKE said: ? Link to comment
WiBox Posted June 1, 2018 Share Posted June 1, 2018 (edited) function requestAdmin(playerName) exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local account = getPlayerAccount (thePlayer) if isObjectInACLGroup ("user." .. getAccountName(string(account)), aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then outputChatBox("You are required by ".. getPlayerFromName(playerName .. playerName) end end addCommandHandler("adminreq", requestAdmin) Mate the function requestAdmin(playerName) at local account = getPlayerAccount (thePlayer) you used thePlayer you should use playerName You can see it now ? Try it now, I think that was the only problem.. Edited June 1, 2018 by SSKE Link to comment
Ryan2233 Posted June 1, 2018 Author Share Posted June 1, 2018 3 minutes ago, SSKE said: function requestAdmin(playerName) exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local account = getPlayerAccount (thePlayer) if isObjectInACLGroup ("user." .. getAccountName(string(account)), aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then outputChatBox("You are required by ".. getPlayerFromName(playerName .. playerName) end end addCommandHandler("adminreq", requestAdmin) Mate the function requestAdmin(playerName) at local account = getPlayerAccount (thePlayer) you used thePlayer you should use playerName You can see it now ? No. Bad argument @ 'getPlayerAccount' [Expected Element at argument 1, got nil] Link to comment
WiBox Posted June 1, 2018 Share Posted June 1, 2018 (edited) You change thePlayer to playerName ? local account = getPlayerAccount (thePlayer) -- see this? make it --make it like that: local account = getPlayerAccount (playerName) and if change thePlayer to playerName didn't work then try this: function requestAdmin(playerName) exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local account = getPlayerAccount (playerName) if isObjectInACLGroup ("user." .. getAccountName(string(account)), aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then outputChatBox("You are required by ".. getPlayerFromName(playerName .. playerName) end end addCommandHandler("adminreq", requestAdmin) -- use the first which is above(up) this message if it didn't work then try which is below(down) this message function requestAdmin() for _,playerName in ipairs ( getElementsByType("player") ) do exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local account = getPlayerAccount (playerName) if isObjectInACLGroup ("user." .. getAccountName(string(account)), aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then outputChatBox("You are required by ".. getPlayerFromName(playerName .. playerName) end end end addCommandHandler("adminreq", requestAdmin) Try the first one if it didn't work. then try the second one, but the first one should work if it didn't then try the second one~ Edited June 1, 2018 by SSKE Link to comment
Ryan2233 Posted June 1, 2018 Author Share Posted June 1, 2018 13 minutes ago, SSKE said: You change thePlayer to playerName ? local account = getPlayerAccount (thePlayer) -- see this? make it --make it like that: local account = getPlayerAccount (playerName) Yes Link to comment
WiBox Posted June 1, 2018 Share Posted June 1, 2018 function requestAdmin() for _,playerName in ipairs ( getElementsByType("player") ) do exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local account = getPlayerAccount (playerName) if isObjectInACLGroup ("user." .. getAccountName(string(account)), aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then outputChatBox("You are required by ".. getPlayerFromName(playerName .. playerName) end end end addCommandHandler("adminreq", requestAdmin) - try this Link to comment
Ryan2233 Posted June 1, 2018 Author Share Posted June 1, 2018 2 minutes ago, SSKE said: function requestAdmin() for _,playerName in ipairs ( getElementsByType("player") ) do exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local account = getPlayerAccount (playerName) if isObjectInACLGroup ("user." .. getAccountName(string(account)), aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then outputChatBox("You are required by ".. getPlayerFromName(playerName .. playerName) end end end addCommandHandler("adminreq", requestAdmin) - try this There's no errors or anything but it doesn't show still Link to comment
WiBox Posted June 1, 2018 Share Posted June 1, 2018 (edited) function requestAdmin(playerName) exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local account = getAccountName ( getPlayerAccount ( playerName ) ) if isObjectInACLGroup ("user.".. account, aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then outputChatBox("You are required by ".. getPlayerFromName(playerName .. playerName) end end addCommandHandler("adminreq", requestAdmin) try this now or wait before use this one write in console": debugscript 3 it will show all errors Edited June 1, 2018 by SSKE Link to comment
Ryan2233 Posted June 1, 2018 Author Share Posted June 1, 2018 The "Your request for a staff member has been accepted. One of our staff members will be with you soon" shows but the one that appears for the admins didn't Link to comment
WiBox Posted June 1, 2018 Share Posted June 1, 2018 (edited) function requestAdmin(playerName) exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local x, y, z = getElementPosition (playerName) local account = getAccountName ( getPlayerAccount ( playerName ) ) if isObjectInACLGroup ("user.".. account, aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then setElementPosition( playerName, x, y, z ) end end addCommandHandler("adminreq", requestAdmin) Try this it should warp the Staff to the player which used the command, idk if it will work didn't test it Edited June 1, 2018 by SSKE Link to comment
Ryan2233 Posted June 1, 2018 Author Share Posted June 1, 2018 2 minutes ago, SSKE said: function requestAdmin(playerName) exports.SANGcommands:sendMessage("Your request for a staff member has been accepted. One of our staff members will be with you soon", 225,255,255) local x, y, z = getElementPosition (playerName) local account = getAccountName ( getPlayerAccount ( playerName ) ) if isObjectInACLGroup ("user.".. account, aclGetGroup ("Admin", "SuperModerator", "Moderator")) and type == 0 then setElementPosition( playerName, x, y, z ) end end addCommandHandler("adminreq", requestAdmin) Still no Link to comment
WiBox Posted June 1, 2018 Share Posted June 1, 2018 (edited) function requestAdmin(playerName) outputChatBox("Your request for a staff member has been accepted. One of our staff members will be with you soon.",playerName, 225,255,255) local account = getAccountName ( getPlayerAccount ( playerName ) ) local Staff = isObjectInACLGroup ("user.".. account, aclGetGroup ("Admin")) if (Staff) then outputChatBox("You been requested by "..getPlayerName(playerName),playerName, 255, 255, 255) end end addCommandHandler("adminreq", requestAdmin) Here you go ~ i test it Edited June 1, 2018 by SSKE Link to comment
itHyperoX Posted June 1, 2018 Share Posted June 1, 2018 (edited) addCommandHandler("help", function(source, commad) messageToAdmins("Player "..getPlayerName(source).." need a administrator now.") outputChatBox("Your request sent to the admins.", source) end) function messageToAdmins(message) for k, v in ipairs(getElementsByType("player")) do if isPlayerInACL(v, "Admin") or isPlayerInACL(v, "Moderator") or isPlayerInACL(v, "SuperModerator") then outputChatBox(message, v, 255, 255, 255, true) end end end function isPlayerInACL(player, acl) local accountName = getAccountName( getPlayerAccount(player) ) if accountName ~= "guest" and type( aclGetGroup(acl) ) == "userdata" then return isObjectInACLGroup( "user."..accountName, aclGetGroup(acl) ) end return false end Edited June 1, 2018 by TheMOG 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