How to do this the correct way? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to do this the correct way? (
/showthread.php?tid=129624)
How to do this the correct way? -
Torran - 22.02.2010
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));
Re: How to do this the correct way? -
bajskorv123 - 22.02.2010
You can't use formatted text in strings
Re: How to do this the correct way? -
Torran - 22.02.2010
Cant you read? XD
Quote:
Originally Posted by Torran
This is an example and is wrong code, Does anyone know the correct way?
|
Re: How to do this the correct way? -
silvan - 22.02.2010
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.
Re: How to do this the correct way? -
Torran - 22.02.2010
Ive seen it before and done it before, I just cant remember how xd
Re: How to do this the correct way? -
bajskorv123 - 22.02.2010
Код:
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
Re: How to do this the correct way? -
Johndaone - 22.02.2010
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