Jump to content

[HELP] onPlayerWasted


Commonist

Recommended Posts

Hello friends. I don't remember OnPlayerWasted, can anyone help? 

function start (thePlayer)
 local x, y, z = getElementPosition(thePlayer)
 local spawn = math.random(1, 3)
 if getPlayerMoney (thePlayer) >=0 then
  if (getDistanceBetweenPoints3D(x, y, z,)) < 5 then
    if spawn == 1 then
    end
    if spawn == 2 then
    end
    if spawn == 3 then
    end
  else
    outputChatBox("", thePlayer, 255, 0, 0)
end
 else
      outputChatBox("", thePlayer, 0, 255, 255)
 end
end
addCommandHandler("play", start)
Link to comment

Players will return to Spawn 1,2,3 after dying 

 

matchmarker = createMarker(1518.0277099609 , -1138.9915771484 , 140.93536376953,"cylinder", 1, 255, 0, 0)
function start (thePlayer)
 local x, y, z = getElementPosition(thePlayer)
 local spawn = math.random(1, 3)
 getPlayerTeam(thePlayer)
 setPlayerTeam(thePlayer, *)
 if getPlayerMoney (thePlayer) >=0 then
  if (getDistanceBetweenPoints3D(x, y, z,  1518.0277099609 , -1138.9915771484 , 140.93536376953)) < 5 then
    if spawn == 1 then
 
    end
    if spawn == 2 then
 
    end
    if spawn == 3 then
 
    end
  else
    outputChatBox("You're not in the marker.", thePlayer, 255, 0, 0)
end
 else
      outputChatBox("Your Not Money", thePlayer, 0, 255, 255)
 end
end
addCommandHandler("play", start)
 
---------------------------------------------------------------------------------------------

 getDistanceBetweenPoints3D 

I used it to get the player to be in the marker and use the command.

Link to comment
addEventHandler("onPlayerWasted", root,
   function()
      local spawn = math.random(1, 3)
      local team  = getPlayerTeam(source)
      local skin  = getElementModel(source)
      if spawn == 1 then 
         spawnPlayer(source, x, y, z, math.random(0, 360), skin, 0, 0, team)
      elseif spawn == 2 then 
         spawnPlayer(source, x, y, z, math.random(0, 360), skin, 0, 0, team)     
      elseif spawn == 3 then 
         spawnPlayer(source, x, y, z, math.random(0, 360), skin, 0, 0, team)          
      end 
   end 
)

x, y , z change them to the spawn coordinates

Link to comment
2 hours ago, Commonist said:

I really appreciate it and it worked right! youre doing great .😅

But there is one more question how do I get a timer for this project.

addEventHandler("onPlayerWasted", root,
   function()
      local spawn = math.random(1, 3)
      local team  = getPlayerTeam(source)
      local skin  = getElementModel(source)
      local player = source
      if spawn == 1 then 
         setTimer(spawnPlayer, 3000, 1, player, x, y, z, math.random(0, 360), skin, 0, 0, team)
      elseif spawn == 2 then 
         setTimer(spawnPlayer, 3000, 1, player, x, y, z, math.random(0, 360), skin, 0, 0, team)
      elseif spawn == 3 then 
         setTimer(spawnPlayer, 3000, 1, player, x, y, z, math.random(0, 360), skin, 0, 0, team)
      end 
   end 
)

 

  • Thanks 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...