Behnam Posted July 30, 2018 Share Posted July 30, 2018 Hi all. please give me a script for message from admin to player ! for acl on group ! Command: /pm <playername> <text> outputchatbox for players: Admin <admin name>: TexTTTTT and outputchatbox for other player for use command: permission denied! thanks. Link to comment
Behnam Posted July 30, 2018 Author Share Posted July 30, 2018 @#َxLysandeRPlease help me ! @N3xT Please help me ! Link to comment
SycroX Posted July 30, 2018 Share Posted July 30, 2018 (edited) function findPlayer(player) if player and type(player) == "string" then local element = getPlayerFromName(player) if element then return element end local player = string.lower(player) local spl = split(player, string.byte("[")) if spl then player = table.concat(spl, ";") end for k, v in pairs(getElementsByType("player")) do local name = string.lower(getPlayerName(v)) local spl = split(name, string.byte("[")) if spl then name = table.concat(spl, ";") end if string.find(name, player) then element = v break end end if isElement(element) then return element end return false else return false end end addCommandHandler("pm", function(player,_,op,...) local args = {...} if op and args then local account = getPlayerAccount(player) if account and not isGuestAccount(account) then if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("yourGroupName")) then local otherPlayer = findPlayer(op) if otherPlayer then local text = table.concat(args, " ") outputChatBox("Admin <"..getPlayerName(player).."> : "..text, 255, 255, 255, true) end end end end end ) Edited July 30, 2018 by #َxLysandeR Link to comment
Behnam Posted July 30, 2018 Author Share Posted July 30, 2018 @N3xT Please help me ! 1 hour ago, #َxLysandeR said: function findPlayer(player) if player and type(player) == "string" then local element = getPlayerFromName(player) if element then return element end local player = string.lower(player) local spl = split(player, string.byte("[")) if spl then player = table.concat(spl, ";") end for k, v in pairs(getElementsByType("player")) do local name = string.lower(getPlayerName(v)) local spl = split(name, string.byte("[")) if spl then name = table.concat(spl, ";") end if string.find(name, player) then element = v break end end if isElement(element) then return element end return false else return false end end addCommandHandler("pm", function(player,_,op,...) local args = {...} if op and args then local account = getPlayerAccount(player) if account and not isGuestAccount(account) then if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("yourGroupName")) then local otherPlayer = findPlayer(op) if otherPlayer then local text = table.concat(args, " ") outputChatBox("Admin <"..getPlayerName(player).."> : "..text, 255, 255, 255, true) end end end end end ) Not work ! Link to comment
SycroX Posted July 30, 2018 Share Posted July 30, 2018 do you change the yourGroupName to the group of acl that you want ? function findPlayer(player) if player and type(player) == "string" then local element = getPlayerFromName(player) if element then return element end local player = string.lower(player) local spl = split(player, string.byte("[")) if spl then player = table.concat(spl, ";") end for k, v in pairs(getElementsByType("player")) do local name = string.lower(getPlayerName(v)) local spl = split(name, string.byte("[")) if spl then name = table.concat(spl, ";") end if string.find(name, player) then element = v break end end if isElement(element) then return element end return false else return false end end addCommandHandler("pm", function(player,_,op,...) local args = {...} if op and args then local account = getPlayerAccount(player) if account and not isGuestAccount(account) then if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("yourGroupName")) then local otherPlayer = findPlayer(op) if otherPlayer then local text = table.concat(args, " ") outputChatBox("Admin <"..getPlayerName(player).."> : "..text, otherPlayer, 255, 255, 255, true) end end end end end ) ** sorry try the new code i've forget to add otherPlayer to outputChatBox Link to comment
MTA Anti-Cheat Team Dutchman101 Posted July 31, 2018 MTA Anti-Cheat Team Share Posted July 31, 2018 23 hours ago, Behnam said: Hi all. please give me a script for message from admin to player ! like I posted on your other topic @Behnam; Also locking this topic, you can try again when you think you can post scripting questions in the appropiate fashion. Conduct guidelines - The Scripting section is not meant for those unwilling to learn, whose only intent is to try get others to finish the scripts they need, line by line. Don't lean back and wait for others to finish your script line-by-line, without any efforts of your own, because Scripting section isn't a free scripter service. *Note: any scripters writing something from scratch without the topicstarter's cooperation, are encouraging laziness and leading other beginner scripters to think this is acceptable, or even make it more likely that non-scripters will start posting here because they need something. You're not doing a valuable job by writing their code on demand in this section. 1 Link to comment
Recommended Posts