capitanazop Posted June 10, 2008 Share Posted June 10, 2008 hi i can find any function to remove a player of team. plz help y urgent! bye and sorry for my english Link to comment
paragon Posted June 10, 2008 Share Posted June 10, 2008 here you go. playerTeam = getPlayerTeam ( source ) -- gets the current players team if ( playerTeam ) then --checks if the player is in a team by checking if playerTeam returned true setPlayerTeam ( source, nil ) -- set the players team to nil (no team ). end edit: now that I think about it, the wiki has an example of this for setPlayerTeam... http://development.mtasa.com/index.php? ... PlayerTeam Link to comment
capitanazop Posted June 11, 2008 Author Share Posted June 11, 2008 o sorry i view this example 1000 times but never view the remove player of team . thanks man Link to comment
XetaQuake Posted June 11, 2008 Share Posted June 11, 2008 Hi, i have a other question. Thats a little bit off-topic but i don´t want to create a new topic for this: currently i tried to script a chat command "jointeam [name]". So wen a player types "jointeam testteam" in the chat, he gets in the team "testteam". but it don´t work, i don´t joins the team. Here is the code: function assignNewTeam ( source, commandName, teamName ) setPlayerTeam ( source, teamName ) -- add the player to a team outputChatBox ( "test", source, 128, 206, 206 ) end addCommandHandler ( "team", assignNewTeam ) But i gets the outputChatBox "test", so the script are called. I don´t get any warnings, infos or errors with /debugscript 3 Any ideas pleas? Link to comment
capitanazop Posted June 11, 2008 Author Share Posted June 11, 2008 this is mi command for join in a team ;D. function jointeam ( playerSource, commandName) setPlayerTeam(playerSource, teamDm) end addCommandHandler ("jointeam", jointeam ) but you need this definitons and events. team = {} teamDm = nil function createTeamsOnStart () teamDm = createTeam ( "Deathmach", 200, 0, 100 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart ) Link to comment
XetaQuake Posted June 12, 2008 Share Posted June 12, 2008 No, thats not waht i want, but thanks for help. I don´t want to sing out my script now, but i tried to create a dynamic command, so you can write team lol or team yeaateam - everything. I don´t want creates a team with the script, there should be dynamic teams. I just need a script to gets this command working: team anyteamnamehere but this don´t work: function assignNewTeam ( source, commandName, teamName ) setPlayerTeam ( source, teamName ) -- add the player to a team outputChatBox ( "test", source, 128, 206, 206 ) end addCommandHandler ( "team", assignNewTeam ) Any ideas? Link to comment
tma Posted June 12, 2008 Share Posted June 12, 2008 Like this: function assignNewTeam ( source, commandName, teamName ) local team = getTeamFromName(teamName) if team then setPlayerTeam ( source, team ) -- add the player to a team outputChatBox ( "test", source, 128, 206, 206 ) end end addCommandHandler ( "team", assignNewTeam ) This relies on the player entering the EXACT name of the team. Alternatively you could do partial team name matches (e.g. "race" for "Mad Racing") by spinning a loop through all "team" elements and doing you own string comparisons of the team name - getTeamName(). Link to comment
XetaQuake Posted June 12, 2008 Share Posted June 12, 2008 BÄM - thanks! I already searching a function to get a team by the name, like getTeamFromName(teamName) but nothing found - that´s why its dont works. Now its works perfect, thanks! 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