MSGBOX Dialog
#1

Hello, im trying to make a msgbox dialog which shows info about player, so now i have everything coded, but when i writing /info it shows just last line of my player info. Here is my code:
Код:
if(!strcmp(cmdtext, "/info", true,5))
		{
		new msg[128];
		new Float:thealth, Float:armo;  // HP / ARMOUR
		GetPlayerHealth(playerid,thealth);
		GetPlayerArmour(playerid,armo);
		new litair, litaib, litain; // rankose, banke, namie
		litair = playerDB[playerid][pinigai];
		litaib = playerDB[playerid][banke];
		litain = playerDB[playerid][namuose];
		new zolex = playerDB[playerid][zole];
		new wlevel = GetPlayerWantedLevel(playerid); // staaaarzz
		format(msg, 128, "Gyvybiu: %i Sarvu: %i\n", floatround(thealth), floatround(armo));
		SendClientMessage(playerid, WHITE, msg);
		format(msg, 128, "Rankose turite: %i Lt\n", litair);
		SendClientMessage(playerid, YELLOW, msg);
		format(msg, 128, "Banko saskaitoje turite: %i Lt\n", litaib);
		SendClientMessage(playerid, YELLOW, msg);
		if(litain > 0)
		{
		format(msg, 128, "Namuose turite: %i Lt\n", litain);
		SendClientMessage(playerid, YELLOW, msg);
		}
		format(msg, 128, "Turite %i gramu zoles\n", zolex);
		SendClientMessage(playerid, GREEN, msg);
		format(msg, 128, "Turite %i zvaigzduciu*\n", wlevel);
		SendClientMessage(playerid, BLUE, msg);
		ShowPlayerDialog(playerid, 1997, DIALOG_STYLE_MSGBOX,"Info apie tave", msg, "Gerai", "Iseiti");
	return 1;
	}
It shows just Turite %i zvaigzduciu* But why?
Reply
#2

You formatted the same string many times with different values...
pawn Код:
if(strcmp(cmdtext, "/info", true) == 0) {
    new
        msg[150], litair, litaib, litain, Float:thealth, Float:armo;  
    GetPlayerHealth(playerid,thealth);
    GetPlayerArmour(playerid,armo);
    litair = playerDB[playerid][pinigai];
    litaib = playerDB[playerid][banke];
    litain = playerDB[playerid][namuose];
    new zolex = playerDB[playerid][zole];
    new wlevel = GetPlayerWantedLevel(playerid);
    format(msg, sizeof msg, "Gyvybiu: %i Sarvu: %i\n\rRankose turite: %i Lt\n\rBanko saskaitoje turite: %i Lt\n\rNamuose turite: %i Lt\n\rTurite %i gramu zoles\n\rTurite %i zvaigzduciu*", floatround(thealth), floatround(armo), litair, litaib, litain, zolex, wlevel);
    ShowPlayerDialog(playerid, 1997, DIALOG_STYLE_MSGBOX,"Info apie tave", msg, "Gerai", "Iseiti");
}
return true;
Reply
#3

Thank you, next time i will know
Reply
#4

But how i can colorize it? Its like first line red, second line yellow ant etc? I tried in this:
Код:
format(msg, sizeof msg, "Gyvybiu: %i Sarvu: %i\n\rRankose turite: %i Lt\n\rBanko saskaitoje turite: %i Lt\n\rNamuose turite: %i Lt\n\rTurite %i gramu zoles\n\rTurite %i zvaigzduciu*", floatround(thealth), floatround(armo), litair, litaib, litain, zolex, wlevel);
To make before line ~r~ or ~y~
But in game it shows this: ~r~Gyvybiu: ... Sarvu: ... Without color.

EDIT: Never mind, now i know...
Reply
#5

Quote:
Originally Posted by Daslee
Посмотреть сообщение
But how i can colorize it? Its like first line red, second line yellow ant etc? I tried in this:
Код:
format(msg, sizeof msg, "Gyvybiu: %i Sarvu: %i\n\rRankose turite: %i Lt\n\rBanko saskaitoje turite: %i Lt\n\rNamuose turite: %i Lt\n\rTurite %i gramu zoles\n\rTurite %i zvaigzduciu*", floatround(thealth), floatround(armo), litair, litaib, litain, zolex, wlevel);
To make before line ~r~ or ~y~
But in game it shows this: ~r~Gyvybiu: ... Sarvu: ... Without color.

EDIT: Never mind, now i know...
#define COLOR_RED 0xAA3333AA take 6 characters from this color code "AA3333" than add it like: "{AA3333}Gyvybiu: {other color}Sarvu:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)