Jump to content

A question about script


Victor214

Recommended Posts

Hello guys, :D

I started to learn script 2 weeks ago, i am trying to improve my Scripting skills, so :D (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 :

errovw.png

Link to comment
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

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

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