Do not indulge in what can lead to haraam
Narrated Abu Huraira:
The Prophet (sallallaahu alayhi wa sallam) said, "None of you should point out towards his Muslim brother with a weapon, for he does not know, Satan may tempt him to hit him and thus he would fall into a pit of fire (Hell)"
Sahīh al-Bukhāri Hadīth No. 7072
Ibn Hajar al-asqalāni said commenting on the following portion of this Hadīth:
( فيقع في حفرة من النار )
Thus he would fall into a pit of Fire
هو كناية عن وقوعه في المعصية التي تفضي به إلى دخول النار،
It means that he may fall into a sin which necessitates that he enter the Fire (i.e. Hell)
وفي الحديث النهي عما يفضي إلى المحذور وإن لم يكن المحذور محققا سواء كان ذلك في جد أو هزل،
In this Hadith is evidence that one is prohibited from those things which may lead one to forbidden outcomes even if the forbidden outcome is not assured regardless of if it is done jokingly or in seriousness.
(You can point a gun at someone jokingly or seriously and doing so in itself does not bring about any harm and nor is it assured that you will end up shooting the other person but doing so holds the possibility that it will lead to the other person being shot and injured or killed. We are forbidden from doing such things which may not themselves cause harm but can lead to harm. We are not to do them jokingly or in seriousness).
Reference(s):
Sharh of Sahīh al-Bukhāri by Ibn Hajar al-asqalāni