Rustler Bomb Plane not working
#1

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.

Код:
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);
			}

        }
	}
}
Thanks would appreciate help
Reply
#2

bump
Reply
#3

ur code doesnt make sense.
1) why do you create an object and move it to the same position?
2) how can u assume the Z ground height is always 13.5391...

if you wrote this code u should be able to fix it, use MapAndreas or somthing to get the highest Z ...and move it to that z pos
Reply
#4

Код:
 
    if(newkeys == KEY_HANDBRAKE)
        {		  		
if (IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) ==  476  )
	 	        {
		 			new Float:Xp[MAX_PLAYERS],Float:Yp[MAX_PLAYERS],Float:Zp[MAX_PLAYERS];
		 			GetPlayerPos(playerid, Xp[playerid],Yp[playerid],Zp[playerid] );
					if(Zp[playerid] > 40 )
					{
 					CreateExplosion(Xp[playerid], Yp[playerid], Zp[playerid]-40, 7, 20.0);
}
}
}
Reply
#5

Quote:
Originally Posted by MBilal
Посмотреть сообщение
new Float:Xp[MAX_PLAYERS],Float:Yp[MAX_PLAYERS],Float:Zp[MAX_PLAYERS];
GetPlayerPos(playerid, Xp[playerid],Yp[playerid],Zp[playerid] );
if(Zp[playerid] > 40 )
CreateExplosion(Xp[playerid], Yp[playerid], Zp[playerid]-40, 7, 20.0);
what the fuck.. lol
*facepalm*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)