Object 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Object front of player (
/showthread.php?tid=186477)
Object front of player -
Dime - 29.10.2010
I was searching and trying to make it but still not working.
Код:
new Float:x,Float:y,Float:z,Float:a,Float:X,Float:Y;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
X = x + (20 * floatsin(-a,degrees));
Y = y + (20 * floatcos(-a,degrees));
for(new i; i < 5; i++)
{
object[playerid][i] = CreateObject(1598,X, Y, z+20,0,0,0);
}
CreateExplosion(Float:x, Float:y, Float:z+20, 8,10.0);
I want to objects and explosion create 20 foot front of player and 20 foot in height.
I was done everything but still create objects above player :S
Re: Object front of player -
WillyP - 29.10.2010
I was done everything but still create objects above player :S
im confused
anyway, what doesnt happen? the explosion?
Re: Object front of player -
pater - 29.10.2010
pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
GetPlayerPos(playerid, x, y, Angle);
GetPlayerFacingAngle(playerid, Angle);
if (GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), Angle);
}
x += (distance * floatsin(-Angle, degrees));
y += (distance * floatcos(-Angle, degrees));
}
Use GetXYInFrontOfPlayer(playerid, X, Y, 20);
To take the X, Y 20 in front of the player, with the PlayerFacing Angle or VehicleZAngle.
good luck
Re: Object front of player -
Dime - 29.10.2010
Quote:
Originally Posted by pater
pawn Код:
GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance) { GetPlayerPos(playerid, x, y, Angle); GetPlayerFacingAngle(playerid, Angle); if (GetPlayerVehicleID(playerid)) { GetVehicleZAngle(GetPlayerVehicleID(playerid), Angle); } x += (distance * floatsin(-Angle, degrees)); y += (distance * floatcos(-Angle, degrees)); }
Use GetXYInFrontOfPlayer(playerid, X, Y, 20);
To take the X, Y 20 in front of the player, with the PlayerFacing Angle or VehicleZAngle.
good luck
|
i tryed this not work :S
Re: Object front of player -
Jeffry - 29.10.2010
pawn Код:
CreateObject(1598,X + (20.0 * floatsin(-vA, degrees)), Y + (20.0 * floatcos(-vA, degrees)), z+20,0,0,0);
Code by
» RэРиR «. He gave it to me for
. xD