String isn't showing correctly
#1

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");
    }
Reply
#2

Try formatting the string Bizname
pawn Код:
format(Bizname, 32, "%s", bInfo[bizin][bizname]);
Reply
#3

Try the above and if you run into any problem debug variables to see if everything is going thru them correctly.
Reply
#4

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
Reply
#5

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");
    }
Reply


Forum Jump:


Users browsing this thread: