SA-MP Forums Archive
Rustler Bomb Plane not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Rustler Bomb Plane not working (/showthread.php?tid=584271)



Rustler Bomb Plane not working - alistair_hawk - 03.08.2015

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


Re: Rustler Bomb Plane not working - alistair_hawk - 03.08.2015

bump


Re: Rustler Bomb Plane not working - jamesbond007 - 04.08.2015

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


Re: Rustler Bomb Plane not working - MBilal - 04.08.2015

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



Re: Rustler Bomb Plane not working - jamesbond007 - 04.08.2015

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*