Samking Posted August 29, 2018 Share Posted August 29, 2018 local isPlayerInGroup, onChat local function onChatCommand (player) if isPlayerInGroup (player, "VIP") then onChat (player) else outputChatBox ("You must be VIP to use this command.", player,255,0, 0,true) end end addCommandHandler("v", onChatCommand) chat_range=10000000 addEventHandler("onPlayerJoin",getRootElement(), function () end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) local r,g,b = getTeamColor(getPlayerTeam(player)) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("[VIP Chat]"..nick..": #ffffff"..msg,v,255,0,255,true) end end end function isPlayerInGroup (player, group) local playerAccount = getPlayerAccount ( player ) if playerAccount then local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( group ) ) then return true end end return false end Can someone tell me how to make separate VIP chat and that can visible to those who are in the VIP group? I am getting this error Bad argument @ 'getTeamColor' [Expected team at argument 1 , got boollean] Can someone make code and send me plz Thanks! Link to comment
Dimos7 Posted August 29, 2018 Share Posted August 29, 2018 Player is not in a teams so give that error Link to comment
Samking Posted August 29, 2018 Author Share Posted August 29, 2018 52 minutes ago, Dimos7 said: Player is not in a teams so give that error before the test, I set myself in VIP group but still giving me the error Link to comment
Dimos7 Posted August 29, 2018 Share Posted August 29, 2018 Yes that not about acl that is for game teams which player it in your are not in a team 4 minutes ago, Samking said: before the test, I set myself in VIP group but still giving me the error local isPlayerInGroup, onChat local function onChatCommand (player) if isPlayerInGroup (player, "VIP") then onChat (player) else outputChatBox ("You must be VIP to use this command.", player,255,0, 0,true) end end addCommandHandler("v", onChatCommand) chat_range=10000000 addEventHandler("onPlayerJoin",getRootElement(), function () end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("[VIP Chat]"..nick..": #ffffff"..msg,v,255,0,255,true) end end end function isPlayerInGroup (player, group) local playerAccount = getPlayerAccount ( player ) if playerAccount then local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( group ) ) then return true end end return false end Link to comment
Samking Posted August 29, 2018 Author Share Posted August 29, 2018 1 hour ago, Dimos7 said: Yes that not about acl that is for game teams which player it in your are not in a team local isPlayerInGroup, onChat local function onChatCommand (player) if isPlayerInGroup (player, "VIP") then onChat (player) else outputChatBox ("You must be VIP to use this command.", player,255,0, 0,true) end end addCommandHandler("v", onChatCommand) chat_range=10000000 addEventHandler("onPlayerJoin",getRootElement(), function () end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function () for index, player in pairs(getElementsByType("player")) do end end) function isPlayerInRangeOfPoint(player,x,y,z,range) local px,py,pz=getElementPosition(player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range end function onChat(player,_,...) local px,py,pz=getElementPosition(player) local msg = table.concat({...}, " ") local nick=getPlayerName(player) for _,v in ipairs(getElementsByType("player")) do if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then outputChatBox("[VIP Chat]"..nick..": #ffffff"..msg,v,255,0,255,true) end end end function isPlayerInGroup (player, group) local playerAccount = getPlayerAccount ( player ) if playerAccount then local accName = getAccountName ( playerAccount ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( group ) ) then return true end end return false end how can I create a chat for acl? Link to comment
Dimos7 Posted August 29, 2018 Share Posted August 29, 2018 You already did 7 minutes ago, Samking said: how can I create a chat for acl? Link to comment
Samking Posted August 30, 2018 Author Share Posted August 30, 2018 5 hours ago, Dimos7 said: You already did this code is made by my friend that's why I am getting difficulties. Link to comment
Dimos7 Posted August 30, 2018 Share Posted August 30, 2018 I can make it easier if you want Link to comment
Samking Posted August 30, 2018 Author Share Posted August 30, 2018 1 minute ago, Dimos7 said: I can make it easier if you want make it easy bls for VIP acl group when I type /v text this only show my name I cant be able to see text Link to comment
Dimos7 Posted August 30, 2018 Share Posted August 30, 2018 (edited) function vipChat(thePlayer, _,...) local message = table.concat ({...}, " ") for _, v in ipairs (getElementsByType("player")) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("VIP")) then outputChatBox("[VIP Chat]".. getPlayerName(thePlayer).. ":#ffffff ".. message, v, 255, 0, 255, true) else return outputChatBox("You are not VIP", thePlayer, 255, 0, 0) end end end addCommandHandler("v", vipChat) Edited August 30, 2018 by Dimos7 Link to comment
Samking Posted August 30, 2018 Author Share Posted August 30, 2018 1 hour ago, Dimos7 said: function vipChat(thePlayer, _,...) local message = table.concat ({...}, " ") for _, v in ipairs (getElementsByType("player")) do if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(v)), aclGetGroup("VIP")) then outputChatBox("[VIP Chat]".. getPlayerName(thePlayer).. ":#ffffff ".. message, v, 255, 0, 255, true) else return outputChatBox("You are not VIP", thePlayer, 255, 0, 0) end end end addCommandHandler("v", vipChat) thanks but this visible to only VIPs? Link to comment
sanyisasha Posted September 1, 2018 Share Posted September 1, 2018 (edited) Didn't read all the comments but: local r,g,b = 255, 255, 255 if getPlayerTeam(player) then if getTeamColor(getPlayerTeam(player)) then r,g,b = getTeamColor(getPlayerTeam(player)) end end With this you don't get error if team's color didn't set. Edited September 1, 2018 by sanyisasha Link to comment
Dimos7 Posted September 1, 2018 Share Posted September 1, 2018 He don't had a color defind with rgb only take team colro which he was in none which mean team not exist and color too 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