PDA

View Full Version : name color


Another1
23/10/2013, 02:05 AM
i have this code but when i go to the server and click on color my name still white didnt changed

CMD:color(playerid,pramas[])
{
ShowPlayerDialog(playerid, 12, DIALOG_STYLE_LIST,"Colors","Pink\nGrey","Ok","Close");
return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{

if(dialogid == 12)
{

if(response)
{

switch (listitem)
{
case 0:
{
SetPlayerColor(playerid, 0xFFADADAA);
}

case 1:
{
SetPlayerColor(playerid, 0xBFBFBFAA);
}
}
}
}

return 1;
}

[CG]Milito
23/10/2013, 02:24 AM
Try like this:

At the top of your script
#define COLOR_PINK 0xFF0080FF
#define COLOR_GREY 0xAFAFAFAA


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 12)
{
if(response)
{
switch (listitem)
{
case 0:
{
SetPlayerColor(playerid, COLOR_PINK);
}
case 1:
{
SetPlayerColor(playerid, COLOR_GREY);
}
}
}
}
return 1;
}

Matnix
23/10/2013, 03:09 AM
Using dialog for a simple thing like that... I suggest you to use this method (by command).


CMD:changecolor(playerid,params[])
{
if(sscanf(params,"s[16]", params))
{
// he forgot to add the color he only type : /changecolor
return 1;
}
if(!strcmp(params,"pink",true)) // if he type /changecolor pink
{
// set his color to pink
return 1;
}
if(!strcmp(params,"blue",true)) // if he type /changecolor blue
{
// set his color to blue
return 1;
} // etc..
return 1;
}