Creating a object infront of you. - 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: Creating a object infront of you. (
/showthread.php?tid=102452)
Creating a object infront of you. -
Sal_Kings - 15.10.2009
The title says it all.
Can someone please show me how to type a command that creates a item infront of you, is there a tutorial for this?
Well, i am going to use it for this /plantbomb script i will make.
Re: Creating a object infront of you. -
Jefff - 15.10.2009
Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if (GetPlayerVehicleID(playerid)) {
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
Re: Creating a object infront of you. -
Donny_k - 15.10.2009
pawn Код:
CreateObjectInfrontOfPlayer( playerid, modelid, Float:distance = 10.0, Float:rx = 0.0, Float:ry = 0.0 )
{
new
Float:x,
Float:y,
Float:z;
if ( GetPlayerPos( playerid, x, y, z ) )
{
new
Float:angle,
objectid;
GetPlayerFacingAngle( playerid, angle );
objectid = CreateObject( modelid, x + ( distance * floatsin( -angle, degrees ) ), y + ( distance * floatsin( -angle, degrees ) ), z, rx, ry, angle );
return objectid;
}
return -1;
}