wrong printf output
#1

I am trying to get gangzones to show correctly but printing the coords gives me a wrong output:

Код:
[17:05:13] 0:      0.0000, 0.0000, -467.1149, 0.0000
[17:05:13] 1:      0.0000, 0.0000, -11.6778, 23.3557
[17:05:13] 2:      0.0000, 0.0000, 58.3893, 93.4229
This is the array:
Код:
new hq_cds[][coords] = {

	{-548.8602, -58.38938, -467.115, 0.0},
	{-81.74512, -23.35575, -11.67788, 23.35575},
	{-11.67788, 46.7115, 58.38938, 93.423}
};


	for(new xz = 0; xz < sizeof(hq_cds); xz ++)
    {
		printf("%d:      %.4f, %.4f, %.4f, %.4f", hq[xz][zone], hq_cds[xz][minXx], hq_cds[xz][minYy], hq_cds[xz][maxXx], hq_cds[xz][maxYy]);
	}
I am confused why it only prints the last two coords correctly..
Reply
#2

pawn Код:
// Try
new Float:hq_cds[3][5] = {
Reply
#3

That's not the problem...
Reply
#4

Where and how do you specify what each coordinate is called? (minYy, maxYy etc.)
Reply
#5

pawn Код:
enum coords
{
    Float:minXx,
    Float:minYy,
    Float:maxXx,
    Float:maxYy
};

new Float:hq_cds[][coords] =
{
    {-548.8602, -58.38938, -467.115, 0.0},
    {-81.74512, -23.35575, -11.67788, 23.35575},
    {-11.67788, 46.7115, 58.38938, 93.423}
};

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    for(new xz = 0; xz < sizeof(hq_cds); xz ++)
    {
        printf("%d:      %.4f, %.4f, %.4f, %.4f", hq[xz][zone], hq_cds[xz][minXx], hq_cds[xz][minYy], hq_cds[xz][maxXx], hq_cds[xz][maxYy]);
    }
}
Reply
#6

It's used for creating gangzones upon OnGameModeInit();

But because they're not showing correctly I am asking here

Код:
enum coords { Float:minXx, Float:minYy, Float:maxXx, Float:maxYy }

new hq_cds[3][coords] = {

	{-548.8602, -58.38938, -467.115, 0.0},
	{-81.74512, -23.35575, -11.67788, 23.35575},
	{-11.67788, 46.7115, 58.38938, 93.423}
};
Код:
	for(new xz = 0; xz < sizeof(hq_cds); xz ++)
    {
        hq[xz][zone] = GangZoneCreate(hq_cds[xz][minXx], hq_cds[xz][minYy], hq_cds[xz][maxXx], hq_cds[xz][maxYy]);
        
		printf("%d:      %.4f, %.4f, %.4f, %.4f", hq[xz][zone], hq_cds[xz][minXx], hq_cds[xz][minYy], hq_cds[xz][maxXx], hq_cds[xz][maxYy]);
	}
Reply
#7

Actually when I tried it it gave the correct results,
Quote:

[17:37:12] 0: -548.8602, -58.3893, -467.1149, 0.0000
[17:37:12] 1: -81.7451, -23.3557, -11.6778, 23.3557
[17:37:12] 2: -11.6778, 46.7114, 58.3893, 93.4229

test script
http://pastebin.com/tempFg5T
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)