KickPlayer: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|KickPlayer(player, reason)}} {{FuncParameters}} {{FuncParam|player|__EDIT_ME__}} {{FuncParam|reaso..."
 
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


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


{{FuncSyntax|KickPlayer(player, reason)}}
{{FuncSyntax|KickPlayer(player, reason)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|player|__EDIT_ME__}}
{{FuncParam|player|The player identifier.}}
{{FuncParam|reason|__EDIT_ME__}}
{{FuncParam|reason|The reason}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|This function doesn't have a return value.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
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)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
{{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