if GAMEMODE.Name != "The Stalker" then
if SERVER then
include stuff
end
end

I'm trying to disable an addon if specific gamemode (The Stalker) is being played. However, the addon is loaded before the gamemode, and hence prints nil or runs the script anyway. Can't figure a way to post init it. Any help?

EDIT: This is in the addon's autorun lua.EDIT2: Partly solved by cancelling all clientside rendering in client files if the gamemode is on stalker. Would like to still know your solutions.EDIT3: I gave up, removed PAC2.

I'm not a great lua scripter but I thought it would be easy to get the tool gun to work in the Elevator: Source gamemode.
Turned out that gamemode doesn't recognize sandbox things like how the tool gun or the menu works.

What I basically want to do is to copy the entities of Elevator: Source into another map and then use a permaprop tool on them.
The entities does not work in sandbox so just transfering them into sandbox isn't an alternative, unless someone knows how to make them work in sandbox.

So are there any easy ways to get the tool gun to work in non-sandbox based gamemodes?

I have been trying to make a DPanel draw ontop of a DList containing SpawnIcons, however whenever I do the icons just get drawn ontop of the panel and I can't seem to figure out how to stop this. Here is a snippet of the code, any help would be appreciated.http://pastebin.com/PugzqxFZ

in the shared file in the first 10 - 20 lines there will be a function called "DeriveGamemode". Change the argument from "base" to sandbox

Now I feel stupid for not noticing that hahaha! Amazing, thanks a lot!

EDIT:
Hm, how do you change the reload time and/or add a reload delay for a SWEP without animation?
The swep creates an effect on function SWEP:Reload() but since there is no delay it spams the effect and it becomes laggy.

So i am trying to fix up base wars but there is a problem, everytime i goto use the drug refinery, gun factory or any of those i get
[LmaoLlamaBaseWars\gamemode\physables.lua:178] attempt to call method 'CanRefine' (a nil value)
error.

A while back, Garry added a set of functions that allowed you to always locate a specific entity on the map (Given that Entity() is dependant on MaxPlayers() and usually changes each game.CleanUpMap())

However, I can't find any info on the backup wiki. Can anyone remember what they were?

I'm in need of a method of making an entity move to a set of coordinates at a set speed. I've tried using ApplyForceCenter, but I can't seem to find a reliable way to move it. The speed will variate depending on the distance, and some objects will attempt to roll.

I think this should be enough to describe what I need, but I'll include some other stuff in case it'll be of help.

The entity should be able to be any kind of model, and there's only need for rotation around yaw(? left and right, not up and down or doing a roll). I've tried using constraint.Keepupright, but I can't get this to work.

I've got no need for the speed to scale (f.ex. a smooth start, or slow end).

edit:
My main problem with applyforcecenter is that I found no clean way to set the speed, and there was really unnecessary ground friction. Something like the Hammer movelinear (I think it was) would be quite ideal. I need no collision, though it'd be nice if one could reduce the speed for a while, and then set the speed up again.

I'm in need of a method of making an entity move to a set of coordinates at a set speed. I've tried using ApplyForceCenter, but I can't seem to find a reliable way to move it. The speed will variate depending on the distance, and some objects will attempt to roll.

I think this should be enough to describe what I need, but I'll include some other stuff in case it'll be of help.

The entity should be able to be any kind of model, and there's only need for rotation around yaw(? left and right, not up and down or doing a roll). I've tried using constraint.Keepupright, but I can't get this to work.

I've got no need for the speed to scale (f.ex. a smooth start, or slow end).

edit:
My main problem with applyforcecenter is that I found no clean way to set the speed, and there was really unnecessary ground friction. Something like the Hammer movelinear (I think it was) would be quite ideal. I need no collision, though it'd be nice if one could reduce the speed for a while, and then set the speed up again.

Disable gravity on the physics object, set it's position to x units above the ground then set it's velocity instead of applying force. Have a timer to check when it's near it's destination and stop it or simply lerp it from one point to the other, from the sound of things you should probably lerp it.

and now for some untested written in browser code:

function lerpObject(obj, objDest, objStart, timeToDest, lerpStartTime)
if obj and ValidEntity(obj) then
if !objDest then return end
if !objStart then objStart = obj:GetPos() + Vector(0,0,10) end
if !timeToDest then timeToDest = 2 end
if !lerpStartTime then lerpStartTime = CurTime() end
local lerpDelta = CurTime() - lerpStartTime
lerpPerc = math.Clamp(lerpDelta / timeToDest, 0, 1)
local objPhys = obj:GetPhysicsObject()
if objPhys and objPhys:IsValid() then
if lerpPerc < 1 then
objPhys:EnableGravity(false)
else
objPhys:EnableGravity(true)
end
end
obj:SetPos(LerpVector(lerpPerc, objStart, objDest))
if lerpPerc < 1 then
timer.Simple(0.1, lerpObject, obj, objDest, objStart, timeToDest, lerpStartTime)
end
end
end

