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| | {{FuncDescription|Kicks (disconnect) a player with a reason, colors are '''not''' supported.}} | ||
{{FuncSyntax|KickPlayer(player, reason)}} | {{FuncSyntax|KickPlayer(player, reason)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|player| | {{FuncParam|player|The player identifier.}} | ||
{{FuncParam|reason| | {{FuncParam|reason|The reason}} | ||
{{FuncReturnValue| | {{FuncReturnValue|This function doesn't have a return value.}} | ||
== Example == | == Example == | ||
<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}} | ||
{{ServerPlayerFunctions}} |
Latest revision as of 17:51, 3 February 2022
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
- GetPlayerBySteamId
- SetPlayerRagdoll
- SetPlayerDimension
- GetPlayerDimension
- SetPlayerPropertyValue
- GetPlayerPropertyValue
- IsValidPlayer
- GetPlayerCount
- GetAllPlayers
- GetNearestPlayer2D
- GetPlayersInRange2D
- GetPlayersInRange3D
- GetStreamedPlayersForPlayer
- SetPlayerName
- GetPlayerName
- GetPlayerSteamId
- GetPlayerNetworkStats
- SetPlayerSpawnLocation
- IsPlayerStreamedIn
- SetPlayerVoiceRange
- SetPlayerVoiceChannel
- IsPlayerVoiceChannel
- SetPlayerVoiceEnabled
- IsPlayerVoiceEnabled
- IsPlayerTalking
- AddPlayerChat
- AddPlayerChatRange
- AddPlayerChatAll
- GetPlayerState
- GetPlayerMovementMode
- GetPlayerMovementSpeed
- IsPlayerAiming
- IsPlayerReloading
- GetPlayerVehicle
- GetPlayerVehicleSeat
- SetPlayerInVehicle
- RemovePlayerFromVehicle
- SetPlayerLocation
- GetPlayerLocation
- SetPlayerWeaponStat
- SetPlayerWeapon
- GetPlayerWeapon
- GetPlayerEquippedWeaponSlot
- EquipPlayerWeaponSlot
- GetPlayerEquippedWeapon
- SetPlayerHeading
- GetPlayerHeading
- SetPlayerSpectate
- IsPlayerDead
- SetPlayerHealth
- GetPlayerHealth
- SetPlayerArmor
- GetPlayerArmor
- SetPlayerRespawnTime
- GetPlayerRespawnTime
- GetPlayerIP
- GetPlayerPing
- KickPlayer
- GetPlayerLocale
- GetPlayerGUID
- GetPlayerGameVersion
- SetPlayerAnimation
- AttachPlayerParachute
- SetPlayerHeadSize
- GetPlayerHeadSize