KickPlayer: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


{{FuncDescription|Kicks a player with a reason, colors are '''not''' supported.}}
{{FuncDescription|Kicks (disconnect) a player with a reason, colors are '''not''' supported.}}


{{FuncSyntax|KickPlayer(player, reason)}}
{{FuncSyntax|KickPlayer(player, reason)}}
Line 28: Line 28:


{{RelatedFunctions}}
{{RelatedFunctions}}
{{Template:ClientFunctions}}
{{ServerPlayerFunctions}}

Latest revision as of 17:51, 3 February 2022

KickPlayer

Type: Function
Context: Server
Introduced: v1.0

Description

Kicks (disconnect) a player with a reason, colors are not supported.

Syntax

KickPlayer(player, reason)

Parameters

  • player
    The player identifier.
  • reason
    The reason

Return Value

  • This function doesn't have a return value.

Example

AddCommand("kick", function(playerid, lookupid)

    if lookupid == nil then
        return AddPlayerChat(playerid, "Usage: /kick <lookupid>")
    end

    if not IsValidPlayer(lookupid) then
        return AddPlayerChat(playerid, "The playerid you have inserted is invalid.")
    end

    KickPlayer(lookupid, "Kicked by "..GetPlayerName(playerid)..".")
end)

See also