SA-MP Forums Archive
turn pirate ship - 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: turn pirate ship (/showthread.php?tid=69373)



turn pirate ship - keessie - 17.03.2009

hello

my english isn't good i hope you can understand :P
i'm making a script for the pirate ship
i wan't to turn it and then go forward in the turned position.
i've made this
Код:
	if(strcmp(cmdtext,"/forward1",true)==0)
		{
		if(GetObjectRot(schip,RotX,RotY,RotZ)==0)
 		GetObjectPos(schip, x, y, z);
		MoveObject(schip, x, y+99999, z, 3);
		if(GetObjectRot(schip,RotX,RotY,RotZ)==45)
 		GetObjectPos(schip, x, y, z);
		MoveObject(schip, x-99999, y+99999, z, 3);
		if(GetObjectRot(schip,RotX,RotY,RotZ)==90)
 		GetObjectPos(schip, x, y, z);
		MoveObject(schip, x-99999, y, z, 3);
		if(GetObjectRot(schip,RotX,RotY,RotZ)==135)
 		GetObjectPos(schip, x, y, z);
		MoveObject(schip, x+99999, y-99999, z, 3);
		if(GetObjectRot(schip,RotX,RotY,RotZ)==180)
 		GetObjectPos(schip, x, y, z);
		MoveObject(schip, x, y-99999, z, 3);
		return 1;
	}
but the ==0 must be for RotZ
i think that the code isn't good
only if RotZ is 0 or 45 or 90 the ship has to go forward

i hope you understand my question

grz


Re: turn pirate ship - Weirdosport - 17.03.2009

if(GetObjectRot(schip,RotX,RotY,RotZ)==0)

Makes no sense.

If you want to check if RotZ == 0, you need:

pawn Код:
GetObjectRot(schip,RotX,RotY,RotZ);
if(RotZ == 0)
   {
   // stuff
   }



Re: turn pirate ship - Dujma - 17.03.2009

Quote:
Originally Posted by Weirdosport
if(GetObjectRot(schip,RotX,RotY,RotZ)==0)

Makes no sense.

If you want to check if RotZ == 0, you need:

pawn Код:
GetObjectRot(schip,RotX,RotY,RotZ);
if(RotZ == 0)
  {
  // stuff
  }
Rotations are floats?


Re: turn pirate ship - Google63 - 17.03.2009

Yes... Check wiki

Here is params from wiki if you do not trust me:
Quote:

GetObjectRot

Parameters:
(objectid, &Float:RotX, &Float:RotY, &Float:RotZ)




Re: turn pirate ship - keessie - 18.03.2009

ok thanx i will try


Re: turn pirate ship - maij - 18.03.2009

what i did is attached that ship to a vehicle, simply with attachobject to player, and onplayervehicle enter
en onplayervehicleexit

trust me this is fun, i made it cuz ma brotha showed me a vid on ******* where they had that aswell