crismar Posted March 26, 2014 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 ? Contact me if you are looking for a Web Developer. 3rd of October 2014 - Founder of RomaniaZ
Moderators IIYAMA Posted March 26, 2014 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
xXMADEXx Posted March 26, 2014 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? The Ultimate Lua Tutorial! | MTA PHP SDK
crismar Posted March 27, 2014 Author Posted March 27, 2014 No, I get no warnings or errors in debugscript. That's what made me ask for help. Contact me if you are looking for a Web Developer. 3rd of October 2014 - Founder of RomaniaZ
WhoAmI Posted March 27, 2014 Posted March 27, 2014 Try this setPlayerTeam ( source, getTeamFromName ( "VIP" ) )
crismar Posted March 27, 2014 Author Posted March 27, 2014 Try thissetPlayerTeam ( source, getTeamFromName ( "VIP" ) ) You sir are my hero. It worked hah! Thank you a lot Contact me if you are looking for a Web Developer. 3rd of October 2014 - Founder of RomaniaZ
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