[solved]Some problem with Angels.
#1

Hi.
This is my script and it is inside a timer so when a player requesting class his angel will be moved. But my problem is that his Angel only movves once and then nothing more. Like from angel 0 to 90 and than it stops. Could anyone help me solve this script, thanks
pawn Код:
GetPlayerFacingAngle(playerid,Angel);
if(Angel == 0.0){
SetPlayerFacingAngle(playerid,90.0);
return 1;
}
else if(Angel == 90.0){
SetPlayerFacingAngle(playerid,180.0);
return 1;
}
else if(Angel == 180.0){
SetPlayerFacingAngle(playerid,270.0);
return 1;
}
else if(Angel == 270.0){
SetPlayerFacingAngle(playerid,360.0);
return 1;
}
else if(Angel == 360.0){
SetPlayerFacingAngle(playerid,0.0);
return 1;
}
Reply
#2

is Angel a float?
Reply
#3

Quote:
Originally Posted by [ST
Рυтўнвαѕ ]
is Angel a float?
Yes.
pawn Код:
new Float:Angel;
Reply
#4

may i suggest you another solution?
Код:
	new Float:Angel;
	GetPlayerFacingAngle(playerid,Angel);
	SetPlayerFacingAngle(playerid,Angel-20);
	new string[32];
	format(string,sizeof(string),"Angle: %f",Angel);
	SendClientMessage(playerid,0xffffff,string);
	return 1;
i tested it with a simple command, working in both directions...
imo your idea is neat, so i'll include it aswell
Reply
#5

or i changed to it
Код:
GetPlayerFacingAngle(playerid,Angel);
if(Angel >= 0.0 && Angel <= 89.9){
SetPlayerFacingAngle(playerid,90.0);
return 1;
}
else if(Angel >= 90.0 && Angel <= 179.9){
SetPlayerFacingAngle(playerid,180.0);
return 1;
}
else if(Angel >= 180.0 && Angel <= 269.9){
SetPlayerFacingAngle(playerid,270.0);
return 1;
}
else if(Angel >= 270.0 && Angel <= 359.9){
SetPlayerFacingAngle(playerid,360.0);
return 1;
}
else if(Angel == 360.0){
SetPlayerFacingAngle(playerid,0.0);
return 1;
}


try now i hope it work...
Reply
#6

Yah the problem with (Angel == 0.0).
Is that its almost never exactly 0.0 but something like 0.0000000343......
Reply
#7

because this i posted my edit LOL
Reply
#8

I tested the script DarK_TeaM PT just did and it got same problem. At Angel 90.0 it stops continue.
Reply
#9

is the timer repeating? :P
Reply
#10

So this makes you turn by 90 degrees?
pawn Код:
new Float:a;
GetPlayerFacingAngle(playerid,a);
a+=90;
if(a>=360)a-=360;
SetPlayerFacingAngle(playerid,a);
That will make them turn 90 degrees everytime.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)