Try this:
pawn Код:
if (!strcmp(cmdtext, "/kill", true))
{
new string[34];
GetPlayerName(playerid, string, 24);
SetPlayerHealth(playerid, 0.0);
format(string, 34, "%s has died.", string);
SendClientMessageToAll(0xFFFFFFFF, string);
return true;
}
WeeDarr:
1) You do not need to determin how many cells to use for "/kill", and even if you did, 10 is a bit much.
2) Both strcmp and OnPlayerCommandText are meant to return boolean values, so why state one in strcmp but then return a standard integer?
3) You don't need both pName and string....
4) Why are you creating string with 48 cells, as when formatting it you could only ever use up to 34.
5) When getting the player's name, why are you using sizeof(pName) instead of just MAX_PLAYER_NAME or even the value of MAX_PLAYER_NAME which is 24. There is no point in making it work out the size when you can just simply state it instead.
6) The same goes for string, even though you don't need both pName and string you do have both and you are then working out the string size, when again you can just state it.
7) When setting the player's health, please follow the criteria of the parameters. The health part requests a float and you are giving it an integer just simply because it works. You shouldn't do that, in this example it will work. But in other languages or even in different situations in pawn you will not do yourself favours by stating integers instead of floats. It just so happens that in this case the integer is changed into a float of the same value upon usage.
8.) Learn to indent your code.
9) Not a scripting issue, but you are saying the player has died and then setting the health, surely it would be logical to make sure the player had died before telling people he had

.