28.05.2010, 02:16
Quote:
Originally Posted by iRape
Ohhk? You just want to change your players color. (In default chat, the color of yourself will be the same when you talk too)
Simple as this. Код:
if(strcmp(cmd, "/changemycolour", true) == 0) { SetPlayerColor(playerid, CHOOSEACOLOR); } return 1; } |
Here Code Strtok and Command:
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[]) {
new index, cmd[128];
cmd = strtok(cmdtext, index);
if (!strcmp("/color",cmd,true,6)) {
SetPlayerColor(playerid,Color);//COLOR = COLOR
return 1;
}
return 0;
}
//-----------------------------------------
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}