String isn't showing correctly - 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: String isn't showing correctly (
/showthread.php?tid=521477)
String isn't showing correctly -
Aerotactics - 23.06.2014
Brief: I want the name of the store to appear at the top of the dialog, but I only see the letter "R," when it's supposed to say "Mike's Mini-Mart." pBizInt is the biz id the player is in.
pawn Код:
new Bizname[32];
new bizin = pInfo[playerid][pBizInt];
Bizname = bInfo[bizin][bizname];
if(IsPlayerInRangeOfPoint(playerid,3,-29.2120,-185.1284,1003.5469)) //24/7
{
ShowPlayerDialog(playerid,DIALOG_247,DIALOG_STYLE_LIST,Bizname,"Cell Phone\nPhonebook\nNew Phone Number","Select","Cancel");
}
Re: String isn't showing correctly -
kamiliuxliuxliux - 23.06.2014
Try formatting the string Bizname
pawn Код:
format(Bizname, 32, "%s", bInfo[bizin][bizname]);
Re: String isn't showing correctly -
Cypress - 23.06.2014
Try the above and if you run into any problem debug variables to see if everything is going thru them correctly.
Re: String isn't showing correctly -
Jack_Leslie - 23.06.2014
Remove Bizname and just use bInfo[bizin][bizname] in the show dialog code.
If bInfo[bizin][bizname] is a string, which I assume it is, and should be if you're storing a name in it, you can just use it raw.
For future reference, you also can't do:
pawn Код:
Bizname = bInfo[bizin][bizname];
That's for floats or intergers.
Do as above says, and do
pawn Код:
format(Bizname, sizeof(Bizname), bInfo[bizin][bizname]); // No need to do '%s' as bizname should be a string
Re: String isn't showing correctly -
Aerotactics - 23.06.2014
This way worked, sorry for the inconvenience. Idk why I didn't think this way at first. I must be too tired to script.
pawn Код:
new bizin = pInfo[playerid][pBizInt];
if(IsPlayerInRangeOfPoint(playerid,3,-29.2120,-185.1284,1003.5469)) //24/7
{
ShowPlayerDialog(playerid,DIALOG_247,DIALOG_STYLE_LIST,bInfo[bizin][bizname],"Cell Phone\nPhonebook\nNew Phone Number","Select","Cancel");
}