manve1 Posted October 16, 2012 Posted October 16, 2012 i have a problem on my script which i don't know how to fix. chat_range=9999 addEventHandler("onPlayerJoin",getRootElement(), function (p) if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( "Admin" ) ) then bindKey(source,"u","down","chatbox","GOOC") end end) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function (p) if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( "Admin" ) ) then for index, player in pairs(getElementsByType("player")) do bindKey(player,"u","down","chatbox","GOOC") end 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, p, _, ...) if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( "Admin" ) ) then 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("(GOOC) ".. nick ..": "..msg,v,r,g,b,true) end end end end addCommandHandler("GOOC",onChat) P.S. This script is taken from community Looking for tutorials or information? check out: www.simpleask.co.uk
Callum Posted October 16, 2012 Posted October 16, 2012 Why do you need to check whether or not the resource is in the "Admin" ACL group? As far as I can see, the conditional check at line 12 can be removed entirely. Retired
Anderl Posted October 16, 2012 Posted October 16, 2012 And there's no player argument on onResourceStart. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
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