03.08.2015, 15:25
I want that whenever a player spawns a rustler, a bomb is attached and he can press space to drop it. That works fine.
Now what's not working, is that the bomb is not exploding. Below please find the code for the bomb to explode.
Thanks would appreciate help
Now what's not working, is that the bomb is not exploding. Below please find the code for the bomb to explode.
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (IsPlayerInVehicle(playerid, rustler))
{
if (PRESSED(KEY_HANDBRAKE))
{
//Player pos
GetVehiclePos(rustler, xPlayer, yPlayer, zPlayer); //getting player pos
tmpBomb = CreateObject(1636, xPlayer, yPlayer, zPlayer -1.1, 0, 0, 0, 2000); //putting bomb under player
DestroyObject(bombObject);
MoveObject(tmpBomb, xPlayer, yPlayer, zPlayer -1.1, 3000); //temporary bomb created
SendClientMessageToAll(0xFFFFFFAA, "Dropping Bomb");
new Float:X,Float:Y,Float:Z;
GetObjectPos(tmpBomb,X,Y,Z);
if (Z < 13.5391) //added if statement because nothing else was working
{
CreateExplosion(X,Y, 13.5391, 12, 10.0); // use explosion type what you want
DestroyObject(tmpBomb);
}
}
}
}


