Explosion with RC_TANK - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Explosion with RC_TANK (
/showthread.php?tid=112904)
Explosion with RC_TANK -
_Sami_ - 11.12.2009
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;
}
//==========================================================//
Re: Explosion with RC_TANK -
Joe Staff - 11.12.2009
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.
Re: Explosion with RC_TANK -
_Sami_ - 11.12.2009
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
Re: Explosion with RC_TANK -
yom - 11.12.2009
You also compare a vehicle id with a vehicle model..
Re: Explosion with RC_TANK -
_Sami_ - 11.12.2009
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
Re: Explosion with RC_TANK -
_Sami_ - 11.12.2009
Код:
//=============================================================//
#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.
Re: Explosion with RC_TANK -
_Sami_ - 11.12.2009
can any one fix it plz ?