Making explosion in front of player?
#1

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);
}
Reply
#2

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

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

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

God damn Adam.. +50?
I guess I should teach you how to script then.
What Apenmeeuw posted will work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)