Explosion with RC_TANK
#1

i want when player types RCTRL then it create explosion infront of the RC_TANK if the player is in RC_TANK
but there is something wrong thats why its not creating explosion

help me

Код:
//=============================================================//
#include <a_samp>
#pragma tabsize 0
#define RC_TANK   564

#define HOLDING(%0) \
	((newkeys & (%0)) == (%0))
new Float:x, Float:y, Float:z, Float:angle;
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (HOLDING(KEY_FIRE))
	{
		new
			vehicleid = GetPlayerVehicleID(playerid);
		if (vehicleid == 564)
		{
	    GetVehiclePos(vehicleid, x,y,z);
			CreateExplosion(x, y , z -0.25, 12, angle);
		}
	}
	return 1;
}
//==========================================================//
Reply
#2

You should be using
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
Also note that the explosion is going to happen on the tank and will just self-destruct, which is cool too, but doens't look like what you're aiming for. Look for GetXYInFrontOfPlayer, and change the function to work with vehicles. You're also using angle wrong, you're not setting it to anything and you're placing it in the radius parameter of CreateExplosion, which is wrong.
Reply
#3

Quote:
Originally Posted by Joe Staff
You should be using
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
Also note that the explosion is going to happen on the tank and will just self-destruct, which is cool too, but doens't look like what you're aiming for. Look for GetXYInFrontOfPlayer, and change the function to work with vehicles. You're also using angle wrong, you're not setting it to anything and you're placing it in the radius parameter of CreateExplosion, which is wrong.
ok i will try to fix it

i want that explosion create infront of the RC_TANK and can u give me full info of
GetXYInFrontOfPlayer
Reply
#4

You also compare a vehicle id with a vehicle model..
Reply
#5

Quote:
Originally Posted by 0rb
You also compare a vehicle id with a vehicle model..
so fix it for me iam new to scripting thats why its too difficult for me
Reply
#6

Код:
//=============================================================//

#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)
{
new vehicleID = GetPlayerVehicleID(playerid);
if(IsVehicleRc(vehicleID) || GetVehicleModel(vehicleID) == RC_TANK){
if(GetVehicleModel(vehicleID) != RC_TANK){
	if (PRESSED(KEY_FIRE)) {
	GetXYInFrontOfPlayer(playerid,X,Y,5);
	CreateExplosion(X, Y, Z, 12, 5);
	}
}
}
	return 1;
}

IsVehicleRc( vehicleid ){
  new model = GetVehicleModel(vehicleid);
  switch(model){
  case RC_TANK: return 1;
  default: return 0;
    }

  return 0;
}
//==========================================================//
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\Rar$DI26.0266\t ank.pwn(16) : error 017: undefined symbol "GetXYInFrontOfPlayer"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Reply
#7

can any one fix it plz ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)