Jump to content

Problem :(


Recommended Posts

Hey guys, I have this team script, but there's a problem with it I can't seem to find.

Players that belong in the 'Police' ACL group aren't automatically put into the 'Police' team when they login.

Can anyone help?

local root = getRootElement()
 
addEventHandler("onResourceStart", root,
function()
team = createTeam ("Police", 0, 0, 255)
end
)
 
function login()
local taccount = getPlayerAccount ( source )
if isZarAccount(taccount) then
setPlayerTeam ( source, team)
outputChatBox ("Welcome to Zombie Apocalypse Rescue Squad HQ", source)
spawnPlayer (source, -2246.7751464844, 2283.3193359375, 5, 90, 281, team )
giveWeapon (source, 3, 1)
giveWeapon (source, 24, 500)
giveWeapon (source, 29, 500)
giveWeapon (source, 31, 500)
giveWeapon (source, 17, 50)
fadeCamera (source, true)
setCameraTarget (source, true)
else
end
end
addEventHandler("onPlayerLogin", root,login)
 
function isZarAccount(account)
local nick = ""
local group = aclGetGroup("Police")
if (account and group) then
   nick = string.lower(getAccountName(account) or "")
for _, object in ipairs(aclGroupListObjects(group) or {}) do
if (gettok(object, 1, string.byte('.')) == "user") then
if (nick == string.lower(gettok(object, 2, string.byte('.')))) then
return true
end
end
end
end
return false
end
 
function spawn(source)
spawnPlayer (source, -2246.7751464844, 2283.3193359375, 5, 90, 281, team )
giveWeapon (source, 3, 1)
giveWeapon (source, 24, 500)
giveWeapon (source, 29, 500)
giveWeapon (source, 31, 500)
giveWeapon (source, 17, 500)
fadeCamera (source, true)
setCameraTarget (source, true)
end
 
addEventHandler("onPlayerWasted", root,
function()
local taccount = getPlayerAccount ( source )
if isZarAccount(taccount) then
setTimer(spawn, 2000, 1, source)
end
end
)

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...