How badly did i fuck up this code? don't lie.

[lua]ENT.Base = “base_entity”
ENT.Type = “brush”

[[Server to Server Teleporter made by Munchroom.exe]]
[[I used the MelonRacer Checkpoint init.lua file, and the onslaught evolved nobuild init.lua file for reference to these commands.]]

–Create The brush
function ENT.Initialize()
end
–if a player touches the trigger, then they are teleported to the specified IP
function ENT:Touch(ent)
if ent:IsPlayer() then
ent:ConCommand("connect "…serverIP)
end
end
end

–Create the keyvalue that defines the server to connect to
function ENT:KeyValue( key, value )
if ( key == “IP” ) then
serverIP = value
end
end
[/lua]

I don’t get what i did wrong. this is my first LUA code.


(User was banned for this post ("Wrong section" - mahalis))

[lua]ENT.Base = “base_entity”
ENT.Type = “brush”

[[Server to Server Teleporter made by Munchroom.exe]]
[[I used the MelonRacer Checkpoint init.lua file, and the onslaught evolved nobuild init.lua file for reference to these commands.]]

–Create The brush
function ENT:Initialize()
end
–if a player touches the trigger, then they are teleported to the specified IP
function ENT:Touch(ent)
if ent:IsPlayer() then
ent:ConCommand("connect "…self.serverIP)
end
end
end

–Create the keyvalue that defines the server to connect to
function ENT:KeyValue( key, value )
if ( key == “IP” ) then
self.serverIP = value
end
end
[/lua]

Why did you just repaste his code without commenting on it or anything?

Just glancing at it, the first two comments aren’t comments, you need to prefix the [[ with – and end the ]] with --, like so:

[lua]
–[[This is a comment]]–
[/lua]

Second, your going to have conflicts naming the ‘ent’ your trying to get to run the console command if ENT and ent are the same. I don’t quite remember if it’s case sensitive, but to be safe, name it something more remember-able.

You have a randomly placed ‘end’ on line 16 that ends absolutely nothing.

hmm interesting.


(User was banned for this post ("Why reply?" - mahalis))

ENT is not the same as ent

You don’t need to end a comment with a –
[lua]
–[[This is a comment,
A multi-line comment]]
[/lua]
I don’t know why this doesn’t syntax highlight it though.

Second, ent and ENT are not the same thing. Lua is case-sensitive.

You are right about the random end though.

[editline]07:51PM[/editline]

Also please post any errors you get.

Thanks, I still think for clarity you should keep to a better naming conventions when referring to something for future reference, but it’s not my code. Didn’t know about the comment thing, because I thought that [[ was used to define a variable in block form, like a huge bunch of text, so it wouldn’t be escaped randomly half way through it. I guess it serves both purposes.