Skip to content

Instantly share code, notes, and snippets.

@draobrehtom
Created Jan 2, 2020
Embed
What would you like to do?
Fivem: JS - Aiming to entity and deleting it
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