|
|
| (10 intermediate revisions by 7 users not shown) |
| Line 1: |
Line 1: |
| {{Useful Function}}
| | <pageclass class="both" subcaption="Shared function"></pageclass> |
| {{Adding_Pages_to_Categories_and_Templates}}
| |
| <lowercasetitle></lowercasetitle> | | <lowercasetitle></lowercasetitle> |
| __NOTOC__
| | <includeonly>[[Category:Server functions]][[Category:Client functions]]</includeonly> |
| This function check if the player in the team.
| |
| | |
| ==Code==
| |
| <section name="Serverside Script" class="server" show="true"> | |
| <syntaxhighlight lang="lua">
| |
| function isPlayerInTeam( thePlayer, teamName )
| |
| local pTeam = getPlayerTeam( thePlayer )
| |
| local fTeam = getTeamFromName( teamName )
| |
| if not ( pTeam ) and ( fTeam ) then
| |
| return false
| |
| end
| |
| if ( pTeam == fTeam ) then
| |
| return true
| |
| end
| |
| end
| |
| </syntaxhighlight>
| |
| </section>
| |
| | |
| ==Example==
| |
| <section name="Server" class="server" show="true">
| |
| This example check if the cop team.
| |
| <syntaxhighlight lang="lua">
| |
| createTeam( 'Cop', 255, 0, 0 )
| |
| | |
| addCommandHandler( 'InTeam',
| |
| function( aPlayer )
| |
| if isPlayerInTeam( aPlayer, 'Cop' ) then
| |
| outputChatBox( 'You\'re in cop team.', aPlayer )
| |
| else
| |
| outputChatBox( 'You\'re not in cop team.', aPlayer )
| |
| end
| |
| end
| |
| )
| |
| </syntaxhighlight> | |
| </section>
| |
| | |
| Author(s): -
| |
| | |
| ==See Also==
| |
| {{Useful_Functions}}
| |