SendChat: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Welcome|
{{Welcome|
desc=This will send a chat message to the server.|
desc=This function forces the player character to commit suicide in the game.|
params=<syntaxhighlight lang="lua">(text)</syntaxhighlight>
params=<syntaxhighlight lang="lua">
<poem>::text : The text to send as chat message.</poem>|
()</syntaxhighlight>
example=<source lang="lua">
<poem></poem>|
function OnPlayerText(player, message)
example=
The following npc commits suicide if some one textes 'loser' to it.
<source lang="lua">
function OnPlayerText(playerid, message)
{
{
if(message=="Hello")
if(message=="loser")
{
{
SendChat("Hi. How are you?");
Suicide()
}
    }
}</source>|
}
relfuncs=*[[SendCommand]]
</source>|
relfuncs=*[[SetMyHealth]]
*[[RequestClassAbs]]|
returns=* true on success and false on failure (npc not spawned)|
}}
}}

Revision as of 04:02, 6 September 2024


Description:
This function forces the player character to commit suicide in the game.


Parameters:

()


Return Values:
This function does not return any specific values.


Example The following npc commits suicide if some one textes 'loser' to it.

function OnPlayerText(playerid, message)
{
	if(message=="loser")
	{
	Suicide()
    }
}

Related Functions

The following functions may be helpful as they relate to this function in one way or another.