12.02.2009, 07:42
please indent code, this is making it hard to read
Код:
public OnPlayerCommamdText(playerid, cmdtext[])
{
if (strcmp(cmdtext,"/color",true) == 0)
{
// these two lines would do the same as strtok, you can use that if you prefer it!
new params[128];
strmid(params, cmdtext, strfind(cmdtext, " ", true), strlen(params));
if (!strlen(params))
return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /color [color]");
if (strcmp(params, "yellow", true) == 0)
SetPlayerColor(playerid, COLOR_YELLOW);
else if (strcmp(params, "green", true) == 0)
SetPlayerColor(playerid, COLOR_GREEN);
else if (strcmp(params, "red", true) == 0)
SetPlayerColor(playerid, COLOR_RED);
else
SendClientMessage(playerid, COLOR_YELLOW, "What color is that? There's only yellow, green and red in this example");
return 1;
}
}

