name color
#1

i have this code but when i go to the server and click on color my name still white didnt changed

Code:
CMD:color(playerid,pramas[])
{
  ShowPlayerDialog(playerid, 12, DIALOG_STYLE_LIST,"Colors","Pink\nGrey","Ok","Close");
  return 1;
}
Code:
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;
}
Reply
#2

Try like this:

At the top of your script
pawn Code:
#define COLOR_PINK 0xFF0080FF
#define COLOR_GREY 0xAFAFAFAA
pawn Code:
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;
}
Reply
#3

Using dialog for a simple thing like that... I suggest you to use this method (by command).

pawn Code:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)