Jump to content

[noob]Problem with script


UserToDelete

Recommended Posts

i created a script and get errors, What function is neccesary? sorry im noob

The error

 WARNING: [vD]/loginspawn/spawn.lua:9: Bad argument @ 'spawnPlayer' 
 WARNING: [vD]/loginspawn/spawn.lua:10: Bad argument @ 'giveWeapon' [Expected element at argument 1, got nil] 
WARNING: [vD]/loginspawn/spawn.lua:11: Bad argument @ 'setCameraTarget' 

The script

  --server 
puto = thePlayer 
x = math.random(0,200) 
y = math.random(0,200) 
z = 2000 
rot = math.random(0,179) 
int = 0 
    function fnt () 
        spawnPlayer (puto, x, y, z, rot, int) 
        giveWeapon (puto, 46, 1, true) 
        setCameraTarget (puto, puto) 
        outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!",puto,255,255,255,true) 
    end 
addEventHandler("onPlayerLogin",root,fnt) 

outputChatBox work, but giveWeapon and spawnPlayer and setCameraTarget no

Link to comment
Hidden
x = math.random(0,200) 
y = math.random(0,200) 
z = 2000 
rot = math.random(0,179) 
int = 0 
    function fnt ( thePlayer ) 
        spawnPlayer ( source, x, y, z) 
        giveWeapon ( thePlayer, 46, 1, true) 
        outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", thePlayer,255,255,255,true) 
    end 
addEventHandler("onPlayerLogin",root,fnt) 

Link to comment
Hidden
local x = math.random(0,200) 
local y = math.random(0,200) 
local z = 15 
local rot = math.random(0,179) 
local int = 0 
    function fnt () 
        spawnPlayer ( source, x, y, z, rot, _, int ) 
        giveWeapon ( source, 46, 1, true ) 
        setCameraTarget (puto, puto) 
        outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", localPlayer(), 255, 255, 255, true) 
    end 
addEventHandler("onPlayerLogin",root,fnt) 

Try this :roll:

Link to comment
Hidden
local x = math.random(0,200) 
local y = math.random(0,200) 
local z = 15 
local rot = math.random(0,179) 
local int = 0 
    function fnt () 
        spawnPlayer ( source, x, y, z, rot, _, int ) 
        giveWeapon ( source, 46, 1, true ) 
        setCameraTarget (puto, puto) 
        outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", localPlayer(), 255, 255, 255, true) 
    end 
addEventHandler("onPlayerLogin",root,fnt) 

Try this :roll:

That wouldn't work, since spawnPlayer is server-side and getLocalPlayer() is client-side.
Link to comment
Posted (edited) · Hidden
Hidden
    local x = math.random(0,200) 
    local y = math.random(0,200) 
    local z = 2000 
    local rot = math.random(0,179) 
    local int = 0 
        function fnt () 
            spawnPlayer ( source, x, y, z, rot, _, int ) 
            giveWeapon ( source, 46 ) 
            setCameraTarget ( source, source ) 
            outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", source, 255, 255, 255, true) 
        end 
    addEventHandler("onPlayerLogin",root,fnt) 

try this

Edited by Guest
Link to comment
Hidden
    local x = math.random(0,200) 
    local y = math.random(0,200) 
    local z = 2000 
    local rot = math.random(0,179) 
    local int = 0 
        function fnt () 
            spawnPlayer ( source, x, y, z, rot, _, int ) 
            giveWeapon ( source, 46, 1, true ) 
            setCameraTarget ( source, source ) 
            outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", source, 255, 255, 255, true) 
        end 
    addEventHandler("onPlayerLogin",root,fnt) 

try this

That also wouldn't work because

setCameraTarget ( source, source ) 

makes no sense.

Use this:

x = math.random(0,200) 
y = math.random(0,200) 
z = 2000 
rot = math.random(0,179) 
int = 0 
    function fnt ( thePlayer ) 
        setCameraTarget ( source ) 
        spawnPlayer ( source, x, y, z) 
        giveWeapon ( thePlayer, 46, 1, true) 
        outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", thePlayer,255,255,255,true) 
    end 
addEventHandler("onPlayerLogin",root,fnt) 

To the thread starter: You need to use fadeCamera as well.

