crismar Posted March 26, 2014 Share Posted March 26, 2014 Ok I'm having a DayZ Gamemode (legal one) and I have made a couple of systems. One of them is the VIP system, which is adding a text on top of player if his team is VIP. Now, the problem is I have this code: function createVIPTeam () vipTeam = createTeam ( "VIP", 255, 0, 0 ) end addEventHandler("onResourceStart", resourceRoot, createVIPTeam) function setVIPTeam() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("VIP")) then setPlayerTeam(source, vipTeam) outputChatBox("#00FF00VIP: Bine ai revenit #FFFFFF"..getPlayerName(source), source, 255, 0, 0, true) end end addEventHandler("onPlayerLogin", getRootElement(), setVIPTeam) And it works, I am in VIP group, when I connect the message shows up, but the team doesn't get set, any ideas why ? Link to comment
Moderators IIYAMA Posted March 26, 2014 Moderators Share Posted March 26, 2014 Try: function createVIPTeam () vipTeam = createTeam ( "VIP", 255, 0, 0 ) end addEventHandler("onResourceStart", resourceRoot, createVIPTeam) too: --[[function createVIPTeam ()]] vipTeam = createTeam ( "VIP", 255, 0, 0 ) --[[end addEventHandler("onResourceStart", resourceRoot, createVIPTeam)]] onResourceStart has a delay till all code has been loaded. I am not sure if that is the problem, but it is possible when players login automatic. Link to comment
xXMADEXx Posted March 26, 2014 Share Posted March 26, 2014 Try: function createVIPTeam () vipTeam = createTeam ( "VIP", 255, 0, 0 ) end addEventHandler("onResourceStart", resourceRoot, createVIPTeam) too: --[[function createVIPTeam ()]] vipTeam = createTeam ( "VIP", 255, 0, 0 ) --[[end addEventHandler("onResourceStart", resourceRoot, createVIPTeam)]] onResourceStart has a delay till all code has been loaded. I am not sure if that is the problem, but it is possible when players login automatic. This wouldn't matter, because the "vipTeam" variable is only called when a player is logged in. Are there any errors in /debugscript 3? Link to comment
crismar Posted March 27, 2014 Author Share Posted March 27, 2014 No, I get no warnings or errors in debugscript. That's what made me ask for help. Link to comment
WhoAmI Posted March 27, 2014 Share Posted March 27, 2014 Try this setPlayerTeam ( source, getTeamFromName ( "VIP" ) ) Link to comment
crismar Posted March 27, 2014 Author Share Posted March 27, 2014 Try thissetPlayerTeam ( source, getTeamFromName ( "VIP" ) ) You sir are my hero. It worked hah! Thank you a lot 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