Just change it in the PrimaryAttack function. I dd that for my select-fire weapons in TTT.
Here's what you need to look out for... Make sure the client knows about select fire. The other clients don't need to know ( server plays the sound and fires bullets ). You will need to sync the fire-mode on pickup though...
I may have my old TTT weapons somewhere.. I'll take a look for them, but I will be releasing my swep base soon which will have a ton of features.
[QUOTE=Galactic;46813923]Does anyone know how to change the SWEP values for an individual weapon in realtime in ttt? For instance, I want to be able to switch the IsAutomatic value from true to false and increase the headshot multiplier for a persons weapon they run a bound console command. In order to simulate a selective fire weapon. I don't know where to start though.[/QUOTE]
Well, I do this all the time (outside of TTT, I don't do anything with TTT), changing swep variables "in realtime"
It's not really that hard. If you want to change automatic true/false, then:
[code]if MakeItTrue then
self.Primary.Automatic = true
else --if MakeItFalse || not MakeItTrue then
self.Primary.Automatic = false
end[/code]
To alter the damage, well... if you just want it for headshots, work it into a callback function. bullet.Callback = function() do some jazz end
I use else--if cus you could just use else, but if you need something else to be true, then use elseif
When i start deathrun_marioworld_final on a windows server the ladders work just fine. But when i start the map on a linux server the ladders don't work.
What might be the problem?
With linux files are also case sensitive. Is the map-name all lowercase? I don't know if Source automatically handles that or not but it's always a good idea to make all file-names lowercase.
If ladders work in other maps on Linux but not on that one map then there may be something else going on... Is there by chance a Lua script which runs for that map?
[QUOTE=Acecool;46814042]Just change it in the PrimaryAttack function. I dd that for my select-fire weapons in TTT.
Here's what you need to look out for... Make sure the client knows about select fire. The other clients don't need to know ( server plays the sound and fires bullets ). You will need to sync the fire-mode on pickup though...
I may have my old TTT weapons somewhere.. I'll take a look for them, but I will be releasing my swep base soon which will have a ton of features.[/QUOTE]
Thanks! that would be really helpful!
How do i scale models drawn by render.Model() ?
(i did this in luapad, thats why theres an local e = Entity(ID) )
[CODE]local e = Entity(1412) -- base entity, base should be wire entity
local ang = 45 -- cylinder angle
local scale = 2 --scale
local ccount = 4 --num of cylinders (each side)
local matrix = Matrix()
e.Draw = function()
--e:DrawModel() -- hide this, its just he base prop.
-- i want to scale them up
matrix:SetScale(Vector(scale))
a1,a2 = e:GetAngles(),e:GetAngles() --a =e:GetAngles(); a1 = a; a2 = a; doesnt work
a1:RotateAroundAxis(e:GetForward(),ang)
a2:RotateAroundAxis(e:GetForward(),-ang)
cam.PushModelMatrix(matrix)
for i = 1,ccount,1 do
render.Model({model="models/engines/1cylsml.mdl",pos=e:GetPos()+( e:GetForward()*( (i-1)*(9*scale) ) ),angle=a1 })
render.Model({model="models/engines/1cylsml.mdl",pos=e:GetPos()+( e:GetForward()*( (i-1)*(9*scale) ) ),angle=a2 })
end
cam.PopModelMatrix()
end
[/CODE]
The entitiy is a base wire entity, which uses the Draw function.
I want to add rendered models to the base entity and scale them up.
but it wont scale somehow.
I tried to put the push/pop matrix stuff within start3D2D and start3D both failed.
then i tried to put everything into a PostDrawOpaqueRenderables hook. still not working.
Help please!
You don't. You gotta use a proper clientside model for that.
Expression advanced 2 can do this (render model and scaling). I dont want to use sepperate clientside-entities for each additional prop.
[QUOTE=gamerpaddy;46815806]Expression advanced 2 can do this (render model and scaling). I dont want to use sepperate clientside-entities for each additional prop.[/QUOTE]
How about you go and look how it did it then :v:
[editline]29th December 2014[/editline]
ProTip: They do not use model.Render.
[QUOTE=gamerpaddy;46815806]Expression advanced 2 can do this (render model and scaling). I dont want to use sepperate clientside-entities for each additional prop.[/QUOTE]
render.Model is only meant to be used like once, for render targets and shit, using it every frame means that you're creating and removing entities all the time, and that's BAD.
Cache the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/ClientsideModel]ClientsideModel[/url] in whatever hook you want and then draw it manually.
[QUOTE=mib999;46811379]is mod inherited to admin in your admin mod?[/QUOTE]
Yes
Does anyone have the loop catcher that was made a little while back? I cannot stop crashing my game with 'while CONDITION do' loops and its pretty annoying because I need a fast loop and hooks wont cut it
[QUOTE=rebel1324;46813741]How do I make this HTML Text feel more less jiggly?
[t]http://i.imgur.com/r62Wl18.png[/t][/QUOTE]
You're probably better off asking this in the [URL="http://facepunch.com/showthread.php?t=1250244&page=117"]webdev question thread[/URL].
[editline]29th December 2014[/editline]
[QUOTE=SorteSvin;46815950]Yes[/QUOTE]
What admin mod are you using?
I decided that it would make more sense to do a Python 'clock.tick' type thing and just have the developer define their tick rate/fps and run your game loop based on that rather than mess with differing frame rates.
This is my attempt at making that, it works but I don't know if the frame rate number (fpsReturn) is accurate or not. I would just like to verify that this code is the correct way of doing it and my math is right
[code]
local app = data.app
local fps = data.fps
local callback = data.func
local appName = app.PrintName:lower() or "error"
local tickRate = 1/fps
local nextTick = CurTime() + tickRate
local frameCount = 0
local startTime = CurTime()
local endTime = CurTime() + 1
hook.Add("Think", "gPhone_AppTicker_"..appName, function()
-- Call the next tick
if CurTime() > nextTick then
frameCount = frameCount + 1
nextTick = CurTime() + math.abs(tickRate - RealFrameTime())
print(fpsReturn, CurTime() - startTime)
callback()
end
-- Its been a second
if CurTime() >= endTime then
startTime = CurTime()
endTime = CurTime() + 1
frameCount = 0
end
fpsReturn = frameCount / (CurTime() - startTime)
end)
[/code]
How can I update the skin of a viewmodel? Doing weapon:SetSkin() seems to only affect the world model.
I really, really need to get a custom derma scrollbar so that I can use it to match the rest of my menu.
[QUOTE=neato;46817148]I really, really need to get a custom derma scrollbar so that I can use it to match the rest of my menu.[/QUOTE]
[url]http://facepunch.com/showthread.php?t=1435466[/url]
Could anyone provide an example of [url]http://wiki.garrysmod.com/page/Global/Lerp[/url] in a HUD so the health or bar decreases and increases smoothy please? i'm too sure how to use it.
[img]http://ss.infd.us/2014/12/2014-12-30_01-02-26.png[/img]
How do I remove the default green "Player x has left the game (reason)"?
I want just my admin mod's disconnect message to show instead. I seem to remember there being a hook you have to return false on but I can't remember which one.
[QUOTE=Mors Quaedam;46818465][img]http://ss.infd.us/2014/12/2014-12-30_01-02-26.png[/img]
How do I remove the default green "Player x has left the game (reason)"?
I want just my admin mod's disconnect message to show instead. I seem to remember there being a hook you have to return false on but I can't remember which one.[/QUOTE]
Example on [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ChatText]GM/ChatText[/url]
[QUOTE=zerf;46818554]Example on [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ChatText]GM/ChatText[/url][/QUOTE]
That's the one. Thanks!
[QUOTE=_Entity;46818390]Could anyone provide an example of [url]http://wiki.garrysmod.com/page/Global/Lerp[/url] in a HUD so the health or bar decreases and increases smoothy please? i'm too sure how to use it.[/QUOTE]
[url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index0814.html[/url]
Go to Method 3
Ok I understand it but where do I use it. For example I want to increment a networked Integer using the Lerp function but don't exactly know where to use the code. this is the function i'm using [code] function client:GiveEXP (amount)
self:SetNWInt("exp", self:GetCurEXP() + amount)
end [/code]
Attempt to Index a nil value? I think It's related to the quad that doesn't lerp. I could be wrong though.
[CODE]
function SWEP:Initialize()
if CLIENT then
self.VElements["backpack_quad"].draw_func = function(Container)
//local Container = self:GetInventory()
draw.SimpleText("Slots Used: "..self.Owner:GetInventory():GetOpenSlots().." Of 16", "default", 0, 0, Color(Lerp(0.01 * self.Owner:GetInventory():GetOpenSlots(), 225, 18),Lerp(0.01 * self.Owner:GetInventory():GetOpenSlots(), 18, 225),18,155), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
end
//Lerp(0.01 * self.Owner:GetInventory():GetOpenSlots(), 225, 18),Lerp(0.01 * self.Owner:GetInventory():GetOpenSlots(), 18, 225),18,155
self.VElements["backpack_quad2"].draw_func = function(Container)
//local Container = self:GetInventory()
draw.SimpleText("Slots Free: "..self.Owner:GetInventory().Size - self.Owner:GetInventory():GetOpenSlots().." Of 16", "default", 0, 0, Color(225,0,0,225), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
end
end[/CODE]
[QUOTE=_Entity;46818848]Ok I understand it but where do I use it. For example I want to increment a networked Integer using the Lerp function but don't exactly know where to use the code. this is the function i'm using [code] function client:GiveEXP (amount)
self:SetNWInt("exp", self:GetCurEXP() + amount)
end [/code][/QUOTE]
Oh no, don't Lerp the networked variable! Lerp the rectangle's size instead
[QUOTE=makermod1;46818862]Attempt to Index a nil value? I think It's related to the quad that doesn't lerp. I could be wrong though.
-snip-[/QUOTE]
Well, you were missing an end
[lua]
function SWEP:Initialize()
if CLIENT then
self.VElements["backpack_quad"].draw_func = function(Container)
//local Container = self:GetInventory()
draw.SimpleText("Slots Used: "..self.Owner:GetInventory():GetOpenSlots().." Of 16", "default", 0, 0, Color(Lerp(0.01 * self.Owner:GetInventory():GetOpenSlots(), 225, 18),Lerp(0.01 * self.Owner:GetInventory():GetOpenSlots(), 18, 225),18,155), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
end
//Lerp(0.01 * self.Owner:GetInventory():GetOpenSlots(), 225, 18),Lerp(0.01 * self.Owner:GetInventory():GetOpenSlots(), 18, 225),18,155
self.VElements["backpack_quad2"].draw_func = function(Container)
//local Container = self:GetInventory()
draw.SimpleText("Slots Free: "..self.Owner:GetInventory().Size - self.Owner:GetInventory():GetOpenSlots().." Of 16", "default", 0, 0, Color(225,0,0,225), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
end
end
end
[/lua]
But the GetInventory() is probably returning nil. You're indexing it on the line you use .Size and :GetOpenSlots, you can try printing things to be sure
[QUOTE=Exho;46818874]Oh no, don't Lerp the networked variable! Lerp the rectangle's size instead[/QUOTE]
The bar i want to interpolate:
[code] draw.RoundedBox(0, 0, 0, math.Clamp(0, LocalPlayer():GetCurEXP() ) * 6.2, EXPBar:GetTall(), Color( 142, 68, 173, 255) ) [/code] this is what i have currently. I'm assuming this [QUOTE][code]-- the value
local value = 0;
-- the target value
local targetValue = 10;
-- the speed
-- this may not represent change per second
local speed = 20;
-- execute this every frame
-- linearly interpolate from whatever value is right now to targetValue
value = Lerp( speed * FrameTime( ), value, targetValue );[/code][/QUOTE] goes into the width parameter somehow? Or atleast the Lerp function? Im not sure (This is much harder 3am in the morning :suicide:)
[QUOTE=zerf;46818885]Well, you were missing an end
-LUASNIP-
But the GetInventory() is probably returning nil. You're indexing it on the line you use .Size and :GetOpenSlots, you can try printing things to be sure[/QUOTE]
Oops :|
Yeah, it freaks out when the player is dead. I honestly have no idea how to solve deal with the thing returning nil though.
**EDIT**
Added the end and now its complaining about this:
'<eof>' expected near 'end'
**EDIT** Removed the end and now its complaining about the first quad, I've got to have something wrong.
attempt to index a nil value
< snip > Magically fixed itself :dance:
so I am trying to display the player's team in a HUD (deathrun) the only problem I have is that it will not update when the player dies/ changes teams. My quess is you have to hook it up to a loop or something to refresh it every tick, but I don't know how to do that. I would appreciate help.
[CODE] ht = ScrH() - 165
local PlayerTeam = team.GetName(LocalPlayer():Team())
if PlayerTeam == "Death" then
draw.SimpleText( PlayerTeam, "comicfont01Team", hx + border+ 20+ 30, ht + border, Color( 160, 0, 0, 255 ), TEXT_ALIGN_LEFT )
elseif PlayerTeam == "Runner" then
draw.SimpleText( PlayerTeam, "comicfont01Team", hx + border+ 20+ 25, ht + border, Color( 3, 3, 160, 255 ), TEXT_ALIGN_LEFT )
elseif PlayerTeam == "Spectator" then
draw.SimpleText( PlayerTeam, "comicfont01Team", hx + border+ 20+ 5, ht + border, Color(10,10,10,255), TEXT_ALIGN_LEFT )
else
draw.SimpleText( PlayerTeam, "comicfont01Team", hx + 10, ht + border, Color(255,255,255,255), TEXT_ALIGN_LEFT )
end
[/CODE]
Sorry, you need to Log In to post a reply to this thread.