SA-MP Forums Archive
Scripting /kill command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Scripting /kill command (/showthread.php?tid=338549)



Scripting /kill command - MichaelProPlayer - 30.04.2012

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)


Re: Scripting /kill command - iggy1 - 30.04.2012

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.


Re: Scripting /kill command - sniperwars - 30.04.2012

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;
}