Jump to content

Help respawn


Nicolas ECM

Recommended Posts

Hi I want to make a respawn, where they have 2 locations where it can appear so far but I'm taking this cast does not serve anyone can tell me it lacks to serve?

Sitios = 
        { 
            [1] = (source, 459.77969360352, -1968.7708740234, 8.6134691238403, 0, 71), 
            [2] = (source, -2533.9658203125, -1618.890625, 526.56469726563, 0, 71) 
        } 
  
  
  
function respawn (source, cmd) 
    resultado = math.random (1, 2) 
    s, x, y, z, r, s = unpack (Sitios[resultado]) 
    nardis = spawnPlayer ( source, x, y, z, 0, math.random(0, 200) ) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
end 
  
addEventHandler("onPlayerWasted", getRootElement(), respawn) 

Link to comment
  • MTA Team
  
Sitios = 
        { 
            [1] = (source, 459.77969360352, -1968.7708740234, 8.6134691238403, 0, 71), 
            [2] = (source, -2533.9658203125, -1618.890625, 526.56469726563, 0, 71) 
        } 
  
  
  
function respawn () 
    resultado = math.random (1, 2) 
    s, x, y, z, r, s = unpack (Sitios[resultado]) 
    nardis = spawnPlayer ( source, x, y, z, 0, math.random(0, 200) ) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
end 
  
addEventHandler("onPlayerWasted", getRootElement(), respawn) 

Link to comment

Sitios = { 
{459.77969360352, -1968.7708740234, 8.6134691238403}, 
{-2533.9658203125, -1618.890625, 526.56469726563}, 
} 
  
function respawn (source, cmd) 
    local x,y,z = unpack(Sitios[math.random(#Sitios)]) 
    nardis = spawnPlayer ( source, x, y, z, 0, math.random(0, 200) ) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
end 
addEventHandler("onPlayerWasted", getRootElement(), respawn) 
  
Link to comment
  • MTA Team

That's not going to work.

Please read the event parameters before posting:

int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth 

Should be:

Sitios = { 
{459.77969360352, -1968.7708740234, 8.6134691238403}, 
{-2533.9658203125, -1618.890625, 526.56469726563}, 
} 
  
function respawn () 
    local x,y,z = unpack(Sitios[math.random(#Sitios)]) 
    nardis = spawnPlayer ( source, x, y, z, 0, math.random(0, 200) ) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
end 
addEventHandler("onPlayerWasted", getRootElement(), respawn) 
  

Link to comment
  • MTA Team

This should do the trick:

Sitios = { 
{459.77969360352, -1968.7708740234, 8.6134691238403}, 
{-2533.9658203125, -1618.890625, 526.56469726563}, 
} 
  
function respawn () 
    local x,y,z = unpack(Sitios[math.random(#Sitios)]) 
    local skin = getElementModel ( source ) 
    nardis = spawnPlayer ( source, x, y, z, 0, skin ) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
end 
addEventHandler("onPlayerWasted", getRootElement(), respawn) 
  

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