Jump to content

spawnPlayer


#Paper

Recommended Posts

can you post more code? need to see context of that
addEvent("makePlayerSpawn", true) 
function spawna () 
spawnPlayer ( source, -2650.2561035156, 22.383113861084, 27.414619445801, 90, 26 ) 
fadeCamera(source, true) 
setCameraTarget(source, player) 
end 
addEventHandler( "makePlayerSpawn", getRootElement(), spawna ) 

Link to comment
show triggering.
function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( player,"hideLoginWindow", getRootElement() ) 
           spawna() ----HERE THE TRIGGER 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. 
    end 
end 

Link to comment

ERRORS:

1. If you are triggering that function, there isn't any "source" player...

2. You must specify a player to spawn when using that function calling way. In this case: spawna(player)

3. You must give a parameter to the "spawna" function, and check if "source" exists.

4. Just check the corrections that are highlighted in black.

Fixed codes:

addEvent("makePlayerSpawn", true) 
function spawna ([b]player[/b]) 
[b]if source then  
thePlayer = source  
else  
thePlayer = player  
end[/b] 
spawnPlayer ( [b]thePlayer[/b], -2650.2561035156, 22.383113861084, 27.414619445801, 90, 26 ) 
fadeCamera([b]thePlayer,[/b] true) 
setCameraTarget([b]thePlayer[/b], player) 
addEventHandler( "makePlayerSpawn", getRootElement(), spawna ) 

function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( player,"hideLoginWindow", getRootElement() ) 
            spawna([b]player[/b]) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. 
    end 
end 

Link to comment
ERRORS:
addEvent("makePlayerSpawn", true) 
function spawna ([b]player[/b]) 
[b]if source then  
thePlayer = source  
else  
thePlayer = player  
end[/b] 
spawnPlayer ( [b]thePlayer[/b], -2650.2561035156, 22.383113861084, 27.414619445801, 90, 26 ) 
fadeCamera([b]thePlayer,[/b] true) 
setCameraTarget([b]thePlayer[/b], player) 
addEventHandler( "makePlayerSpawn", getRootElement(), spawna ) 

function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( player,"hideLoginWindow", getRootElement() ) 
            spawna([b]player[/b]) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. 
    end 
end 

T_T !another time bad argument! T_T

Link to comment
function spawna (player) 
if source then 
thePlayer = source 
else 
thePlayer = player 
end 
spawnPlayer ( thePlayer, -2650.2561035156, 22.383113861084, 27.414619445801, 90, 26 ) 
fadeCamera(thePlayer, true) 
setCameraTarget(thePlayer, thePlayer) 
end 
addEventHandler( "makePlayerSpawn", getRootElement(), spawna ) 

function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( player,"hideLoginWindow", getRootElement() ) 
            spawna(player) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. 
    end 
end 

Link to comment
function spawna (player) 
if source then 
thePlayer = source 
else 
thePlayer = player 
end 
spawnPlayer ( thePlayer, -2650.2561035156, 22.383113861084, 27.414619445801, 90, 26 ) 
fadeCamera(thePlayer, true) 
setCameraTarget(thePlayer, thePlayer) 
end 
addEventHandler( "makePlayerSpawn", getRootElement(), spawna ) 

function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( player,"hideLoginWindow", getRootElement() ) 
            spawna(player) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. 
    end 
end 

OMFG! i think that this function is bugged: another time player is a bad argument

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