ShowPlayerDialog getting weird
#1

I am trying to show a Dialog box. It works well until some point.

PHP код:
format(textsizeof(text), "Setting\tInformation\nStatus\tCivilian\nPM\t%d\nMusic\t%d\nCar HUD\t%d\nHit Effect Sound\tOFF"Player[playerid][playerPmStatus], Player[playerid][playerMusic], vstatus[2]);
    
strreplace(text"1""{33AA33}ON");
    
strreplace(text"0""{AA3333}OFF");
    
format(text2sizeof(text2), "\nPM Color Code\t{%s}%s\nNotification Color Code\t{%s}%s"Player[playerid][playerPMColor], Player[playerid][playerPMColor], Player[playerid][playerNotificationColor], Player[playerid][playerNotificationColor]);
    
strcat(texttext2);
    
ShowPlayerDialog(playeridDIALOG_SETTINGSDIALOG_STYLE_TABLIST_HEADERS"Settings"text"Select""Cancel"); 
If I remove the second part (that is the notification color part), then it works perfectly fine for the PM Color part, but as soon as I add that, it starts getting weird. I want the color to show and it must be in the same color (which works if I remove the last list item).

Screenshot:
Reply
#2

This is urgent. Anyone?
Reply
#3

I've used this code:
Код:
CMD:test(playerid)
{
    new text[300] = "Setting\tInformation\nStatus\tCivilian\nPM\t{33AA33}ON\nMusic\t{33AA33}ON\nCar HUD\t{33AA33}ON\nHit Effect Sound\t{33AA33}ON";
    new text2[128] = "\nPM Color Code\t{00FF00}00FF00\nNotification Color Code\t{FF0000}FF0000";
    strcat(text, text2);
    ShowPlayerDialog(playerid, DIALOG_DUMMY, DIALOG_STYLE_TABLIST_HEADERS, "Settings", text, "Select", "Cancel");  
    return 1;
}
To try and replicate your problem, and this is the result I got:


So it looks that everything is working fine.
I can see that you are outputting {AFFFFFF} which isn't a valid embedded RGB color in SAMP (7 digits), that may be your problem. I'd rather store the users PM color as an integer value by converting the hex string to int and simply using {%06x} in format()
Reply
#4

Quote:
Originally Posted by dotSILENT
Посмотреть сообщение
I've used this code:
Код:
CMD:test(playerid)
{
    new text[300] = "Setting\tInformation\nStatus\tCivilian\nPM\t{33AA33}ON\nMusic\t{33AA33}ON\nCar HUD\t{33AA33}ON\nHit Effect Sound\t{33AA33}ON";
    new text2[128] = "\nPM Color Code\t{00FF00}00FF00\nNotification Color Code\t{FF0000}FF0000";
    strcat(text, text2);
    ShowPlayerDialog(playerid, DIALOG_DUMMY, DIALOG_STYLE_TABLIST_HEADERS, "Settings", text, "Select", "Cancel");  
    return 1;
}
To try and replicate your problem, and this is the result I got:


So it looks that everything is working fine.
I can see that you are outputting {AFFFFFF} which isn't a valid embedded RGB color in SAMP (7 digits), that may be your problem. I'd rather store the users PM color as an integer value by converting the hex string to int and simply using {%06x} in format()
Hard coding colors like this is working. But I am trying to fetch the value from MySQL and using variables which is not working. I tried what you said.

I stored the value as integer and on format, I did {%06x}.
Reply
#5

If hardcoding works, then it's not any SAMP limitation or bug, that's why I tried it with hardcoded colors.
Your formatting code is just bad.
If you allow the player to type in their custom hex color:
https://sampwiki.blast.hk/wiki/Colors_List
Grab the HexToInt function
Store the color field in database as integer, and in Pawn too
When the player inputs his color, do color = HexToInt(inputtext)
When formatting the dialog, use "{%06x}", color
It has to work.
Reply
#6

Quote:
Originally Posted by dotSILENT
Посмотреть сообщение
If hardcoding works, then it's not any SAMP limitation or bug, that's why I tried it with hardcoded colors.
Your formatting code is just bad.
If you allow the player to type in their custom hex color:
https://sampwiki.blast.hk/wiki/Colors_List
Grab the HexToInt function
Store the color field in database as integer, and in Pawn too
When the player inputs his color, do color = HexToInt(inputtext)
When formatting the dialog, use "{%06x}", color
It has to work.
Thanks. All that you said worked well, but the alpha values were showing (ex 33CCFFAA). I had to do it like this

PHP код:
Player[playerid][playerPMColor] >>> 
And this worked perfectly fine.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)