Xeno Posted September 28, 2011 Posted September 28, 2011 How would I do this, i tried it and this is what I got so far... function onJoin(player) setPlayerTeam(player, "Guests") end addEventHandler("onPlayerJoin", getRootElement(), onJoin) It does not seem to work...
bandi94 Posted September 28, 2011 Posted September 28, 2011 function onJoin(player) local team =getTeamFromName("Guests") setPlayerTeam(player, team) end addEventHandler("onPlayerJoin", getRootElement(), onJoin)
Xeno Posted September 28, 2011 Author Posted September 28, 2011 function onJoin(player) local team =getTeamFromName("Guests") setPlayerTeam(player, team) end addEventHandler("onPlayerJoin", getRootElement(), onJoin) It does not seem to work... And I get no errors. EDIT: I actually get a bad argument at setPlayerTeam
BinSlayer1 Posted September 28, 2011 Posted September 28, 2011 function onJoin() local team =getTeamFromName("Guests") setPlayerTeam(source, team) end addEventHandler("onPlayerJoin", getRootElement(), onJoin)
Xeno Posted September 28, 2011 Author Posted September 28, 2011 function onJoin() local team =getTeamFromName("Guests") setPlayerTeam(source, team) end addEventHandler("onPlayerJoin", getRootElement(), onJoin) That did it, thanks bro. 1 More thing, how would I create a script that changes the team to Admin when an Admin logs in? I just had a quick go but failed...
BinSlayer1 Posted September 28, 2011 Posted September 28, 2011 onPlayerLogin; check if hasObjectPermissionTo then setPlayerTeam search for these functions @ https://wiki.multitheftauto.com/
tim260 Posted September 29, 2011 Posted September 29, 2011 ive red this post and i also used the onlogin script but it didnt work some help ? EDIT: maybe can someone post his meta.xml from this
bandi94 Posted September 29, 2011 Posted September 29, 2011 local teamadmin= createTeam("Admin's",255,255,255) ---you can change the color local teamg= createTeam("Guests",255,255,255) ---you can change the color function onJoin(player) setPlayerTeam(player, teamg) end function onlogin() local account=getPlayerAccount(source) if not isObjectInACLGroup ( "user." ..getAccountName(account) , aclGetGroup ( "Admin" ) ) return end setPlayerTeam(source, teamadmin) end function timerl() setTimer(onlogin,1000,1,source) end addEventHandler("onPlayerLogin", getRootElement(), timerl) function timer() setTimer(onJoin,1000,1,source) end addEventHandler("onPlayerJoin", getRootElement(), onJoin) meta you need to save the code whit name "team" <meta> <script src="team.lua" type="server" /> </meta>
TAPL Posted September 29, 2011 Posted September 29, 2011 local teamadmin = createTeam("Admin's",255,255,255) ---you can change the color local teamg = createTeam("Guests",255,255,255) ---you can change the color function onJoin(player) setPlayerTeam(player, teamg) end function onLogin() if isObjectInACLGroup ("user." ..getAccountName(getPlayerAccount(source)) , aclGetGroup ("Admin")) then setPlayerTeam(source, teamadmin) end end function timerl() setTimer(onLogin,1000,1,source) end addEventHandler("onPlayerLogin", getRootElement(), timerl) function timer() setTimer(onJoin,1000,1,source) end addEventHandler("onPlayerJoin", getRootElement(), timer)
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