BULLET_HIT_TYPE_OBJECT Assistance
#1

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;
}
Reply
#2

Well yes, because you're never comparing anything to hitid, which represents the id of the object that was actually hit.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)