Create Object - 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: Create Object (
/showthread.php?tid=156250)
Create Object -
[DDC]Delight - 21.06.2010
Hello,
I have a question about creating an object behind a player.
I've seen a few stocks, which calculate the position behind a player, but how can I create an object on this position.
Any help would be appreciated,
Re: Create Object -
MadeMan - 21.06.2010
The answer is in your topic's title.
Re: Create Object -
Brian_G - 21.06.2010
EXAMPLE:
CreateObject(3453, 40.427525, 1510.745483, 14.324432, 0.0000, 0.0000, 0.0000);
goes OnGameModeInit , or OnFilterScriptInit.
Re: Create Object -
[DDC]Delight - 21.06.2010
Quote:
Originally Posted by $/Br(iayan||-l+[b|g
)/$ ]
EXAMPLE:
CreateObject(3453, 40.427525, 1510.745483, 14.324432, 0.0000, 0.0000, 0.0000);
goes OnGameModeInit , or OnFilterScriptInit.
|
Let me explain you a tiny bit more..
I want to create an object BEHIND a player
Like if you walk somewhere, type /bomb, you SPAWN a OBJECT, BEHIND a player.
How is this possible?
Re: Create Object -
[DDC]Delight - 21.06.2010
Quote:
Originally Posted by MadeMan
The answer is in your topic's title.
|
This post was completely useless =')
Re: Create Object -
MadeMan - 21.06.2010
You said you already have the position and now you want to create the object.
Well my answer is CreateObject.
https://sampwiki.blast.hk/wiki/CreateObject
Re: Create Object -
Hiddos - 21.06.2010
pawn Код:
new Float:x,Float:y,Float:z,Float:a,Float:X,Float:y;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
X = x + (-2 * floatsin(-a,degrees));
Y = y + (-2 * floatcos(-a,degrees));
CreateObject(16442,X,Y,z,0,0,0); // Creates a cow 2 foot behind you (16442 = cow ID)
Creates it two foot behind him.
Quote:
Originally Posted by MadeMan
|
He said he wanted it to spawn it behind him.
Re: Create Object -
[DDC]Delight - 21.06.2010
Quote:
Originally Posted by Hiddos
pawn Код:
new Float:x,Float:y,Float:z,Float:a,Float:X,Float:y; GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid,a); X = x + (-2 * floatsin(-a,degrees)); Y = y + (-2 * floatcos(-a,degrees)); CreateObject(16442,X,Y,z,0,0,0); // Creates a cow 2 foot behind you (16442 = cow ID)
Creates it two foot behind him.
|
You're the man,
![Cool](images/smilies/cool.gif)
thanks alot for helping me out there
Re: Create Object -
Hiddos - 21.06.2010
Quote:
Originally Posted by Ţأ$jΰв٭Y ★
Quote:
Originally Posted by Hiddos
pawn Код:
new Float:x,Float:y,Float:z,Float:a,Float:X,Float:y; GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid,a); X = x + (-2 * floatsin(-a,degrees)); Y = y + (-2 * floatcos(-a,degrees)); CreateObject(16442,X,Y,z,0,0,0); // Creates a cow 2 foot behind you (16442 = cow ID)
Creates it two foot behind him.
|
You're the man, ![Cool](images/smilies/cool.gif) thanks alot for helping me out there ![Smiley](images/smilies/smile.png)
|
I actually got it from my own script, in which I use this to create explosions in-front of RC Tigers (tanks).
Enjoy it