[TUT] Dialog List (Cores)

public OnPlayerCommandText

if(strcmp(cmdtext,"/mudarcor", true) == 0)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Escolha uma cor!", "Vermelho\nVerde\nAmarelo\nAzul\nLaranja\nRoxo\nAzul Marinho\nRosa\nCinza\nMarrom\nBranco\nAzul Claro\nVerde Escuro", "Ok", "Cancelar");
return 1;
}

Em
public OnDialogResponse

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2)
{
if(response)
{
if(listitem == 0)
{
SetPlayerColor(playerid, COLOR_ROJO);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
}
if(listitem == 1)
{
SetPlayerColor(playerid, COLOR_VERDE_CLARO);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 2)
{
SetPlayerColor(playerid, COLOR_AMARILLO);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 3)
{
SetPlayerColor(playerid, COLOR_AZULCLARO);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 4)
{
SetPlayerColor(playerid, COLOR_NARANJA);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 5)
{
SetPlayerColor(playerid, COLOR_ROSA);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 6)
{
SetPlayerColor(playerid, COLOR_AZUL);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 7)
{
SetPlayerColor(playerid, COLOR_ROSADO);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 8)
{
SetPlayerColor(playerid, COLOR_GRIS);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 9)
{
SetPlayerColor(playerid, COLOR_CACA);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 10)
{
SetPlayerColor(playerid, BLANCO);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 11)
{
SetPlayerColor(playerid, COLOR_CELESTE);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
if(listitem == 12)
{
SetPlayerColor(playerid, COLOR_VERDEOSCURO);
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[128];
format(string, sizeof(string), "%s Trocou a cor do Nick (/mudarcor)", sendername);
SendClientMessageToAll(COLOR_VERDE_CLARO, string);
}
}
return 1;
}

Explicação:

if(strcmp(cmdtext,"/mudarcor", true) == 0) -> Comando
SendClientMessageToAll -> Envia Mensagem a Todos
new string[128]; -> Define Numero de Strings (Caracteres qque Envia o texto)
format -> Formato de Como Envia a String
GetPlayerName -> Pega Nome do Player para Enviar
SetPlayerColor -> Mudar cor do Player
ShowPlayerDialog -> Mostra Dialog
DIALOG_STYLE_LIST -> Dialog Estilo Lista
\n -> Pula Linhas
'}' e '{' -> Fecha a Abre Códigos
playerid, 2 -> Numero da Dialog nnunca pode haver dialogs com n° iguais

StumbleDiggTechnoratiRedditDelicious