Note: setCameraTarget must be used to focus on the player. Also, all players have their camera initially faded out after connect. To ensure that the camera is faded in, please do a fadeCamera after.
Link to comment
Hidden
    x = math.random(0,200) 
    y = math.random(0,200) 
    z = 2000 
        function fnt ( thePlayer ) 
            spawnPlayer ( source, x, y, z) 
            giveWeapon ( thePlayer, 46 ) 
            outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", thePlayer,255,255,255,true) 
        end 
    addEventHandler("onPlayerLogin",root,fnt) 

it's correct ???

Link to comment
Hidden
    x = math.random(0,200) 
    y = math.random(0,200) 
    z = 2000 
        function fnt ( thePlayer ) 
            spawnPlayer ( source, x, y, z) 
            giveWeapon ( thePlayer, 46 ) 
            outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", thePlayer,255,255,255,true) 
        end 
    addEventHandler("onPlayerLogin",root,fnt) 

it's correct ???

No, add this line:

setCameraTarget ( source ) 

And be sure to use fadeCamera

Link to comment
Hidden
    x = math.random(0,200) 
    y = math.random(0,200) 
    z = 2000 
        function fnt ( thePlayer ) 
            spawnPlayer ( source, x, y, z) 
            giveWeapon ( thePlayer, 46 ) 
            outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", thePlayer,255,255,255,true) 
        end 
    addEventHandler("onPlayerLogin",root,fnt) 

it's correct ???

No, add this line:

setCameraTarget ( source ) 

And be sure to use fadeCamera

But you didn't use this line in your code :roll:

Link to comment
    local x = math.random(0,200) 
    local y = math.random(0,200) 
    local z = 2000 
    local rot = math.random(0,179) 
    local int = 0 
        function fnt () 
            spawnPlayer ( source, x, y, z, rot, _, int ) 
            giveWeapon ( source, 46, 1, true ) 
            setCameraTarget ( source, source ) 
            outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", source, 255, 255, 255, true) 
        end 
    addEventHandler("onPlayerLogin",root,fnt) 

try this

That also wouldn't work because

setCameraTarget ( source, source ) 

makes no sense.

Use this:

x = math.random(0,200) 
y = math.random(0,200) 
z = 2000 
rot = math.random(0,179) 
int = 0 
    function fnt ( thePlayer ) 
        setCameraTarget ( source ) 
        spawnPlayer ( source, x, y, z) 
        giveWeapon ( thePlayer, 46, 1, true) 
        outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", thePlayer,255,255,255,true) 
    end 
addEventHandler("onPlayerLogin",root,fnt) 

To the thread starter: You need to use fadeCamera as well.

Note: setCameraTarget must be used to focus on the player. Also, all players have their camera initially faded out after connect. To ensure that the camera is faded in, please do a fadeCamera after.

no work anything, i cant see player, no teleport. giveWeapon error. etc. etc. same error, but thePlayer not is valid.

Edited by Guest
Link to comment
Hidden
    x = math.random(0,200) 
    y = math.random(0,200) 
    z = 2000 
        function fnt ( thePlayer ) 
            spawnPlayer ( source, x, y, z) 
            giveWeapon ( thePlayer, 46 ) 
            outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", thePlayer,255,255,255,true) 
        end 
    addEventHandler("onPlayerLogin",root,fnt) 

it's correct ???

No, add this line:

setCameraTarget ( source ) 

And be sure to use fadeCamera

but you didn't used it in your code :roll:

Link to comment
Hidden

Use this.

Server-side

addEventHandler("onPlayerLogin", root, 
    function() 
        local x, y, z, rotation, interior = math.random(0, 200), math.random(0, 200), 2000, math.random(0, 179), 0 
        spawnPlayer(source, x, y, z, rotation, interior) 
        giveWeapon(source, 46, 1, true) 
        setCameraTarget(source) 
        outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", source, 255, 255, 255, true) 
    end 
) 

Link to comment
Use this.

Server-side

addEventHandler("onPlayerLogin", root, 
    function() 
        local x, y, z, rotation, interior = math.random(0, 200), math.random(0, 200), 2000, math.random(0, 179), 0 
        spawnPlayer(source, x, y, z, rotation, interior) 
        giveWeapon(source, 46, 1, true) 
        setCameraTarget(source) 
        outputChatBox("#00ffff[ATTENTION]#ff0000Use parachute for survive!", source, 255, 255, 255, true) 
    end 
) 

thank you, but, what is the error in my script, pls, ¿Only local?

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