How to do this the correct way?
#1

Hello,

This is an example and is wrong code, Does anyone know the correct way?

pawn Код:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Player Stats", "Name: %s \nScore: %i \n", "Ok", "Cancel", name, GetPlayerScore(playerid));
Reply
#2

You can't use formatted text in strings
Reply
#3

Cant you read? XD

Quote:
Originally Posted by Torran
This is an example and is wrong code, Does anyone know the correct way?
Reply
#4

I guess in the dialog you can't use format symbols... you need to save the line in a variable and use the format function.
Reply
#5

Ive seen it before and done it before, I just cant remember how xd
Reply
#6

Код:
new str[128];

format(str, sizeof(str), "Name: %s Score: %i", name, GetPlayerScore(playerid));

ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, str, "Ok", "Cancel");
Dunno Im not that high with dialogs, dont know how to make a new line in format neither
Reply
#7

pawn Код:
#define STATSDIALOG 500 // With all your other defines...

dcmd(stat, 6, cmdtext); // At the other dcmd shizzle

dcmd_stat(playerid, params[]) // This is the command
{
#pragma unused params
new string[256];
new level = PlayerInfo[playerid][pLevel];
new bank = PlayerInfo[playerid][pBank];
new cash = PlayerInfo[playerid][pCash];

format(string, sizeof(string), "Level: %d\nMoney: %d\nBank: %d",level,cash,bank);
ShowPlayerDialog(playerid, STATSDIALOG, DIALOG_STYLE_MSGBOX,"Status", string, "Okay", "Cancel");
return 1;
}
Tell me if you need further help with it, and no the level and money and bank was just to show you how to, just change it out with your own stuff
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)