[QUOTE=Banana Lord.;35619942]we generally don't help with stolen gamemodes[/QUOTE]
It's not stolen i have the bought version.
[QUOTE=Banana Lord.;35619942]we generally don't help with stolen gamemodes[/QUOTE]
I don't understand why people consider it stolen, when the original creators don't run any servers of it and there are about 200 others online.
Gamemode related, but thought I'd try here before creating my own thread. I've got a gamemode running (but with close to no content.)
In name/entites/weapons/gtd_tool I've got shared.lua and init.lua.
The code seems to run (tested with a print statement in shared.lua) but give gtd_tool doesn't work in console nor code.
What am I doing wrong? I've also got the same issue with an entity. This swep did work a while ago, but I did a lot of changes to the code and now it seems to be broken.
[code]
SWEP.Author = "o"
SWEP.Contact = " "
SWEP.Purpose = "o"
SWEP.Instructions = "o"
SWEP.Category = "GTD"
SWEP.ViewModel = "models/weapons/v_RPG.mdl" -- This is the model used for clients to see in first person.
SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" -- This is the model shown to all other clients and in third-person.
-- Things we won't be editing
SWEP.Spawnable = true -- mayhaps?
SWEP.AdminSpawnable = true
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
if SERVER then // This is where the init.lua stuff goes.
weapons = GTD.weapons
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
elseif CLIENT then // This is where the cl_init.lua stuff goes
print(tostring(weapons))
SWEP.PrintName = "Designer"
SWEP.Slot = 2
SWEP.SlotPos = 2
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
end
function SWEP:Reload()
-- bring up menu
end
function SWEP:Think()
end
function SWEP:PrimaryAttack()
end
function SWEP:SecondaryAttack()
end
[/code]
I haven't really changed anything after copy/paste, so I don't get what I'm doing wrong. Does sweps need to be added somewhere else? What are the bare minimums for one to work? And why does the print in
Edit:
Oh, I forgot to add perhaps the most important part: The error says that the tool wasn't found. When I try to give it to someone, an error says that it doesn't excists. But the code inside seems to execute
Does anyone know what the global for SpawnIcon is? DFrame, DPanel, DForm etc exist as a global.
[QUOTE=MOOcow102;35626828]I don't understand why people consider it stolen, when the original creators don't run any servers of it and there are about 200 others online.[/QUOTE]
because it was never actually released, it was leaked time after time
Does syntactic sugar make code run slower?
[QUOTE=Chessnut;35640269]Does syntactic sugar make code run slower?[/QUOTE]
It all depends on what you are doing and the way you are doing it.
Syntactic sugar doesn't mean that the code runs slower.
Let's say that you make some solution to a problem with lots of documentation and syntactic sugar and then someone else make
the exact same solution but with fewer lines (less code). Fewer lines doesn't mean that the code runs faster (but less CPU instructions does).
More code can actually make your solution for a problem faster (loop unrolling for example).
On the other hand I'm not exactly sure how the Lua compiler optimizes the code.
Go for the syntactic sugar style unless you are doing some heavy computations that creates hot spots.
The thing is that if you get hot spots the computations probably shouldn't be in the script in the first place.
The computations should be moved to the engine itself (AI node navigation is a good example).
Maybe you don't have the choice to move it to the engine but you get the idea.
If you are going for the non sugar syntactic way do some measurements and see if you get any noticeable speed increase.
But doesn't the member lookup take up some resources?
[QUOTE=Chessnut;35641098]But doesn't the member lookup take up some resources?[/QUOTE]
I think they do but unless you are doing a lot of lookups it's probably not worth optimizing anyway.
If you are doing some large for loop that includes a lot of lookups you could just go for the loop hoisting method by moving the lookup outside the loop and only do it once.
Less sugar, maybe a bit faster.
I would only go for less sugar if I really needed to.
[QUOTE=Chessnut;35640269]Does syntactic sugar make code run slower?[/QUOTE]
Most optimization work should be done late in the process, as far as I've understood. I'd focus on making code look pretty while working, and not really think about optimisation before you're close to release.
Making code look nice makes it easier to understand later, when you're really going to optimise.
I might've missunderstood what you are asking for, but I hope my point of view helps! :)
I'm not doing any premature optimization here, just editting a gamemode that seriously needs some.
Does anyone know if the 3D voice boolean is per player?
[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerCanHearPlayersVoice]Gamemode.PlayerCanHearPlayersVoice [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Hey there, I was wondering if anyone could help me.
I need to make an animation for my weapon (watch) so when i get the weapon out, the animation will pull the players left hand towards there face so the watch is in the middle of the screen .... I really just need to know how to animate and assign it to a weapon ... Thank you!
ok so small issue here triying to use
[LUA]function ENT:PhysicsUpdate( phys )
phys:AddVelocity(self:GetForward() * 999);
end
[/LUA]
in an simple entity that derives from ent_anim but as soon i hit it/touch it nothing seems to happen
I was messing around with Fretta, I have GM.TeamBased = false
and one team with one class to be the default team/class
but apparently it is not working, no errors though, any idea why?
So I can get prop_door_rotating entitie vectors but I can't get the func_door entitie vectors or func_door_rotating entitie vectors..
Can someone please give me a script that will.
Thanks in advance.
I dont know to much about LUA but this script I played with is not working.
The code should make you wave when you say these words "hi", "hey", "yo", "hello"
it is
lua\autorun\server\sv_anim.lua
[CODE]
function AnimChat(ply, text)
local prefixs = {"hi", "hey", "yo", "hello"}
local command = string.Explode(" ", text)[1]
for _, v in pairs(prefixs) do
if string.lower(command) == v then
ply:ConCommand("act wave")
end
end
end
hook.Add("PlayerSay", "AnimChat", AnimChat)
[/CODE]
got it fixed dw.
snip i'm dumb
-snip-
Any idea why [b][url=http://wiki.garrysmod.com/?title=Weapon.GetPrimaryAmmoType]Weapon.GetPrimaryAmmoType [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
returns a number rather than a string?
I kind of need a way to find the weapon ammo type...
[QUOTE=Stillnex;35751164]Any idea why [B][URL="http://wiki.garrysmod.com/?title=Weapon.GetPrimaryAmmoType"]Weapon.GetPrimaryAmmoType [IMG]http://wiki.garrysmod.com/favicon.ico[/IMG][/URL][/B]
returns a number rather than a string?
I kind of need a way to find the weapon ammo type...[/QUOTE]
I believe that's because it's an entry in an enumeration:
[URL]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4389.html?title=Enumeration_List[/URL]
[editline]29th April 2012[/editline]
Although I wish the ammo enumeration was on there :(
Some bullet IDs [URL]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8c18.html?title=CTakeDamageInfo.GetAmmoType[/URL]
I've got an entity, and in ENT:Draw I wish to draw 3D text which will always be facing the player.
I can do the math, but I'm not sure how I'll go about getting the players position and such.
If it was ENT:Draw(ply) it wouldn't be any issue. I'm just not sure how to get the data of the player it is rending for.
edit:
oh wait, this is run clientside so it will always be the local player? duuhh. nvm.
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?
[lua]
local dmginfo = DamageInfo();
dmginfo:SetDamage(20);
dmginfo:SetDamageType( DMG_BULLET );
dmginfo:SetAttacker(myself.Owner);
dmginfo:SetDamageForce(PropEntity:GetPhysicsObject():GetVelocity() * 1000);
Target:TakeDamageInfo(dmginfo);
[/lua]
I'm trying to make Target bounce away from PropEntity by passing PropEntity's velocity to it, but SetDamageForce doesn't seem to be doing anything. Anyone have a clue?
[lua]if GAMEMODE.Name != "The Stalker" then
if SERVER then
include stuff
end
end[/lua]
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?
[B]EDIT:[/B] This is in the addon's autorun lua.
[B]EDIT2:[/B] Partly solved by cancelling all clientside rendering in client files if the gamemode is on stalker. Would like to still know your solutions.
[B]EDIT3:[/B] I gave up, removed PAC2.
My code's at [url]http://pastebin.com/VtMr33bv[/url]
I'm trying to force players on the server to see an indicator that displays the location of a beacon "entity" for a pseudogamemode.
It's pretty much the same sort of deal as any given basic esp, but for some reason, I can't get it to hook. Is there an error I'm missing?
[QUOTE=Sorlag;35796005]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?[/QUOTE]
Egoistically bumping this in order to make people notice it
[B]inb4 ban[/B]
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.
[url]http://pastebin.com/PugzqxFZ[/url]
Sorry, you need to Log In to post a reply to this thread.