#Paper Posted January 6, 2011 Posted January 6, 2011 the server says that's a bad argument... spawnPlayer ( source, -2650.2561035156, 22.383113861084, 27.414619445801, 90, 26 )
Discord Moderators Zango Posted January 6, 2011 Discord Moderators Posted January 6, 2011 can you post more code? need to see context of that
#Paper Posted January 6, 2011 Author Posted January 6, 2011 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 )
#Paper Posted January 6, 2011 Author Posted January 6, 2011 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
12p Posted January 6, 2011 Posted January 6, 2011 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
#Paper Posted January 7, 2011 Author Posted January 7, 2011 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
Castillo Posted January 7, 2011 Posted January 7, 2011 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
#Paper Posted January 7, 2011 Author Posted January 7, 2011 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
Castillo Posted January 7, 2011 Posted January 7, 2011 impossible.. i made a test command and worked, addCommandHandler("spawn", function (thePlayer) spawna(thePlayer) end)
#Paper Posted January 7, 2011 Author Posted January 7, 2011 impossible.. i made a test command and worked, addCommandHandler("spawn", function (thePlayer) spawna(thePlayer) end) Oh ok i fixxed, it works TY! ;D
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now