ent spawn not working

I want to spawn the billiards ent (http://www.facepunch.com/threads/1054212-MBilliards), but this isn’t working.

[lua]function Spawn()
ent=ents.Create(“billiard_table”)
ent:SetPos(Vector( 1447.93, 493.66, 63.03))
ent:SetAngles( Angle(0, 180, 0))
ent:Spawn()
end
hook.Add(“Think”, “spawn”, Spawn)[/lua]

Why are you doing it in a Think hook? Try this:

[lua]local function Spawn()
local ent = ents.Create(“billiard_entity”)
ent:SetPos( Vector( 1447.93, 493.66, 63.03 ) )
ent:SetAngles( Angle( 0, 180, 0 ) )
ent:Spawn()
end
hook.Add( “InitPostEntity”, “spawn”, Spawn )[/lua]

Check that the position is right, and check the console for any errors. Also make sure the script is being run on the server.

i used think when i tested it with spawning zombies every x seconds.

and what you said didn’t work

Did you put it in autorun?

[lua]
function SpawnEnts( )
local ent = ents.Create( “billiard_entity” )
ent:SetPos( Vector( 1447.93, 493.66, 63.03 ) )
ent:SetAngles( Angle( 0, 180, 0 ) )
ent:Spawn( )
end
end
hook.Add( “InitPostEntity”, “SpawnEntities”, SpawnEnts )
[/lua]
This should work, as it works fine for me.

that wouldn’t work pers, and yes ralle.

I now have:

[lua]function Spawn(ply, cmd, args)
local ent = ents.Create(“billiard_table”)
local size = 9
ent.Size = size
ent:SetPos(Vector( 1429.90625, 298.65625, -0.96875 + 0.2 ))
ent:Spawn()
ent:GetPhysicsObject():EnableMotion(false)
ent:SetConfig(1429.90625, 298.65625, -0.96875 + 0.2, 9, 3, 1, 2, false, true, 2, true, false)
ent:Activate()
ent:SetSkin(3)
ent.GameType = BILLIARD_GAMETYPE_8BALL
BilliardTables = BilliardTables + 1
end
hook.Add( “InitPostEntity”, “spawn”, Spawn )[/lua]

and there’s 2 problems.

  1. when I press use while looking at it, it prints this to console:


New Billiard Game started! Game type is 8-Ball
Name1: Jova

as it should, and when i hold shift and move the ball around and let go, this pops up



DataTable warning: (class player): Out-of-range value (-90.290001) in SendPropFloat 'm_angEyeAngles[0]', clamping.
DataTable warning: player: Out-of-range value (90.019997) in SendPropFloat 'm_angEyeAngles[0]', clamping.


  1. the view is messed up:

  1. it doesn’t let me play. when I click, nothing happens. If I hold right click and move my mouse back it pulls the stick back but doesn’t do anything when I let go.

Your ent:SetConfig() arguments is wrong:

ent:SetConfig(GameType, iRoundTime, boolTraining, boolSmartCue, iABMethod, bMingeProtect, boolCueFirstPerson)

example:



ent:SetConfig(BILLIARD_GAMETYPE_8BALL, 30, false, true, 2, true, true)


[editline]Edited:[/editline]
As of revision 9, SetConfig() now have default value arguments, which means you could use
ent:SetConfig() – With no arguments
or ent:SetConfig(BILLIARD_GAMETYPE_9BALL) – With partial arguments

it doesn’t let me play for some reason, i don’t know why. It makes me go to firstperson and doesn’t let me do anything. that’s the only problem now.

try this (removed few things):

[lua]
function Spawn(ply, cmd, args)
local ent = ents.Create(“billiard_table”)
local size = 9
ent.Size = size
ent:SetPos(Vector( 1429.90625, 298.65625, -0.96875 + 0.2 ))
ent:Spawn()
ent:GetPhysicsObject():EnableMotion(false)
ent:SetConfig(BILLIARD_GAMETYPE_8BALL, 30, false, true, 2, true, true)
ent:Activate()
BilliardTables = BilliardTables + 1
end
hook.Add( “InitPostEntity”, “spawn”, Spawn )
[/lua]

Also, when you use a billiard table, go to console and type:
billiard_debug_info
Go to the server console and copy only the main info (exclude the part of “Player data”) and paste it here…

wait, in what version did you remove hitting the ball with left click o_o

apparently i didn’t know i was supposed to push the stick forward with right click lol, didn’t know you changed that cause the first version i downloaded was one that shot with left click >.>

It wasn’t removed…

Try to use with “CueFirstPerson” disabled…