tim260 Posted January 6, 2012 Share Posted January 6, 2012 Hello people can you find my mistake on the followingg its not showing like your not in this team in the chat addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "getTeamFromName" ) ) then setPlayerTeam ( source , team ) outputChatBox("You have successfully been moved to "..getTeamName(team).." Team.", resPlayer, root, 0, 255, 0) else ) outputChatBox ( "Your not in this team") end end ) Link to comment
GanJaRuleZ Posted January 6, 2012 Share Posted January 6, 2012 (edited) Check if the team is created , there must be a team named : teamName EDIT : I remade it simple ( BTW , idk if it will work ) addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function teamName () local team = getTeamFromName ( "Example 1" ) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Example 1" ) ) then setPlayerTeam ( thePlayer , team ) outputChatBox("You have successfully been moved to Example 1 Team.", thePlayer, root, 0, 255, 0) else outputChatBox ( "Your not in this team") end end) Edited January 6, 2012 by Guest Link to comment
tim260 Posted January 6, 2012 Author Share Posted January 6, 2012 Check if the team is created , there must be a team named : teamName thats already done dont mind that im just asking am i using else and end etcgood ? Link to comment
tim260 Posted January 6, 2012 Author Share Posted January 6, 2012 Remade it .. its from a resource teams are created in a other script please this wont work let someone else look at it Link to comment
Unknown76 Posted January 6, 2012 Share Posted January 6, 2012 At line 8 near else delete the bracket. Link to comment
Castillo Posted January 6, 2012 Share Posted January 6, 2012 Can you show us how you trigger the "onPlayerChooseTeam" event? addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) local account = getPlayerAccount(source) local accountName = getAccountName(account) if isObjectInACLGroup ( "user."..tostring(accountName), aclGetGroup ( teamName ) ) then setPlayerTeam ( source, team ) outputChatBox("You have successfully been moved to "..getTeamName(team).." Team.", source, root, 0, 255, 0) else outputChatBox ( "Your not in this team",source) end end) Link to comment
tim260 Posted January 6, 2012 Author Share Posted January 6, 2012 Can you show us how you trigger the "onPlayerChooseTeam" event? addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) local account = getPlayerAccount(source) local accountName = getAccountName(account) if isObjectInACLGroup ( "user."..tostring(accountName), aclGetGroup ( "getTeamFromName" ) ) then setPlayerTeam ( source, team ) outputChatBox("You have successfully been moved to "..getTeamName(team).." Team.", source, root, 0, 255, 0) else outputChatBox ( "Your not in this team",source) end end) its from this resource https://community.multitheftauto.com/index.php?p= ... ls&id=2685 Link to comment
Castillo Posted January 6, 2012 Share Posted January 6, 2012 Do you mind explaining what are you trying to achieve? Link to comment
tim260 Posted January 6, 2012 Author Share Posted January 6, 2012 Do you mind explaining what are you trying to achieve? sorry solid lock the team selection, The acl group is named like the team so if i want to join pilot team i can only if im in the acl group pilot Link to comment
Castillo Posted January 6, 2012 Share Posted January 6, 2012 Change the code from "teamspawn.lua" with this: local teamsTable = { [ "Police" ] = { 1553.0385742188 , -1675.7225341797 , 16.1953125 } , [ "Robber" ] = { 2249.8801269531 , -1908.4437255859 , 13.546875 } , [ "Mechanics" ] = { 1011.7614746094 , -1005.9530639648 , 32.1015625 } , [ "Whores" ] = { 1833.8845214844 , -1682.6907958984 , 13.454662322998 } , [ "Pilot" ] = { 2001.0803222656 , -2366.482910563 , 13.546875 } , [ "Trucker" ] = { -83.053352355957 , -1136.3688964844 , 1.078125 } } addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) local account = getPlayerAccount(source) local accountName = getAccountName(account) if isObjectInACLGroup ( "user."..tostring(accountName), aclGetGroup ( teamName ) ) then setPlayerTeam ( source, team ) local spawnX, spawnY, spawnZ = unpack ( teamsTable [ teamName ] ) spawnPlayer ( source, spawnX, spawnY, spawnZ ) else outputChatBox ( "Your not in this team",source) end end ) Link to comment
tim260 Posted January 6, 2012 Author Share Posted January 6, 2012 (edited) Change the code from "teamspawn.lua" with this: local teamsTable = { [ "Police" ] = { 1553.0385742188 , -1675.7225341797 , 16.1953125 } , [ "Robber" ] = { 2249.8801269531 , -1908.4437255859 , 13.546875 } , [ "Mechanics" ] = { 1011.7614746094 , -1005.9530639648 , 32.1015625 } , [ "Whores" ] = { 1833.8845214844 , -1682.6907958984 , 13.454662322998 } , [ "Pilot" ] = { 2001.0803222656 , -2366.482910563 , 13.546875 } , [ "Trucker" ] = { -83.053352355957 , -1136.3688964844 , 1.078125 } } addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) local account = getPlayerAccount(source) local accountName = getAccountName(account) if isObjectInACLGroup ( "user."..tostring(accountName), aclGetGroup ( teamName ) ) then setPlayerTeam ( source, team ) local spawnX, spawnY, spawnZ = unpack ( teamsTable [ teamName ] ) spawnPlayer ( source, spawnX, spawnY, spawnZ ) else outputChatBox ( "Your not in this team",source) end end ) im stil getting the message your moved but im not so i can edit this my own EDIT : i got it right thank you very much Edited January 6, 2012 by Guest Link to comment
Castillo Posted January 6, 2012 Share Posted January 6, 2012 Because the resource has a different script to output the message (really stupid). Link to comment
tim260 Posted January 6, 2012 Author Share Posted January 6, 2012 Because the resource has a different script to output the message (really stupid). lolz maybe you should contact the designer and tell him hes stupid btw im using your gang sytem people are talking bout a managment panel how do i open it ? Link to comment
Castillo Posted January 6, 2012 Share Posted January 6, 2012 As far as I remember with the key "U". Link to comment
tim260 Posted January 6, 2012 Author Share Posted January 6, 2012 As far as I remember with the key "U". hmm doesnt work EDIT: bout the last resource anyway i could let them spawn whit a skin i define ? Link to comment
ishinam Posted January 7, 2012 Share Posted January 7, 2012 Hello people can you find my mistake on the followingg its not showing like your not in this team in the chat addEvent ( "onPlayerChooseTeam" , true ) addEventHandler ( "onPlayerChooseTeam" , root , function ( teamName ) local team = getTeamFromName ( teamName ) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "getTeamFromName" ) ) then setPlayerTeam ( source , team ) outputChatBox("You have successfully been moved to "..getTeamName(team).." Team.", resPlayer, root, 0, 255, 0) else ) outputChatBox ( "Your not in this team") end end ) The only mistake I can see is "getTeamFromName" should be teamName in 5th line and delete bracket in 8th line.Make sure you are triggering the event correctly 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