28.10.2012, 17:22
Put this command inside of the callback (OnPlayerCommandText):
And for the /cmds command do you want it with a dialog or normal text?
Now your callback should look like this:
PHP код:
if (strcmp("/kill", cmdtext, true, 5) == 0)
{
SetPlayerHealth(playerid, 0);//Setting the player's health to 0 which will kill him.
SendClientMessage(playerid, -1, "You have committed suicide!");//Sending him a message.
return 1;
}
Now your callback should look like this:
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/tpme", cmdtext, true, 5) == 0)
{
SetPlayerInterior(playerid, 15);
SetPlayerPos(playerid, 2220.26, -1148.01, 1025.80);
SendClientMessage(playerid, -1, "Teleported!");
return 1;
}
if(strcmp("/getmeout", cmdtext, true, 9) == 0)
{
SetPlayerInterior(playerid, 0);
SetPlayerHealth(playerid, 0);
SendClientMessage(playerid,-1, "Done...");
}
if (strcmp("/kill", cmdtext, true, 5) == 0)
{
SetPlayerHealth(playerid, 0);//Setting the player's health to 0 which will kill him.
SendClientMessage(playerid, -1, "You have committed suicide!");//Sending him a message.
return 1;
}
return 0;
}