Scripting /kill command
#1

Hello can someone help me with this..I know how to create /kill cmd but I want to SendClientMessage to all that (name) has commited a sucide.

Example : My name is Michael and i used /kill then others will get a message that (Michael has commited a sucide)
Reply
#2

In your kill command.

pawn Код:
new szStr[ 64 ];

GetPlayerName( playerid, szStr, MAX_PLAYER_NAME );

format( szStr, sizeof( szStr ), "Player %s has commited suicide.", szStr ); // %s will be replaced by "playerids" name.

SendClientMessageToAll( -1, szStr );// -1 is the color white change to your favorite col!
Look up "format" on sa-mp wiki.
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     new string[128];
     new pName[MAX_PLAYER_NAME];
     GetPlayerName(playerid, pName, sizeof(pName));

     if(strcmp(cmdtext, "/kill", true, 10) == 0)
     {
        GetPlayerName(playerid, pName, sizeof(pName));
        format(string, sizeof(string), "%s has committed suicide!", pName);
        SendClientMessageToAll(COLOR_RED, string);
        return 1;
     }
     return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)