How to....Object in front of player
#1

Deleted.
Reply
#2

Deleted.
Reply
#3

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.
Reply
#4

****** 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
Reply
#5

Deleted.
Reply
#6

Deleted.
Reply
#7

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
Reply
#8

Deleted.
Reply
#9

Deleted.
Reply
#10

Deleted.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)