BULLET_HIT_TYPE_OBJECT Assistance - 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: BULLET_HIT_TYPE_OBJECT Assistance (
/showthread.php?tid=586172)
BULLET_HIT_TYPE_OBJECT Assistance -
Krakuski - 19.08.2015
Howdy! I'm having a problem with my shooting system and was wondering how I can fix it. Anytime I shoot an object that is
not "TrainTarget[0]", It still gives me the message, although I only want it to give me the message when I hit "TrainTarget[0]". Any idea what might be causing this? Thank you!
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid)
{
if(hittype == BULLET_HIT_TYPE_OBJECT)
{
if(IsValidObject(TrainTarget[0]))
{
PlayerPlaySound(playerid,17802,0.0,0.0,0.0);
GameTextForPlayer(playerid, "~g~Nice!" , 1000, 6);
DestroyObject( TrainTarget[0] );
}
}
return 1;
}
Re: BULLET_HIT_TYPE_OBJECT Assistance -
Vince - 20.08.2015
Well yes, because you're never comparing anything to hitid, which represents the id of the object that was actually hit.