COMMAND:color_green(playerid, params[])
{
SetPlayerColor(playerid, 0x33AA33AA);
SendClientMessage(playerid, 0x33AA33AA, "Your Name Has Changed To Green");
return 1;
}
COMMAND:color_green(playerid, params[]) { if(IsPlayerConnected(playerid)) { SetPlayerColor(playerid, 0x33AA33AA); SendClientMessage(playerid, 0x33AA33AA, "Your Name Has Changed To Green"); } return 1; }
COMMAND:colorgreen(playerid, params[]) { SetPlayerColor(playerid, 0x33AA33AA); SendClientMessage(playerid, 0x33AA33AA, "Your Name Has Changed To Green"); return 1; }
The code is wrong.it's not going to work with _ in the command.
Code:
COMMAND:colorgreen(playerid, params[]) { SetPlayerColor(playerid, 0x33AA33AA); SendClientMessage(playerid, 0x33AA33AA, "Your Name Has Changed To Green"); return 1; } |
Oh thats why. Thanks but is there any way to do like /color green other than Onplayercommandtext?
|
CMD:color(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, 0xCC0000AA, "Valid colors: green, red, blue");
new tmp[10];
if(!strcmp(params, "green", true))
{
SetPlayerColor(playerid, 0x33AA33AA);
tmp="green";
}
else if(!strcmp(params, "red", true))
{
SetPlayerColor(playerid, 0xFF0000AA);
tmp="red";
}
else if(!strcmp(params, "blue", true))
{
SetPlayerColor(playerid, 0x0000FFAA);
tmp="blue";
}
//and so on
new string[100];
format(string, sizeof(string), "You set your color to %s", tmp);
SendClientMessage(playerid, 0xCCCC00AA, string);
return 1;
}