KillPlayer

From Multi Theft Auto: Wiki
Revision as of 00:32, 16 August 2006 by EAi (talk | contribs)
Jump to navigation Jump to search
Dialog-information.png This article needs checking.

Reason(s): According to the proposed functions this should have an optional arguments for killer and weapon

This function kills the specified player. It returns a boolean value (true or false) depending on whether the function passed or failed.

Syntax

bool killPlayer ( player thePlayer, [ player theKiller = NULL, int weapon = 255, int bodyPart = 255 ] )

Required Arguments

  • thePlayer: A player object referencing the specified player.

Optional Arguments

  • theKiller: The player who killed the player
  • weapon: The ID of the weapon that should appear to have killed the player (doesn't affect how they die)
  • bodyPart: The ID of the body part that should appear to have been hit by the weapon (doesn't affect how they die)

Returns

Returns true if the player was killed, false if the player specified could not be killed or is invalid.

Example

-- Get the player with an ID of 1
player = getPlayerFromID ( 1 )
-- If a player was found with an ID of 1 then
if ( player )
	-- Kill the player
	if ( killPlayer ( player ) ) then
		-- Inform everyone that they were killed.
		outputChatBox ( ( getPlayerName ( player ), " was eliminated." ) )
	end
end

See Also