Jump to content

spawn timer


TroyBoy

Recommended Posts

fucntion whatever () -- function name 
local x, y, z = getElementPosition (source ) --- get Player  Position 
    spawnPlayer ( source, x, y, z) -- spawn the Player 
end -- close it 
setTimer ( whatever, 2000, 1) -- the timer 2 sec .. 
addEventHandler ( "onPlayerSpawn", getRootElement(), whatever) --- the event name 

Link to comment
  • Moderators

--if you use this script above mind> fucntion whatever = function whatever (I post this at the sametime as his one xD

I am a noob scipter... pls say If I do something wrong.

I write it down like this: (it can be smaller)

  
  
function Wasted () -- function Wasted <<< 
setTimer ( Wastedtimer, 2000, 0 ) -- this is the timer and will activate the second function. 
  
end 
  
addEventHandler("onPlayerWasted", root, Wasted)  
-- this checks when you die. "The Wasted"  activate the function Wasted. 
  
function Wastedtimer () 
    spawnPlayer ( source, 0.0, 0.0, 0.0, 0.0, 0 )  
  
  
end 
--[[ just fill it in. (mind all players will be spawned at one location.) 
  
  
Required Arguments 
  
    thePlayer: The player you want to spawn. 
    x: The x co-ordinate to spawn the player at. 
    y: The y co-ordinate to spawn the player at. 
    z: The z co-ordinate to spawn the player at.  
  
Optional Arguments 
  
    rotation: rotation of the player on spawn. 
    skinID: player's skin on spawn. 
    interior: interior the player will spawn into. 
    dimension: The ID of the dimension that the player should be in. 
    theTeam: the team the player will join.  
  
More info about spawning: 
 https://wiki.multitheftauto.com/wiki/SpawnPlayer 
  
]] 
  
  
  

Link to comment
--if you use this script above mind> fucntion whatever = function whatever (I post this at the sametime as his one xD

I am a noob scipter... pls say If I do something wrong.

I write it down like this: (it can be smaller)

  
  
function Wasted () -- function Wasted <<< 
setTimer ( Wastedtimer, 2000, 0 ) -- this is the timer and will activate the second function. 
  
end 
  
addEventHandler("onPlayerWasted", root, Wasted)  
-- this checks when you die. "The Wasted"  activate the function Wasted. 
  
function Wastedtimer () 
    spawnPlayer ( source, 0.0, 0.0, 0.0, 0.0, 0 )  
  
  
end 
--[[ just fill it in. (mind all players will be spawned at one location.) 
  
  
Required Arguments 
  
    thePlayer: The player you want to spawn. 
    x: The x co-ordinate to spawn the player at. 
    y: The y co-ordinate to spawn the player at. 
    z: The z co-ordinate to spawn the player at.  
  
Optional Arguments 
  
    rotation: rotation of the player on spawn. 
    skinID: player's skin on spawn. 
    interior: interior the player will spawn into. 
    dimension: The ID of the dimension that the player should be in. 
    theTeam: the team the player will join.  
  
More info about spawning: 
 https://wiki.multitheftauto.com/wiki/SpawnPlayer 
  
]] 
  
  
  

I think it will work. But why you use an infinite timer?

function spawnAgain() 
    spawnPlayer( source, 0.0, 0.0, 0.0, 0.0, 0 ) 
end 
  
addEventHandler('onPlayerWasted',root, 
    function() 
        setTimer( spawnAgain, 2000, 1 ) 
    end 
) 

Edited by Guest
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...