Jump to content

[HELP] setTimer On Player Respawn


Whizz

Recommended Posts

Hello friends .
I wrote this code, but I want to setTimer for spawn player, I don't remember, can anyone help?
For example, if a player is killed, it will spawn after & seconds
Thank you for helping me.

function respawn ()
local team = getPlayerTeam(source)
 if team == grove then
    local x = 268.868
    local y = 2037.208
    local z = 17.7
    local groveskins = 1 then
    spawnPlayer(source, x, y, z)
    fadeCamera(source, true)
    setCameraTarget(source, source)
    givePlayerMoney(source, 0)
    setPlayerTeam(source, grove)
    giveWeapon(source, 31, 1000)
    outputChatBox("", source, 255, 255, 255)
     if groveskins == 1 then
     setElementModel(source, 115)
     end
 end

Link to comment
1 hour ago, Commonist said:
Hello friends .
I wrote this code, but I want to setTimer for spawn player, I don't remember, can anyone help?
For example, if a player is killed, it will spawn after & seconds
Thank you for helping me.

function respawn ()
local team = getPlayerTeam(source)
 if team == grove then
    local x = 268.868
    local y = 2037.208
    local z = 17.7
    local groveskins = 1 then
    spawnPlayer(source, x, y, z)
    fadeCamera(source, true)
    setCameraTarget(source, source)
    givePlayerMoney(source, 0)
    setPlayerTeam(source, grove)
    giveWeapon(source, 31, 1000)
    outputChatBox("", source, 255, 255, 255)
     if groveskins == 1 then
     setElementModel(source, 115)
     end
 end

local x = 268.868
local y = 2037.208
local z = 17.7

function respawn(player)
    if player then
       spawnPlayer(player, x, y, z)
       fadeCamera(player, true)
       setCameraTarget(player, player)
       givePlayerMoney(player, 0)
       setPlayerTeam(player, player)
       giveWeapon(player, 31, 1000)
       outputChatBox("", player, 255, 255, 255)
    end
 end

addEventHandler("onPlayerWasted",root,
   function()
      setTimer(respawn,8000,1,source) --respawn after 8 second later
   end)

 

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...