the idea is that because it loops with a timer you run this on multiple things at a time and each will finish after x time, usage:

lerpObject(myProp, Vector(234,1234,3432), , 2) -- that should move the myProp ent to vector(234,1234, 3432) over 2 seconds time

hope that works and hope that helps, i'll test/ clean it later if it doesn't work and repost it.

Edited:

So just realized that's gonna be jerky only running once every tenth of a second, you can play with the setting till it looks good or you can even add some velocity to the object so it will reach the next point on it's own before the next iteration of the function runs.

Disable gravity on the physics object, set it's position to x units above the ground then set it's velocity instead of applying force. Have a timer to check when it's near it's destination and stop it or simply lerp it from one point to the other, from the sound of things you should probably lerp it.

and now for some untested written in browser code:

function lerpObject(obj, objDest, objStart, timeToDest, lerpStartTime)
if obj and ValidEntity(obj) then
if !objDest then return end
if !objStart then objStart = obj:GetPos() + Vector(0,0,10) end
if !timeToDest then timeToDest = 2 end
if !lerpStartTime then lerpStartTime = CurTime() end
local lerpDelta = CurTime() - lerpStartTime
lerpPerc = math.Clamp(lerpDelta / timeToDest, 0, 1)
local objPhys = obj:GetPhysicsObject()
if objPhys and objPhys:IsValid() then
if lerpPerc < 1 then
objPhys:EnableGravity(false)
else
objPhys:EnableGravity(true)
end
end
obj:SetPos(LerpVector(lerpPerc, objStart, objDest))
if lerpPerc < 1 then
timer.Simple(0.1, lerpObject, obj, objDest, objStart, timeToDest, lerpStartTime)
end
end
end

the idea is that because it loops with a timer you run this on multiple things at a time and each will finish after x time, usage:

lerpObject(myProp, Vector(234,1234,3432), , 2) -- that should move the myProp ent to vector(234,1234, 3432) over 2 seconds time

hope that works and hope that helps, i'll test/ clean it later if it doesn't work and repost it.

That seems really nice, thanks! :D
I'll be heading to bed but I'll read over and implement it tomorrow. I think I got a good idea of how it works so I should be able to fix it myself should there be any issues.

I'm wanting to change that from a Variable to being stored in a TXT file so I can run a function to read from that file and update the settings. I've gotten this so far and got stuck since I need team=9 etc.

local function getAdmins()
if !file.Exists("admins.txt") then return {} end
return string.Explode(";;", file.Read("tagthinger/admins.txt"))
end

By encoding things, it means you can write objects to a file and read in objects from a file much easier, without having to parse things yourself. It also makes your objects "human readable". (Good reference: http://en.wikipedia.org/wiki/JSON)

By encoding things, it means you can write objects to a file and read in objects from a file much easier, without having to parse things yourself. It also makes your objects "human readable". (Good reference: http://en.wikipedia.org/wiki/JSON)

How should I tell the client to draw an effect, f.ex. an entity shooting?
Send the event in an usermessage to the client? I'm just wondering because then it seems like I might want to do some syncing stuff.

But it doesn't seem like any code is sent. The recieved part prints, but with nil's and 0's. Basically it seems to be sending empty data. The reason I've put this inside of initialize on the client is to be able to use "self.".
I didn't manage to find a way to call a function such as ENT:Periodic(data), with variations of ENT. and including self as a parameter.

My goal is to sync some data between the server side and the client side of an entity.

Icon.OnCursorExited and Entered both work fine. So does Icon.Paint.
What doesn't work however is DoClick. Nothing happens when I press the icons (no errors either), Yet they get colored red when hovered perfectly fine and if I change the tooltip to "model" it'll display the appropriate model path.

DoClick simply Isn't working. If I were to create all the icons individually instead of a loop it'd work which doesn't make sense to me.

Icon.OnCursorExited and Entered both work fine. So does Icon.Paint.
What doesn't work however is DoClick. Nothing happens when I press the icons (no errors either), Yet they get colored red when hovered perfectly fine and if I change the tooltip to "model" it'll display the appropriate model path.

DoClick simply Isn't working. If I were to create all the icons individually instead of a loop it'd work which doesn't make sense to me.

I'll try doing what you said but the fact that I'm not getting the printed message either makes me believe it wont change anything. I'll edit in a minute.

Edited:

Didn't work :/ For some reason whatever i put inside DoClick never seems to happen but it's weird as i know DoClick work on spawn-models as I tested it and the other Paint and OnCursorEntered both work inside the loop. This would normally make me believe it's a syntax error or something but I copy and pasted the exact line from already working code so there is no error of that kind. Something in the loop makes DoClick not work properly.