Explosion?
#1

Hello Everybody!

I want that when player types LMB in RC Tank so it creates an explosion in front of the RC tank.Can anyone help me
pawn Код:
//=============================================================//
#include <a_samp>

#pragma tabsize 0
#define RC_TANK   564
new Float:X, Float:Y, Float:Z;
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_FIRE)) {
new vehicleID = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleID) != RC_TANK){
    GetXYInFrontOfPlayer(playerid,X,Y, 10);
    GetVehiclePos(vehicleID, X, Y, Z);
    CreateExplosion(X, Y, Z- 0.5, 12, 5);
    }
}
    return 1;
}
//==========================================================//

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));
}
//=============================================================//
Its creating explosion in RC tank not infront of the RC tank.

I want the same like this .


[img width=300 height=300]http://files.uploadffs.com/c/9/0dd79b62/tanked.JPG[/img]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)