Victor214 Posted December 18, 2011 Share Posted December 18, 2011 Hello guys, I started to learn script 2 weeks ago, i am trying to improve my Scripting skills, so (sorry for the ignorance), i was writing a REAAALLY Simple Script, just to start a gamemode, and then an error appeared "Bad Argument", i dont know what it is, could you guys help me? Script : function BugFix() local x = 2153 local y = 1012 local z = 12 spawnPlayer(thePlayer, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to the #00FF00 TBG Server!#0000ff Press F1 for info,etc", source, 255, 0, 0, true) end addEventHandler("onPlayerJoin", getRootElement(), BugFix) Error : Link to comment
JR10 Posted December 18, 2011 Share Posted December 18, 2011 function BugFix() local x = 2153 local y = 1012 local z = 12 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to the #00FF00 TBG Server!#0000ff Press F1 for info,etc", source, 255, 0, 0, true) end addEventHandler("onPlayerJoin", getRootElement(), BugFix) 'source' is the player who just joined. thePlayer is not defined. Link to comment
novo Posted December 18, 2011 Share Posted December 18, 2011 In your code, like JR10 said, thePlayer wasn't defined at function, here you have YOUR CODE EDITED: function BugFix( thePlayer ) local x = 2153 local y = 1012 local z = 12 spawnPlayer(thePlayer, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to the #00FF00 TBG Server!#0000ff Press F1 for info,etc", source, 255, 0, 0, true) end addEventHandler("onPlayerJoin", getRootElement(), BugFix) Link to comment
Xeno Posted December 18, 2011 Share Posted December 18, 2011 If you didn't realise from Novo's example, you have to define it in the function function BugFix( thePlayer ) Link to comment
DiSaMe Posted December 18, 2011 Share Posted December 18, 2011 And that will do nothing because onPlayerJoin has no parameters anyway. JR10 posted the correct script. Link to comment
Evil-Cod3r Posted December 18, 2011 Share Posted December 18, 2011 yes copy what JR10 Post Link to comment
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