function Radio:toggleRadioAnimation(pState)
lib.requestAnimDict('cellphone@')
if pState then
-- Si l'objet radio existe déjà, on le supprime d'abord avant d'en créer un nouveau
if self.radioProp and DoesEntityExist(self.radioProp) then
DeleteObject(self.radioProp)
self.radioProp = nil
end
-- Attacher la radio et jouer l'animation
TriggerEvent("attachItemRadio", "radio")
TaskPlayAnim(cache.ped, "cellphone@", "cellphone_text_read_base", 2.0, 3.0, -1, 49, 0, false, false, false)
self.radioProp = CreateObject(`prop_cs_hand_radio`, 1.0, 1.0, 1.0, true, true, false)
AttachEntityToEntity(self.radioProp, cache.ped, GetPedBoneIndex(cache.ped, 57005), 0.14, 0.01, -0.02, 110.0, 120.0, -15.0, true, false, false, false, 2, true)
else
-- Arrêter l'animation et supprimer l'objet radio s'il existe
StopAnimTask(cache.ped, "cellphone@", "cellphone_text_read_base", 1.0)
ClearPedTasks(cache.ped)
if self.radioProp and DoesEntityExist(self.radioProp) then
DeleteObject(self.radioProp)
self.radioProp = nil
end
end
end
Search in client > functions.lua line 172
and change function :
function Radio:toggleRadioAnimation(pState)to