Making explosion 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: Making explosion in front of player? (
/showthread.php?tid=425678)
Making explosion in front of player? -
Jamcraftadam - 26.03.2013
Hello, I have tried for countless hours to figure out, How can i make an explosion where the "Player" is facing. It only uses the Y angle, but never places the explosion where the player is facing.
Код:
CMD:airstrike(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:Angle;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, Angle);
SendClientMessage(playerid, COLOR_TAN, "Air Control: An airstrike is being sent 50 Meters within your Co-Ords");
CreateExplosion(x, y+50, z, 7, 100.0);
}
Re: Making explosion in front of player? -
RajatPawar - 26.03.2013
y + 50 is too far ! Y + 5 or so is ok. I am no expert on co-ordinates, I just trial and error x + 5 and / or y + 5 until I get it right.
Re: Making explosion in front of player? -
Jamcraftadam - 26.03.2013
Quote:
Originally Posted by Rajat_Pawar
y + 50 is too far ! Y + 5 or so is ok. I am no expert on co-ordinates, I just trial and error x + 5 and / or y + 5 until I get it right.
|
The y+50 Works ok, its just not where the player is facing
Re: Making explosion in front of player? -
Apenmeeuw - 26.03.2013
pawn Код:
stock Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
switch(IsPlayerInAnyVehicle(playerid))
{
case 0: GetPlayerFacingAngle(playerid, a);
case 1: GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
return a;
}
not made by me, but the code works fine
Re: Making explosion in front of player? -
glbracer - 26.03.2013
God damn Adam.. +50?
I guess I should teach you how to script then.
What Apenmeeuw posted will work.