SA-MP Forums Archive
name color - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: name color (/showthread.php?tid=471427)



name color - Another1 - 23.10.2013

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;
}



Respuesta: name color - [CG]Milito - 23.10.2013

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;
}



Re : name color - Matnix - 23.10.2013

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;
}