Version Posted Friday at 11:34 Share Posted Friday at 11:34 function ACLChat(player,_,...) if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(player)), aclGetGroup ( "Mafia" ) ) then local mensaje= table.concat({...}, " ") local name = getPlayerName(player) local r,g,b = getPlayerNametagColor(player) for i,v in pairs(getElementsByType("player")) do if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(v)), aclGetGroup ( "Mafia" ) ) then outputChatBox("[Clan]: "..name..": "..mensaje,v,r,g,b) end end end end addCommandHandler("aclchat",ACLChat) addEventHandler("onPlayerLogin", getRootElement(), function() if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Mafia" ) ) then bindKey(source, "u", "down", "chatbox", "aclchat") end end ) I need if you can make this work since I can't find a way to make it work I found it right here to the script this in this community I found it I would like that when you price the u in then you can talk and clan appears and so placably you can talk but privately as you would do with the letter t but this by ACL private way if someone helps me solve this I would appreciate it Link to comment
zFelpszada Posted yesterday at 01:26 Share Posted yesterday at 01:26 --// Setting delay value. local DELAY = 1000 --// Store players delay in memory server. local cooldown = {} --// Get player account name. local function getPlayerAccountName(player) local account = getPlayerAccount(player) return getAccountName(account) end --// Verify if player is in ACL group. local function isPlayerHasAcl(player, acl) local group = aclGetGroup(acl) local accountName = getPlayerAccountName(player) return isObjectInACLGroup("user."..accountName, group) end --// Add event handler for player chat clan. addEventHandler("onPlayerChat", root, function(message, type) --// Check if it's a normal message. if type ~= 0 then return false end --// Check if the message is empty. if message == "" or message == " " then return false end --// Protect player from spamming. local now = getTickCount() if cooldown[source] and now - cooldown[source] < DELAY then cancelEvent() return outputChatBox("Please wait a moment before sending another message.", source, 255, 0, 0) end --// Check if the player is in ACL group. local playerName = getPlayerName(source) if not isPlayerHasAcl(source, "Console") then return false end --// Added player to cooldown. cooldown[source] = now --// Send message to all players in ACL group. local players = getElementsByType("player") local r, g, b = getPlayerNametagColor(source) for i = 1, #players do local player = players[i] if isPlayerHasAcl(player, "Console") then outputChatBox("[Clan]: "..playerName..": "..message, player, r, g, b) end end --// Cancel MTA default message. cancelEvent() end) --// Add event handler for player quit and delete memory value. addEventHandler("onPlayerQuit", root, function() if cooldown[source] then cooldown[source] = nil end end) Hey, what's up? I made a simple example of a chat, showing how you can create a clan-specific chat using the 't' key (the default chat key in MTA). Link to comment
Version Posted yesterday at 11:52 Author Share Posted yesterday at 11:52 Hace 10 horas, zFelpszada dijo: --// Setting delay value. local DELAY = 1000 --// Store players delay in memory server. local cooldown = {} --// Get player account name. local function getPlayerAccountName(player) local account = getPlayerAccount(player) return getAccountName(account) end --// Verify if player is in ACL group. local function isPlayerHasAcl(player, acl) local group = aclGetGroup(acl) local accountName = getPlayerAccountName(player) return isObjectInACLGroup("user."..accountName, group) end --// Add event handler for player chat clan. addEventHandler("onPlayerChat", root, function(message, type) --// Check if it's a normal message. if type ~= 0 then return false end --// Check if the message is empty. if message == "" or message == " " then return false end --// Protect player from spamming. local now = getTickCount() if cooldown[source] and now - cooldown[source] < DELAY then cancelEvent() return outputChatBox("Please wait a moment before sending another message.", source, 255, 0, 0) end --// Check if the player is in ACL group. local playerName = getPlayerName(source) if not isPlayerHasAcl(source, "Console") then return false end --// Added player to cooldown. cooldown[source] = now --// Send message to all players in ACL group. local players = getElementsByType("player") local r, g, b = getPlayerNametagColor(source) for i = 1, #players do local player = players[i] if isPlayerHasAcl(player, "Console") then outputChatBox("[Clan]: "..playerName..": "..message, player, r, g, b) end end --// Cancel MTA default message. cancelEvent() end) --// Add event handler for player quit and delete memory value. addEventHandler("onPlayerQuit", root, function() if cooldown[source] then cooldown[source] = nil end end) Oye, ¿qué pasa? Hice un ejemplo simple de un chat, mostrando cómo se puede crear un chat específico del clan usando la tecla 't' (la tecla de chat predeterminada en MTA). good morning onestly it's okay what you've done anyway I don't understand much about these things I only find scripts and see if I can edit it but this one the one I sent mainly is fine but I can't make it work I already tried to create 1 bindKey(source, "u", "down", "chatbox", "aclchat") on the side of the client client but I'm still unsuccessful I've been days without sleeping trying to solve this I would thank you If you could create it for me you don't know I'm trying to find people who accept transfer so I don't know what country you are from but if you are interested since you know how to create script I could pay you the only way transfer but help me with this and if you are interested in what I am telling you here in Argentina we manage with transfer you could pass me your contact is that I am needing simple things for my server totally free It's not very successful but I'm trying to get everything on the right track and thank you very much for being so generous in giving me examples Link to comment
zFelpszada Posted yesterday at 20:16 Share Posted yesterday at 20:16 8 hours ago, Version said: good morning onestly it's okay what you've done anyway I don't understand much about these things I only find scripts and see if I can edit it but this one the one I sent mainly is fine but I can't make it work I already tried to create 1 bindKey(source, "u", "down", "chatbox", "aclchat") on the side of the client client but I'm still unsuccessful I've been days without sleeping trying to solve this I would thank you If you could create it for me you don't know I'm trying to find people who accept transfer so I don't know what country you are from but if you are interested since you know how to create script I could pay you the only way transfer but help me with this and if you are interested in what I am telling you here in Argentina we manage with transfer you could pass me your contact is that I am needing simple things for my server totally free It's not very successful but I'm trying to get everything on the right track and thank you very much for being so generous in giving me examples --// Setting ACL group. local ACL = "Mafia" --// Setting delay value. local DELAY = 1000 --// Store players delay in memory server. local cooldown = {} --// Get player account name. local function getPlayerAccountName(player) local account = getPlayerAccount(player) return getAccountName(account) end --// Verify if player is in ACL group. local function isPlayerHasAcl(player, acl) local group = aclGetGroup(acl) local accountName = getPlayerAccountName(player) return isObjectInACLGroup("user."..accountName, group) end --// Clan chat. local function clan(player, _, ...) --// Protect player from spamming. local now = getTickCount() if cooldown[player] and now - cooldown[player] < DELAY then cancelEvent() return outputChatBox("Please wait a moment before sending another message.", player, 255, 0, 0) end --// Set player delay. cooldown[player] = now --// Verify if player is in ACL group. if not isPlayerHasAcl(player, ACL) then return false end --// Concatenate message. local message = table.concat({...}, " ") if not message or message == "" then return false end --// Show message to all players in the same ACL group. local name = getPlayerName(player) local players = getElementsByType("player") local r, g, b = getPlayerNametagColor(player) for i = 1, #players do local target = players[i] if isPlayerHasAcl(target, ACL) then outputChatBox("[Clan]: "..name..": "..message, target, r, g, b) end end return true end addCommandHandler("clan", clan) --// Bind key to player on resource start. addEventHandler("onResourceStart", resourceRoot, function() local players = getElementsByType("player") for i = 1, #players do local player = players[i] bindKey(player, "u", "down", "chatbox", "clan") end end) --// Bind key to player on player login. addEventHandler("onPlayerLogin", root, function() bindKey(source, "u", "down", "chatbox", "clan") end) Hey, what's up? Honestly, I don't see any reason to implement this on the client-side. The best option is to do it on the server-side, ensuring server security against cheaters, better synchronization for all players, and other benefits. I made some improvements to your initial code. Link to comment
Version Posted 19 hours ago Author Share Posted 19 hours ago 4 hours ago, zFelpszada said: --// Setting ACL group. local ACL = "Mafia" --// Setting delay value. local DELAY = 1000 --// Store players delay in memory server. local cooldown = {} --// Get player account name. local function getPlayerAccountName(player) local account = getPlayerAccount(player) return getAccountName(account) end --// Verify if player is in ACL group. local function isPlayerHasAcl(player, acl) local group = aclGetGroup(acl) local accountName = getPlayerAccountName(player) return isObjectInACLGroup("user."..accountName, group) end --// Clan chat. local function clan(player, _, ...) --// Protect player from spamming. local now = getTickCount() if cooldown[player] and now - cooldown[player] < DELAY then cancelEvent() return outputChatBox("Please wait a moment before sending another message.", player, 255, 0, 0) end --// Set player delay. cooldown[player] = now --// Verify if player is in ACL group. if not isPlayerHasAcl(player, ACL) then return false end --// Concatenate message. local message = table.concat({...}, " ") if not message or message == "" then return false end --// Show message to all players in the same ACL group. local name = getPlayerName(player) local players = getElementsByType("player") local r, g, b = getPlayerNametagColor(player) for i = 1, #players do local target = players[i] if isPlayerHasAcl(target, ACL) then outputChatBox("[Clan]: "..name..": "..message, target, r, g, b) end end return true end addCommandHandler("clan", clan) --// Bind key to player on resource start. addEventHandler("onResourceStart", resourceRoot, function() local players = getElementsByType("player") for i = 1, #players do local player = players[i] bindKey(player, "u", "down", "chatbox", "clan") end end) --// Bind key to player on player login. addEventHandler("onPlayerLogin", root, function() bindKey(source, "u", "down", "chatbox", "clan") end) Hey, what's up? Honestly, I don't see any reason to implement this on the client-side. The best option is to do it on the server-side, ensuring server security against cheaters, better synchronization for all players, and other benefits. I made some improvements to your initial code. Thank you very much friend for everything I thank you very much there I sent you Soli on discord Piece with G my discord and ends with t Link to comment
zFelpszada Posted 18 hours ago Share Posted 18 hours ago 45 minutes ago, Version said: Thank you very much friend for everything I thank you very much there I sent you Soli on discord Piece with G my discord and ends with t You're welcome! If you could leave a review and close the thread, I'd appreciate it. Good luck with everything! 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