Gabriel Vasconcelos Posted June 1, 2019 Share Posted June 1, 2019 (edited) Help me with my script, does not work. function team( if (isObjectInACLGroup("user." ..account, aclGetGroup("Law Enforcement"))) then setPlayerTeam(source, team) setTeamFriendlyFire(team, false) addPedClothes ( source, "policetr", "policetr", 17 ) end end) addEventHandler ( "onPlayerTeamChange", getRootElement (), team ) help me with my script Edited June 1, 2019 by Gabriel Vasconcelos Link to comment
DNL291 Posted June 1, 2019 Share Posted June 1, 2019 The event "onPlayerTeamChange" doesn't exist (although it would be useful if it's implemented in MTA). You also have some errors in your code, like: - A parenthesis missing at the beginning of the function. - An extra parenthesis at the end of the function. - 'account' and 'team' not defined Next time remember to post your code using the button <> and select the appropriate code language (ie: Lua). Read: https://forum.multitheftauto.com/topic/94790-guidelines-and-formatting-for-this-section-read-before-posting/ Link to comment
Gabriel Vasconcelos Posted June 1, 2019 Author Share Posted June 1, 2019 function team( if (isObjectInACLGroup("user." ..account, aclGetGroup("Law Enforcement")) then setPlayerTeam(source, team) setTeamFriendlyFire(team, false) addPedClothes ( source, "policetr", "policetr", 17 ) end end) addCommandHandler ( "cloth", team ) how could it solve? Link to comment
DNL291 Posted June 1, 2019 Share Posted June 1, 2019 You didn't fixed the erros I mentioned. Try this: function team( player ) if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Law Enforcement")) then local g_team = getTeamFromName( "team_name_here" ) setPlayerTeam(player, g_team) setTeamFriendlyFire(g_team, false) addPedClothes ( player, "policetr", "policetr", 17 ) end end addCommandHandler ( "cloth", team ) Don't forget to define the team name. You must also have the acl group "Law Enforcement" created; or define an existing one. Link to comment
Gabriel Vasconcelos Posted June 1, 2019 Author Share Posted June 1, 2019 So, this would be for a given team, in this case it would be: function team local g_team = getTeamFromName( "Law Enforcement" ) setPlayerTeam(player, g_team) setTeamFriendlyFire(g_team, false) addPedClothes ( player, "policetr", "policetr", 17 ) end addCommandHandler ( "cloth", team ) Right? Link to comment
DNL291 Posted June 1, 2019 Share Posted June 1, 2019 > function team( player ) local g_team = getTeamFromName( "Law Enforcement" ) setPlayerTeam(player, g_team) setTeamFriendlyFire(g_team, false) addPedClothes ( player, "policetr", "policetr", 17 ) end addCommandHandler ( "cloth", team ) 1 Link to comment
Gabriel Vasconcelos Posted June 2, 2019 Author Share Posted June 2, 2019 the problem is that it is working, but for everyone, I want only those who are part of the LAW to use Link to comment
Charles Posted June 2, 2019 Share Posted June 2, 2019 function team( player ) local team = getPlayerTeam(player) local g_team = getTeamFromName(team) if (g_team == "Law Enforcement") then addPedClothes ( player, "policetr", "policetr", 17 ) end end addCommandHandler ( "cloth", team ) Link to comment
DNL291 Posted June 3, 2019 Share Posted June 3, 2019 (edited) 6 hours ago, Gabriel Vasconcelos said: the problem is that it is working, but for everyone, I want only those who are part of the LAW to use That's probably what you mean: function setTeamCmd( player ) local team = getPlayerTeam(player) if team and getTeamName(team) == "Law Enforcement" then addPedClothes ( player, "policetr", "policetr", 17 ) end end addCommandHandler ( "cloth", setTeamCmd ) It's hard to figure out what you want to achieve because you didn't explain it at all. Next time you ask for help provide some informations, it's not always that someone will give you the full code. Edited June 3, 2019 by DNL291 1 Link to comment
Gabriel Vasconcelos Posted June 3, 2019 Author Share Posted June 3, 2019 It's what I needed, thank you. 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