DarkRP.Player.ChangeTeam

From Official DarkRP Wiki
Jump to: navigation, search
This page refers to DarkRP 2.4.3. This information may be incorrect as of later versions.
Check here for a up-to-date list of functions.
Function
Function name Player:ChangeTeam(table team, boolean force)
Description:
Changes the players team
Returns: boolean
Part of Library: Player
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=DarkRP.Player.ChangeTeam]Player:ChangeTeam[/url][/b]

Examples

DescriptionChange a player's team by saying: /IDon'tBelieve
Used onNewerServer.png
Code
local function LastSaid( ply, text, team, death )
    if (string.sub(text, 1, 14) == "/IDon'tBelieve") then
        ply:ChangeTeam( TEAM_HOBO, true )
    end
end
hook.Add( "PlayerSay", "LastSaid", LastSaid );
OutputThe player turns into a hobo.


Additional Notes

  • Returns false if the job could not be changed (eg. team ban, arrested, escaping demotion), true if the player's job changed successfully.