Jump to content

[HELP]spawnPlayer


Chrimam

Recommended Posts

Posted

It keeps saying

 bad argument @ spawnPlayer 

I tried function getCoords(source) but it says

 bad argument @getElementPosition expected element at argument 1, got number '0' 

(Yes. I also tried spawnCoords(source, wastedX, wastedY, wastedZ, wastedSkin)

function getCoords() 
    wastedX, wastedY, wastedZ = getElementPosition(source) 
        wastedSkin = getElementModel(source) 
            setTimer(spawnCoords, 1000, 1) 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), getCoords ) 
  
function spawnCoords(wastedX, wastedY, wastedZ, wastedSkin) 
    spawnPlayer(source, wastedX, wastedY, wastedZ, 0, wastedSkin) 
end 

Posted
addEventHandler ( "onPlayerWasted", root, 
    function () 
        wastedX, wastedY, wastedZ = getElementPosition( source ) 
        wastedSkin = getElementModel(source) 
        spawnPlayer(source, wastedX, wastedY, wastedZ, 0, wastedSkin) 
    end 
) 

Posted

That's why i put a timer there. It spawns me immediately after i die. I can't understand if died. I want to be spawned after 1 second or so.

Posted
addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        wastedX, wastedY, wastedZ = getElementPosition ( source ) 
        wastedSkin = getElementModel ( source ) 
        setTimer ( spawnPlayer, 1000, 1, source, wastedX, wastedY, wastedZ, 0, wastedSkin ) 
    end 
) 

Posted
function getCoords() 
    local wastedX, wastedY, wastedZ = getElementPosition(source) 
    local wastedSkin = getElementModel(source) 
    setTimer(spawnCoords, 1000, 1, source, wastedX, wastedY, wastedZ, wastedSkin) 
end 
addEventHandler("onPlayerWasted", root, getCoords) 
  
function spawnCoords(source, wastedX, wastedY, wastedZ, wastedSkin) 
    spawnPlayer(source, wastedX, wastedY, wastedZ, 0, wastedSkin) 
    setCameraTarget(source) 
end 

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