SA-MP Forums Archive
is there something wrong with my pawno? - 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: is there something wrong with my pawno? (/showthread.php?tid=65935)



is there something wrong with my pawno? - ғαιιοцт - 17.02.2009

i did this as an example:
i went ingame, and 'angle' (see code below) was 60.0
pawno does:
Код:
format(text, sizeof text, "angle = %f", angle);
and says: angle = 60
ok everything works

then i calculated (with my own calculator and not pawno) the Px2 where the player will be placed:

cos(60)*1 = 0.5 //(because distance was 1.0)
0.5+0.0 = 0.5 //(because "x" was 0.0)

so Px2 should be 0.5
if pawno calculates it, Px2 is -0.88 -_-

wtf
what's wrong with this?

this is the code:
Код:
	new text[64];
	format(text, sizeof text, "angle = %f", angle);
	SendClientMessage(playerid, 0xFF3399AA, text);

	new Float:Px2, Float:Py2;
	Px2 = floatmul(floatcos(angle), distance);
	Py2 = floatmul(floatsin(angle), distance);

	if (Px > x && Py > y) //1
	{
		Px2 = floatadd(x, Px2);
		Py2 = floatadd(y, Py2);
		SendClientMessage(playerid, 0xFF3399AA, "1");
	}
	else if (Px <= x && Py >= y) //2
	{
		Px2 = floatsub(x, Px2);
		Py2 = floatadd(y, Py2);
		SendClientMessage(playerid, 0xFF3399AA, "2");
	}
	else if (Px >= x && Py <= y) //3
	{
		Px2 = floatadd(x, Px2);
		Py2 = floatsub(y, Py2);
		SendClientMessage(playerid, 0xFF3399AA, "3");
	}
	else if (Px < x && Py < y) //4
	{
		Px2 = floatsub(x, Px2);
		Py2 = floatsub(y, Py2);
		SendClientMessage(playerid, 0xFF3399AA, "4");
	}

	format(text, sizeof text, "Px2 = %f | Py2 = %f", Px2, Py2);
	SendClientMessage(playerid, 0xFF3399AA, text);

	SetPlayerPos(playerid, Px2, Py2, Pz);



Re: is there something wrong with my pawno? - yom - 17.02.2009

-oups-


Re: is there something wrong with my pawno? - ғαιιοцт - 17.02.2009

Quote:
Originally Posted by 0rb
English please
huh?


Re: is there something wrong with my pawno? - Kanji_Suzuki - 17.02.2009

Quote:
Originally Posted by 0rb
English please
that is engish lol xD + i have no idea why


Re: is there something wrong with my pawno? - ғαιιοцт - 17.02.2009

Quote:
Originally Posted by 0rb
-oups-
it's ok

ps it's fixed -> i had to toggle to degrees instead of radians