04.02.2019, 21:18
This is what I use create an explosion infront of the player. Not sure how good it is but it works, i think if you mess around with the code and the formula enough you can make your thing work.
PHP код:
new Float:x;
new Float:y;
new Float:z;
new Float:PlayerFacingAngle;
new const Float:DISTANCE = 3.0;
GetPlayerFacingAngle(playerid, PlayerFacingAngle);
PlayerFacingAngle = PlayerFacingAngle-180.0;
new Float:F_FLOATSIN = floatsin(-PlayerFacingAngle, degrees);
new Float:F_FLOATCOS = floatcos(-PlayerFacingAngle, degrees);
F_FLOATSIN = -F_FLOATSIN;
F_FLOATCOS = -F_FLOATCOS;
GetPlayerPos(playerid, x, y ,z);
CreateExplosion(x + DISTANCE * F_FLOATSIN, y + DISTANCE * F_FLOATCOS, z, 6, 0);