Created
January 2, 2020 09:26
-
-
Save draobrehtom/118207424778ff129eda38f8243a3008 to your computer and use it in GitHub Desktop.
Fivem: JS - Aiming to entity and deleting it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let previousPed; | |
GiveWeaponToPed(PlayerPedId(), GetHashKey('WEAPON_SNOWBALL'), 30, false, true); | |
setTick(() => { | |
if (IsPlayerFreeAiming()) { | |
let r = GetEntityPlayerIsFreeAimingAt(PlayerId()); | |
if (r[0] && DoesEntityExist(r[1])) { | |
if (IsEntityAPed(r[1]) && IsEntityDead(r[1]) === false) { | |
previousPed = PlayerPedId(); | |
SwitchOutPlayer(previousPed, 0, 0); | |
SwitchInPlayer(r[1]); | |
DeleteEntity(r[1]); | |
} | |
} else { | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment