MatXpl Posted December 26, 2010 Share Posted December 26, 2010 Hi! I have question: How can i set max players in team ? Of course, if this is possible Link to comment
Aibo Posted December 26, 2010 Share Posted December 26, 2010 when you're adding a player to the team, check how many members it has already. if it has reached some limit - dont accept player to the team. https://wiki.multitheftauto.com/wiki/CountPlayersInTeam also see related Team functions. Link to comment
MatXpl Posted December 26, 2010 Author Share Posted December 26, 2010 I created this but i have problem if nnnCount == 0 then setPlayerTeam" class="kw6">setPlayerTeam (thePlayer, pnn) outputChatBox ("You are in NeRN", thePlayer, 255, 0, 0, true) setElementPosition (thePlayer, 2021, 1065, 104) setPlayerSkin (thePlayer, 148) elseif pCount == 1 then ... and in debug script shows: Bad 'player' pointer @ 'setPlayerTeam'(1) Bad 'element' pointer @ 'outputChatBox'(1) ... But i have defined player function teams (thePlayer) Help ! Link to comment
Aibo Posted December 26, 2010 Share Posted December 26, 2010 you cant post a single line that gives error and expect help. that way people only can help you with syntax errors. and if you have some function which has some "thePlayer" argument, it doesnt mean its not nil. where's this function called? what is passed to this function? Link to comment
MatXpl Posted December 26, 2010 Author Share Posted December 26, 2010 Script: fl = createTeam ( "FL", 0, 10, 200 ) nn = createTeam ( "NN", 0, 200, 10 ) pCount = countPlayersInTeam ( fl ) mCount = countPlayersInTeam ( nn ) function team (thePlayer) if pCount == 0 then setPlayerTeam" class="kw6">setPlayerTeam (thePlayer, fl) outputChatBox ("Spawned", thePlayer, 255, 10, 0, true) setElementPosition (thePlayer, 1232, 1011, 254) setPlayerSkin (thePlayer, 168) elseif pCount == 1 then setPlayerTeam" class="kw6">setPlayerTeam (thePlayer , nn) setElementPosition (thePlayer, 1510, 120, 113) setPlayerSkin (thePlayer, 166) end end addEventHandler( "onPlayerLogin", getRootElement(), team ) Link to comment
Aibo Posted December 26, 2010 Share Posted December 26, 2010 "thePlayer" is not a player element here, it's player's previous account. use "source" instead. and i bet you'll need to recount team members when you add a player to the team. Link to comment
MatXpl Posted December 26, 2010 Author Share Posted December 26, 2010 i cheanage all thePlayer to source and this dosen't work.. Link to comment
Castillo Posted December 27, 2010 Share Posted December 27, 2010 i have a question, wtf is this? setPlayerTeam" class="kw6">setPlayerTeam" class="kw6">setPlayerTeam (thePlayer, fl) would that also work? and whats the difference? Link to comment
MatXpl Posted December 27, 2010 Author Share Posted December 27, 2010 lol i uploaded "setPlayerTeam( thePlayer, fl )" and after writing my post code has changed ... maybe its a bug in the forum? Here i add code not in code tags: a = createTeam ( "teamA", 0, 10, 200 ) b = createTeam ( "teamB", 0, 200, 10 ) aCount = countPlayersInTeam ( a ) bCount = countPlayersInTeam ( b ) function team (thePlayer) if aCount == 0 then setPlayerTeam (thePlayer, a) outputChatBox ("A", thePlayer, 255, 0, 0, true) setElementPosition (thePlayer, 1021, 1120, 142) setPlayerSkin (thePlayer, 184) elseif bCount == 1 then setPlayerTeam (thePlayer , b) setElementPosition (thePlayer, 100, 100, 100) setPlayerSkin (thePlayer, 162) end end addEventHandler( "onPlayerLogin", getRootElement(), team ) Link to comment
Castillo Posted December 27, 2010 Share Posted December 27, 2010 put the count players in team functions into onPlayerLogin function, this. a = createTeam ( "teamA", 0, 10, 200 ) b = createTeam ( "teamB", 0, 200, 10 ) function team (thePlayer) aCount = countPlayersInTeam ( a ) bCount = countPlayersInTeam ( b ) if aCount == 0 then setPlayerTeam" class="kw6">setPlayerTeam (thePlayer, a) outputChatBox ("A", thePlayer, 255, 0, 0, true) setElementPosition (thePlayer, 1021, 1120, 142) setPlayerSkin (thePlayer, 184) elseif bCount == 1 then setPlayerTeam" class="kw6">setPlayerTeam (thePlayer , b) setElementPosition (thePlayer, 100, 100, 100) setPlayerSkin (thePlayer, 162) end end addEventHandler( "onPlayerLogin", getRootElement(), team ) Link to comment
MatXpl Posted December 28, 2010 Author Share Posted December 28, 2010 ok, now it works thanks 4 all 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