Victor214 Posted December 18, 2011 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 :
JR10 Posted December 18, 2011 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. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
novo Posted December 18, 2011 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)
Xeno Posted December 18, 2011 Posted December 18, 2011 If you didn't realise from Novo's example, you have to define it in the function function BugFix( thePlayer )
DiSaMe Posted December 18, 2011 Posted December 18, 2011 And that will do nothing because onPlayerJoin has no parameters anyway. JR10 posted the correct script. -
Evil-Cod3r Posted December 18, 2011 Posted December 18, 2011 yes copy what JR10 Post My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
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