Nгo querendo desvalorizar o seu trabalho, mas vocк poderia melhorar muito esse sistema. Tornб-lo mais dinвmico (nгo sei se й a expressгo mais adequada).
Veja, tornei seu sistema bem mais fбcil de se editar adicionando ou removendo cores.
pawn Код:
#include <a_samp>
enum E_COLOR_INFO {
colorName[32],
colorHex
}
const DIALOG_COLOR = 1000;
new colorInfo[][E_COLOR_INFO] = {
{"Vermelho", 0xff0000ff},
{"Verde", 0x32cd32ff},
{"Azul", 0x1e90ffff},
{"Amarelo", 0xf6f600ff},
{"Laranja", 0xffa500ff},
{"Rosa", 0xff00ffff},
{"Cinza", 0x696969ff},
{"Branco", 0xffffffff}
};
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
if(dialogid == DIALOG_COLOR) {
if(response) {
new string[64];
format(string, sizeof string, ">> Vocк alterou a cor de seu nick para %s", colorInfo[listitem][colorName]);
SendClientMessage(playerid, colorInfo[listitem][colorHex], string);
SetPlayerColor(playerid, colorInfo[listitem][colorHex]);
}
}
return true;
}
public OnPlayerCommandText(playerid, cmdtext[]) {
if(!strcmp("cornick", cmdtext[1], true)) {
new
string[64],
buffer[11 + ((sizeof colorInfo) * 32)];
for(new i; i < sizeof colorInfo; ++i) {
format(string, sizeof string, "{%x}%s\n", (colorInfo[i][colorHex] >>> 8), colorInfo[i][colorName]);
strcat(buffer, string);
}
ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_LIST, "{ffffff}Alterar cor", buffer, "Alterar", "Cancelar");
return true;
}
return false;
}