NPC:SendCommand

From SA-MP Wiki

Jump to: navigation, search


NPC:SendCommand was added in SA-MP 0.3a This function was added in SA-MP 0.3a and will not work in earlier versions!


Description:

This will force the NPC to write a desired command, and this way, getting the effects it would produce.


Parameters:
(commandtext[])
commandtext[]The command text to be sent by the NPC.


Return Values:

This function does not return any specific values.


Example Usage:

public OnPlayerText(playerid, text[])
{
    if (strfind(text, "stupid bot") != -1)
    {
        new string[80], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
 
        SendCommand("/kill");
        format(string, sizeof(string), "Hey %s! You are so mean, you make me so sad!", name);
        SendChat(string);
    }
    return 1;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

Personal tools