dub5tar Posted August 29, 2012 Share Posted August 29, 2012 All help appreciated in advance! Ok so i was looking into building a script which would set team automatically when the player joined/logged in etc. But im having a problem, as before it would work but after the player died i realized he wouldn't be in the team anymore so i tried to fix that and failed miserably Anyway below is a copy of what i got so far! if you see any problems and can fix it that would be awesome and like i said before you would be thanked in advance! BTW this is a modified version of Solidsnake14 script! local root = getRootElement() addEventHandler("onResourceStart", root, function() team1 = createTeam ("Admin", 220, 20, 60) team2 = createTeam ("Staff", 220, 20, 60) team3 = createTeam ("Member", 0, 0, 255) team4 = createTeam ("Guest", 0, 255, 0) end ) function greetPlayer ( ) local joinedPlayerName = getPlayerName ( source ) local serverName = getServerName( ) outputChatBox ( "Welcome " .. joinedPlayerName .. " to ".. serverName .."! Enjoy your stay!" , source, 255, 255, 255 ) setPlayerTeam ( source, team4) end addEventHandler ( "onPlayerJoin", getRootElement(), greetPlayer ) function loggedout ( ) setPlayerTeam ( source, team4) end addEventHandler("onPlayerLogout", root,loggedout) function login() if isadmin(account) then setPlayerTeam ( source, team1) outputChatBox ("You have been moved to the Admin Team", source) 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) else if isstaff(account) then setPlayerTeam ( source, team2) outputChatBox ("You have been moved to the Staff Team!", source) 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) else setPlayerTeam ( source, team3) outputChatBox ("You have been moved to the Member Team!", source) 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 end end addEventHandler("onPlayerLogin", root,login) function isadmin(account) local group = aclGetGroup("Admin") if (account and group) then return true else return false end end function isstaff(account) local group = aclGetGroup("Moderator") if (account and group) then return true else return false end end function spawn(source) 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 function checkagain ( ) if isadmin(account) then setTimer(spawn, 1800, 1, source) setPlayerTeam ( source, team1) else if isstaff(account) then setTimer(spawn, 1800, 1, source) setPlayerTeam ( source, team2) else if isPlayerLoggedIn(root) then setTimer(spawn, 1800, 1, source) setPlayerTeam ( source, team3) else setPlayerTeam ( source, team4) end end end end addEventHandler("onPlayerWasted", root,checkagain) Link to comment
DNL291 Posted August 29, 2012 Share Posted August 29, 2012 addEventHandler("onResourceStart", resourceRoot, function() team1 = createTeam ("Admin", 220, 20, 60) team2 = createTeam ("Staff", 220, 20, 60) team3 = createTeam ("Member", 0, 0, 255) team4 = createTeam ("Guest", 0, 255, 0) end ) function greetPlayer ( ) local joinedPlayerName = getPlayerName ( source ) local serverName = getServerName( ) outputChatBox ( "Welcome " .. joinedPlayerName .. " to ".. serverName .."! Enjoy your stay!" , source, 255, 255, 255 ) setPlayerTeam ( source, team4) end addEventHandler ( "onPlayerJoin", root, greetPlayer ) function loggedout ( ) setPlayerTeam ( source, team4) end addEventHandler("onPlayerLogout", root, loggedout) function login() local account = getAccountName(getPlayerAccount(source)) if isadmin(account) then setPlayerTeam ( source, team1) outputChatBox ("You have been moved to the Admin Team", source) 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) elseif isstaff(account) then setPlayerTeam ( source, team2) outputChatBox ("You have been moved to the Staff Team!", source) 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) else setPlayerTeam ( source, team3) outputChatBox ("You have been moved to the Member Team!", source) 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 end addEventHandler("onPlayerLogin", root,login) function isadmin(account) local group = aclGetGroup("Admin") if (account and group) then return true else return false end end function isstaff(account) local group = aclGetGroup("Moderator") if (account and group) then return true else return false end end function spawn(source) 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 function checkagain ( ) local account = getAccountName(getPlayerAccount(source)) if isadmin(account) then setTimer(spawn, 1800, 1, source) setPlayerTeam ( source, team1) elseif isstaff(account) then setTimer(spawn, 1800, 1, source) setPlayerTeam ( source, team2) elseif isPlayerLoggedIn(root) then setTimer(spawn, 1800, 1, source) setPlayerTeam ( source, team3) else setPlayerTeam ( source, team4) end end addEventHandler("onPlayerWasted", root,checkagain) Link to comment
dub5tar Posted August 29, 2012 Author Share Posted August 29, 2012 Thanks man seems to be working now! 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