Advertisement
TheBakkeseKing

Bug Respawn 3

Jan 12th, 2024
815
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | Gaming | 0 0
  1. --[[
  2.  
  3.     SERVER SIDE
  4.  
  5. ]]
  6. -- Function to resurrect a player
  7. function resucitar(p)
  8.     -- Trigger a client-side event to handle further resurrection processes
  9.     triggerClientEvent(p, "resucito", p)
  10.  
  11.     -- Clear any animations that the player might have been performing
  12.     setPedAnimation(p, nil, nil)
  13.  
  14.     -- Iterate through the 'varControlTable' array and enable each control for the player
  15.     for i, v in ipairs(varControlTable) do
  16.         toggleControl(p, v, true)
  17.     end
  18. end
  19.  
  20. -- Register the 'resucitar' function to respond to the 'resucitar' event
  21. addEvent("resucitar", true)
  22. addEventHandler("resucitar", root, resucitar)
  23.  
  24.  
  25. --[[
  26.  
  27.     CLIENT SIDE
  28.  
  29. ]]
  30. -- Register and handle the 'resucito' event
  31. addEvent("resucito", true)
  32. addEventHandler("resucito", root, function()
  33.     -- Check if there is an existing timer (timerS) and if it's running
  34.     if timerS and isTimer(timerS) then
  35.         -- Stop the timer and set it to nil
  36.         killTimer(timerS)
  37.         timerS = nil
  38.     end
  39. end)
  40.  
  41. -- Register and handle the 'resucito' event
  42. addEvent("resucito", true)
  43. addEventHandler("resucito", root, function()
  44.     -- Check if there is an existing timer (timerS) and if it's running
  45.     if timerS and isTimer(timerS) then
  46.         -- Stop the timer and set it to nil
  47.         killTimer(timerS)
  48.         timerS = nil
  49.     end
  50. end)
  51.  
Tags: lua MTA SA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement