Advertisement
TheBakkeseKing

Bug Respawn 2

Jan 12th, 2024
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.08 KB | Gaming | 0 0
  1. --[[
  2.  
  3.     SERVER SIDE
  4.  
  5. ]]
  6.  
  7. -- Function to revive a player in the game
  8. function Revivir_a_Jugador(source, command, objetive)
  9.     -- Retrieve the rank information of the player who issued the command
  10.     local rank = exports["MR2_Cuentas"]:getValue(source, 'InfoCuenta')
  11.  
  12.     -- Check if the player's rank is high enough to use the command (rank 4 or higher)
  13.     if not (rank["Rango"] >= 4) then
  14.         return
  15.     end
  16.  
  17.     -- If no target player is specified, inform the command issuer about the correct syntax
  18.     if not (objetive) then
  19.         return outputChatBox("#9AA498[#A03535Syntaxis#9AA498] #FFFFFF/"..command.." [Usuario]", source, 0, 0, 0, true)
  20.     end
  21.  
  22.     -- Find the target player by their name
  23.     local objetivo = getPlayerFromName(objetive)
  24.     -- If the target player is not found (not connected), notify the command issuer
  25.     if not (objetivo) then
  26.         return outputChatBox("#56c450El jugador #24C5BE"..objetive.." #56c450no esta conectado.", source, 0,0,0, true)
  27.     end
  28.  
  29.     -- Retrieve the death state of the target player
  30.     local Estado = exports["MR2_Cuentas"]:getValue(objetivo, 'Estado')
  31.     -- If the target player is not dead, notify the command issuer
  32.     if not (Estado.Muerto == true) then
  33.         return outputChatBox("#56c450El jugador #24C5BE"..objetive.." #56c450no esta muerto.", source, 0,0,0, true)
  34.     end
  35.    
  36.     -- Set the target player's death state to false (revive them)
  37.     Estado.Muerto = false
  38.     exports["MR2_Cuentas"]:setValue(objetivo, 'Estado', Estado)
  39.     -- Use a custom function to handle the revival process
  40.     exports["MR3_Muertes"]:resucitar(objetivo)
  41.  
  42.     -- Notify the revived player and the command issuer about the revival
  43.     local staff = getAccountName(getPlayerAccount(source))
  44.     outputChatBox("#FF7800"..staff.." #56c450te ha revivido.", objetivo, 0,0,0, true)
  45.     outputChatBox("#56c450Reviviste a #24C5BE"..objetive.."", source, 0,0,0, true)
  46. end
  47.  
  48. -- Register the function with the command "revivir" and "revive"
  49. addCommandHandler("revivir", Revivir_a_Jugador)
  50. addCommandHandler("revive", Revivir_a_Jugador)
  51.  
Tags: lua MTA SA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement