How to....Object in front of player - 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: How to....Object in front of player (
/showthread.php?tid=479851)
Deleted. -
iFiras - 07.12.2013
Deleted.
Deleted. -
iFiras - 07.12.2013
Deleted.
Re: How to....Object in front of player -
Hansrutger - 07.12.2013
https://sampwiki.blast.hk/wiki/AttachObjectToPlayer
Код:
new myobject;
myobject = CreateObject(19341, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToPlayer(myobject, playerid, 1.5, 0.5, 0.0, 0.0, 1.5, 2);
Copied from the link. And if you want to add it at a certain time you should put the "new myobject" as global, "myobject = Crea..." in OnGameModeInit and the "Attach..." when you want the object to be placed. Also change the "playerid" part to the right id of the player.
Re: How to....Object in front of player -
Konstantinos - 07.12.2013
****** wrote GetXYInFrontOfPlayer. Just get the player's position (for the z - height), then use the function to get the x and y for the range of 0.5 and create the object at the x, y and z - 1.0
Deleted. -
iFiras - 08.12.2013
Deleted.
Deleted. -
iFiras - 08.12.2013
Deleted.
Re: How to....Object in front of player -
Roel - 08.12.2013
Quote:
Originally Posted by iFiras
It's like this in code, but it's not in front of player when i tested in-game, please someone give me working code
pawn Код:
GetPlayerPos(playerid,Xp,Yp,Zp); GetXYInFrontOfPlayer(playerid,Xp,Yp,0.5); ROBBERYSAFE = CreateObject(1829,Xp-0.5, Yp+0.5, Zp-0.5,0,0,0);
|
I think you shouldn't add those 0.5 at the createobject.
So just use it like this:
pawn Код:
GetPlayerPos(playerid,Xp,Yp,Zp);
GetXYInFrontOfPlayer(playerid,Xp,Yp,0.5);
ROBBERYSAFE = CreateObject(1829,Xp, Yp, Zp-1.0,0,0,0);
But im not sure, since I never used this function, but it seems logical
Deleted. -
iFiras - 08.12.2013
Deleted.
Deleted. -
iFiras - 08.12.2013
Deleted.
Deleted. -
iFiras - 08.12.2013
Deleted.