SA-MP Forums Archive
String problem ><" - 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 problem ><" (/showthread.php?tid=397245)



String problem ><" - Feastahashi - 04.12.2012

I give Rep., please, help me !


Hey guys, what's wrong here, please? '-'

Код:
new GlobalString[200][200];

new FlightPlace[][] =
{
	"zhou test xp xp xp xp",
	"zhau test xp xp xp xp,
	"zhiu test  xp xp xp xp",
	"zhxu test xp xp xp xp",
};

public OnZBCDayChange()
{

	if(GetDay() == ZBC_MONDAY)
	{
	    new FD = random(MAX_FLIGHTS_PER_AIRPORT);
	    
	    new x = 0;
	    for(; x < FD; ++x)
	    {
	        new FP = random(sizeof(FlightPlace));
	        format(GlobalString[0], sizeof(GlobalString), "%s\n", FP);
	        strcat(GlobalString[1], GlobalString[0]);
		}
	}

	return 1;
}
The dialog box:

Код:
case 0:	ShowPlayerDialog(playerid, xieng_dialog, DIALOG_STYLE_MSGBOX, "Flight information", GlobalString[1], "Ok", "");
Now how it's shown:



Uploaded with ImageShack.us


Re: String problem ><" - Nordic - 04.12.2012

FP is not a string


Re: String problem ><" - Feastahashi - 04.12.2012

So how do I put correctly?


Re: String problem ><" - dr.lozer - 04.12.2012

I think this will work

pawn Код:
new GlobalString[200][200];

new FlightPlace[][] =
{
    "zhou test xp xp xp xp",
    "zhau test xp xp xp xp,
    "
zhiu test  xp xp xp xp",
    "
zhxu test xp xp xp xp",
};

public OnZBCDayChange()
{

    if(GetDay() == ZBC_MONDAY)
    {
        new FD = random(MAX_FLIGHTS_PER_AIRPORT);
       
        new x = 0;
        for(; x < FD; ++x)
        {
            new FP = random(sizeof(FlightPlace));
            format(GlobalString[0], sizeof(GlobalString), "
%s\n", FilghtPlace[FP][0]); // or put it x inplace of 0
            strcat(GlobalString[1], GlobalString[0]);
        }
    }

    return 1;
}



Re: String problem ><" - cosbraa - 04.12.2012

format(GlobalString[0], sizeof(GlobalString), "%s\n", FlightPlace[FP]);


Re: String problem ><" - Feastahashi - 04.12.2012

Thank, Guys, I got this working fully well. Just now need to change string's size .