16.02.2014, 17:36
While playing around with the MapAndreas (v1.1), I noticed that it makes explosions under some objects.
Such as(It ignores):
Buildings ( House objects, Random shacks etc.. )
Nature or map itself ( Hills .. )
It will always make the explosion when "it" finds a "flat surface", such as:
Roads.
The code:
...
Such as(It ignores):
Buildings ( House objects, Random shacks etc.. )
Nature or map itself ( Hills .. )
It will always make the explosion when "it" finds a "flat surface", such as:
Roads.
The code:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE)
{
if (IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 476)
{
if(Bombs{playerid} >= 1)
{
if(CanUseRBombs{ playerid })
{
Bombs{ playerid }--;
new string[74];
new Float:VBPos[3];
GetVehiclePos(GetPlayerVehicleID(playerid),VBPos[0],VBPos[1],VBPos[2]);
objects = CreateObject(1636, VBPos[0], VBPos[1], VBPos[2]-2.5, 0, 0, -26); //Object..
MapAndreas_FindZ_For2DCoord(VBPos[0], VBPos[1], VBPos[2]); //Finds the Z
MoveObject(objects, VBPos[0], VBPos[1], VBPos[2], 35); //Moves object to the Z(Ground).
format(string, sizeof(string), "* Bomb dropped! Remaining bombs: %d/3", Bombs{ playerid });
SendClientMessage(playerid, COLOR_RED, string);
CanUseRBombs{ playerid } = false;
SetTimerEx("AllowRBombs", 2500, false, "i", playerid);
}
else
{
SendClientMessage(playerid, COLOR_RED, "* You need to wait for the bombs to load before using them again!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "* There are no bombs remaining on your plane!");
}
}
return 1; //not sure if i need this return 1; :pp
}
return 1;
}
forward AllowRBombs(playerid);
public AllowRBombs(playerid)
{
CanUseRBombs{ playerid } = true;
return 1;
}
public OnObjectMoved( objectid )
{
if(objectid == objects)
{
new Float:X, Float:Y, Float:Z;
GetObjectPos(objects, X,Y,Z);
CreateExplosion(X,Y,Z, 2, 18.5);
CreateExplosion(X,Y,Z+4, 7, 4.5);
DestroyObject( objects );
}
}