Jump to content

A question about script


Victor214

Recommended Posts

Posted

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

25567.png
Posted
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

Posted

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) 
  
  

Posted

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)

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