Don't know if this goes here- But I wonder where the clockwork content is stored? Going to try to make new weapons and outfits and shit but I can't find it anywhere.
So I've been working with net for the past few days and I'm stumpted. I get no errors in my gamemode, but they all don't work unless I reload my gamemode twice. It's very odd I've tried adding the net.Recive()'s before anything is loaded up but I still get the same problem.
I have to reload a clientside file in order for it to start working clientside.
So I've tried many things and its still not working heres how I set it up
[code]load.lua (util.NetworkAddString located here) -> cl_networking.lua (net.Recive is in here)
-> sv_player_ext.lua (net.Send is here)
[/code]
I have sv_player_ext.lua sending information on 'PlayerInitialSpawn.' but cl_networking.lua loads first
[B]HELP![/B]
Is there a way to disable automatic lua reloading when files are changed on a server?
[QUOTE=_NewBee;39449118]Is there a way to disable automatic lua reloading when files are changed on a server?[/QUOTE]
Just put sv_autorefresh 0 in your cfg.
Can anyone give me help to make my UnderDone RPG gamemode to Gmod13 version? It has some lua errors, thats why. So add me cause i need really much help. My steam name: Leevim
Well, I'm trying to learn how to make modules work for GMod 13. I went on the wiki([url]http://wiki.garrysmod.com/page/Creating_Binary_Modules[/url]) and followed the instructions, but I still can't make the most basic module following the example on the svn ([url]http://code.google.com/p/gmod-module-base[/url]). Any ideas?
I get the error
[lua]
[ERROR] addons/resizer/lua/autorun/resizer_main.lua:338: bad argument #2 to 'SetModelScale' (number expected, got no value)
1. SetModelScale - [C]:-1
2. fn - addons/resizer/lua/autorun/resizer_main.lua:338
3. unknown - addons/ulib/lua/ulib/shared/hook.lua:183
[/lua]
From using a resize command via ulx. This is the resizer_main.lua's problematic area
[lua]
if CLIENT then
--size update on client side
local function Tick( )
local k, v
for k, v in pairs( player.GetAll( ) ) do
--get scale and set model size and render bounds with it
local pscale = v:GetNetworkedFloat("PlScale")
if not pscale then
pscale = 1
end;
local ScaleVector = pscale * Vector(1,1,1)
v:SetModelScale( ScaleVector )
v:SetRenderBounds( pscale * Sizing.Default.StandingHull.Minimum, pscale * Sizing.Default.StandingHull.Maximum )
--get the view offset (shared function but executing it on client side fixes some screen shaking issues)
local vsc = v:GetNetworkedFloat("PlViewOffset")
if not vsc then
vsc = 1
end;
v:SetViewOffset( vsc*Sizing.Default.ViewOffset )
v:SetViewOffsetDucked( vsc*Sizing.Default.ViewOffsetDuck )
--get the player hull (again shared function but executing it on client side fixes some screen shaking issues)
local hsc = v:GetNetworkedFloat("PlHullScale")
if not hsc then
hsc = 1
end;
v:SetHull( hsc*Sizing.Default.StandingHull.Minimum , hsc*Sizing.Default.StandingHull.Maximum )
v:SetHullDuck( hsc*Sizing.Default.DuckingHull.Minimum , hsc*Sizing.Default.DuckingHull.Maximum )
end
end
hook.Add( "Tick", "Resizer.ClientTick", Tick )
end
[/lua]
I appreciate the help. The whole lua file can be found at: [url]http://pastebin.com/yY3byeRT[/url]
Is there any lua script that tells who has just left the server, and their steamID?
You want the PlayerDisconnected hook
I have following that links: [URL="https://www.youtube.com/watch?v=SI7y_TicU0M"]1[/URL] [URL="https://www.youtube.com/watch?v=D-dvHFIyL5o"]2[/URL]
and i cant run it. i cant find it on menu where i am starting single
what can i do about it?
[QUOTE=hellguy;39450849]Is there any lua script that tells who has just left the server, and their steamID?[/QUOTE]
Drop in a shared file.
[lua]if SERVER then
util.AddNetworkString("PlyDis")
hook.Add("PlayerDisconnected","playerdisconnected", function(ply)
net.Start("PlyDis")
net.WriteString(ply:Name())
net.WriteString(ply:SteamID())
net.Broadcast()
end)
else
net.Receive("PlyDis", function(len)
local name, id = net.ReadString(), net.ReadString()
chat.AddText( Color(255,0,0), name or "nil", Color(255,255,255)," Has Left The Server. SteamID: ", Color(255,0,0),id or "nil")
end)
end[/lua]
[QUOTE=Banana Lord.;39450891]You want the PlayerDisconnected hook[/QUOTE]
Yeah, wich also should tell the player's steamID in the disconnect message.
[QUOTE=Apozen;39450251]I get the error
[lua]
[ERROR] addons/resizer/lua/autorun/resizer_main.lua:338: bad argument #2 to 'SetModelScale' (number expected, got no value)
1. SetModelScale - [C]:-1
2. fn - addons/resizer/lua/autorun/resizer_main.lua:338
3. unknown - addons/ulib/lua/ulib/shared/hook.lua:183
[/lua]
From using a resize command via ulx. This is the resizer_main.lua's problematic area
[lua]
if CLIENT then
--size update on client side
local function Tick( )
local k, v
for k, v in pairs( player.GetAll( ) ) do
--get scale and set model size and render bounds with it
local pscale = v:GetNetworkedFloat("PlScale")
if not pscale then
pscale = 1
end;
local ScaleVector = pscale * Vector(1,1,1)
v:SetModelScale( ScaleVector )
v:SetRenderBounds( pscale * Sizing.Default.StandingHull.Minimum, pscale * Sizing.Default.StandingHull.Maximum )
--get the view offset (shared function but executing it on client side fixes some screen shaking issues)
local vsc = v:GetNetworkedFloat("PlViewOffset")
if not vsc then
vsc = 1
end;
v:SetViewOffset( vsc*Sizing.Default.ViewOffset )
v:SetViewOffsetDucked( vsc*Sizing.Default.ViewOffsetDuck )
--get the player hull (again shared function but executing it on client side fixes some screen shaking issues)
local hsc = v:GetNetworkedFloat("PlHullScale")
if not hsc then
hsc = 1
end;
v:SetHull( hsc*Sizing.Default.StandingHull.Minimum , hsc*Sizing.Default.StandingHull.Maximum )
v:SetHullDuck( hsc*Sizing.Default.DuckingHull.Minimum , hsc*Sizing.Default.DuckingHull.Maximum )
end
end
hook.Add( "Tick", "Resizer.ClientTick", Tick )
end
[/lua]
I appreciate the help. The whole lua file can be found at: [url]http://pastebin.com/yY3byeRT[/url][/QUOTE]
With GMOD13 SetModelScale now only accepts a scaler and a delta time for smooth transitions, if you don't care for that sort of stuff you can use replace:
[lua]
v:SetModelScale( ScaleVector )
[/lua]
with:
[lua]local mat = Matrix()
mat:Scale( ScaleVector )
v:EnableMatrix( "RenderMultiply", mat )
[/lua]
or with:
[lua]
v:SetModelScale( pscale, 1 ) -- 1 being how long you want the transition to last.
[/lua]
Is there any way to get gmod 13 version of gamemodes? If you guys have a thing to fix gamemodes lua files fast to gmod 13, tell me please.
[QUOTE=Science;39450968]Drop in a shared file.
if SERVER thenutil.AddNetworkString("PlyDis")hook.Add("PlayerDisconnected","playerdisconnected", function(ply) net.Start("PlyDis") net.WriteString(ply:Name()) net.WriteString(ply:SteamID()) net.Broadcast()end)elsenet.Receive("PlyDis", function(len) local name, id = net.ReadString(), net.ReadString() chat.AddText( Color(255,0,0), name or "nil", Color(255,255,255)," Has Left The Server. SteamID: ", Color(255,0,0),id or "nil")end)end[/QUOTE]
nvm, works like a charm
[QUOTE=EthanTheGreat;39446520]If you're referring to something that it's commonly known as an "Anti-AFK Kick Script" here:
[lua]
local KickLength = 600
local PlayerPositions = { }
timer.Create( "anti_afk_script", KickLength, 0, function( )
for _, ply in pairs( player.GetAll( )) do
if PlayerPositions[ply:UserID( )] and PlayerPositions[ply:UserID( )]:Distance( ply:GetPos( )) < 100 then
PlayerPositions[ply:UserID( )] = nil
ply:Kick( "You have been kicked for being afk for "..( KickLength / 60 ).." minute(s)." )
else
PlayerPositions[ply:UserID( )] = ply:GetPos( )
end
end
end )
[/lua][/QUOTE]
Thanks for that, but that isn't what I am generally looking for. I'm looking for a script to calculate and save time spent by players on my server so when they join they can see how long they have been playing on the server in total time. Hence the name "Time spent script".
I'm just looking for one that works well with gmod 13 and ttt together.
[QUOTE=The-Spy;39451306]Thanks for that, but that isn't what I am generally looking for. I'm looking for a script to calculate and save time spent by players on my server so when they join they can see how long they have been playing on the server in total time. Hence the name "Time spent script".
I'm just looking for one that works well with gmod 13 and ttt together.[/QUOTE]
Then, I'd use this function:
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index85a1.html[/url]
Just get the saved time, then add it to the function above.
I need help making a lua script for TTT, wich allows me to voice chat between admins(by holding a button), like the traitor voicechat, but only for admins, be them alive or dead
[QUOTE=hellguy;39453287]I need help making a lua script for TTT, wich allows me to voice chat between admins(by holding a button), like the traitor voicechat, but only for admins, be them alive or dead[/QUOTE]
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index1bc4.html[/url]
Thanks~
[QUOTE=infectiousCod;39455126]Hello I am trying to make a custom scoreboard for TTT But I am having a hard time trying to just witch the top picture.
Can anyone help me out on this?
I was redirected here so instead of making a new thread ill just post this.
I've read that you can do small changes to a scoreboard.
At the moment I want to start with small modding and switching or editing of currently existing things.
And the first thing i wanna know would be how to edit a scoreboard. And I'm not talking about colors or such but to add a image to it like the trouble in terrorist town. Just as an example
[URL="http://oi48.tinypic.com/wwi6nm.jpg"]http://oi48.tinypic.com/wwi6nm.jpg[/URL]
We have the current scoreboard.
I would want to edit and change it the top part to this
[IMG]http://i.imgur.com/SlRW4Tu.png[/IMG]
Any help would be great.[/QUOTE]
Look in the scoreboard code and try finding it yourself. This thread is for people who have already attempted something and need help correcting their code. If you're asking for someone to do this for you, then you'll want to go to the hire thread.
[QUOTE=Hyper Iguana;39455169]Look in the scoreboard code and try finding it yourself. This thread is for people who have already attempted something and need help correcting their code. If you're asking for someone to do this for you, then you'll want to go to the hire thread.[/QUOTE]
Alright then Ill just edit this out.
Hey people; I have a snippet of weapon code I need help with.
I'm trying to make the SWep make the player use an animation when you sprint, and as far as I know the animation doesn't have a specific enum for it.
[code]function SWEP:Anim(ply)
if self:KeyDown(IN_SPEED) then
--self.Owner:SetAnimation( ACT_SPRINT ) -- Doesn't use the right animation
-- "run_all_02" doesn't have a specific enum
--self:SendWeaponAnim( "run_all_02" )
self:SetAnimation( "run_all_02" )
end
end[/code]
What's the hook to make it use an animation by name?
How can I remove the death ragdoll that spawns when the player dies?
Got a script that used to work but it seems like the death ragdoll is now spawned on the client.
Can't use the PlayerDeath hook to get the death ragdoll because the hook is serverside (even though it's supposed to be shared now).
Can't use the CreateEntityRagdoll hook because it only runs on the server.
Anyone got any ideas?
I believe it's a call to objPl:CreateRagdoll( ) in DoPlayerDeath (serverside). You need to remove the ragdoll clientside?
[QUOTE=Sakarias88;39459084]Anyone got any ideas?[/QUOTE]
From base gamemode:
[lua]function GM:DoPlayerDeath( ply, attacker, dmginfo )
ply:CreateRagdoll()
-- points scoring..
end[/lua]
Just override the base gamemode DoPlayerDeath hook or return true in a DoPlayerDeath hook.
So I need some help with the TTT prep round sound. His code is
[code]resource.AddFile("sound/selected_b01.wav")
local function PlaySounds()
BroadcastLua('surface.PlaySound("selected_b01.wav")')
end
hook.Add("TTTPrepareRound", "Sounds", PlaySounds)[/code]
But for some reason it's not working so we need a little help. Thanks in advance.
[editline]3rd February 2013[/editline]
I am also very new to LUA so I don't know much.
[QUOTE=RobyYe;39461638]-Code-[/QUOTE]
Look at what I have here:
[code]function GM:OnPlayerChat( ply )
surface.PlaySound( "jessev92/ui/msgsend.wav" )
return true
end[/code]
That plays when someone chats; try replacing the OnPlayerChat with your own function & see if it works.
I wrote the one below this, and have no idea if it will work, but feel free to try it.
[code]function RoundStart( ply )
BroadcastLua( 'surface.PlaySound( "jessev92/ui/msgsend.wav" )' )
return true
end
hook.Add("TTTPrepareRound", "Sounds", RoundStart)[/code]
Hey guys I know I made a thread about this but nobody has answered my question yet...
Ok, so I posted in WDYNHO thread but nobody answered back and I need to fix this as fast as possible.
So I just got rid of NWVars and trying out the new net library. Now when I load up my gamemode for some strange reason the variables I have added do not work on the client. Meaning I don't believe they are being sent over for some reason. HOWEVER when I save a clientside file (reload clientside) the network library decides to start working for me on clientside.
I have a setup that is called from load.lua so it plays out to this:
[code]load.lua (util.NetworkAddString located here) -> cl_networking.lua (net.Recive is in here)
-> sv_player_ext.lua (net.Send is here)
[/code]
I get no errors what so ever, and have to reload clientside to actually receive data.
load.lua
[lua]
if ( SERVER ) then
util.AddNetworkString( "bs_Ammo" );
util.AddNetworkString( "bs_Ironsights" );
util.AddNetworkString( "bs_Hunger" );
util.AddNetworkString( "bs_Stamina" );
util.AddNetworkString( "bs_GoodEvil" );
AddCSLuaFile( "core/cl_networking.lua" );
AddCSLuaFile( "core/sh_player_ext.lua" );
AddCSLuaFile( "core/sh_animations.lua" );
AddCSLuaFile( "core/sh_weapon_sounds.lua" );
AddCSLuaFile( "core/cl_hud.lua" );
include( "core/sv_core.lua" );
include( "core/sv_player.lua" );
include( "core/sv_player_ext.lua" );
include( "core/sv_mission.lua" );
include( "core/sv_concommand.lua" );
include( "core/sh_player_ext.lua" );
include( "core/sh_animations.lua" );
include( "core/sh_weapon_sounds.lua" );
else
include( "core/cl_networking.lua" );
include( "core/sh_player_ext.lua" );
include( "core/sh_animations.lua" );
include( "core/sh_weapon_sounds.lua" );
include( "core/cl_hud.lua" );
end[/lua]
cl_networking.lua
[lua]
local ply = LocalPlayer();
//Ammunition = {};
net.Receive( "bs_Ammo", function( len )
//local str = net.ReadString();
//local amt = net.ReadInt( 32 );
local tbl = net.ReadTable();
//print( "Ammo: s = " .. str .. " | a = " .. amt );
//if ( table.HasValue( BrainStock.AmmoType, str ) ) then
// pl.Ammunition[ str ] = amt;
//end
ply.Ammunition = tbl;
end );
net.Receive( "bs_Ironsights", function( len )
local bool = net.ReadBit();
ply.bIronSights = tobool( bool );
end );
net.Receive( "bs_Hunger", function( len )
local amt = net.ReadInt( 8 );
ply.nHunger = amt;
end );
net.Receive( "bs_Stamina", function( len )
local amt = net.ReadFloat();
ply.fStamina = amt;
end );
net.Receive( "bs_GoodEvil", function( len )
local amt = net.ReadInt( 8 );
ply.nGoodEvil = amt;
end );
[/lua]
sv_player_ext.lua
[lua]
function meta:SetAmmoType( ammo, amt )
//self:SetNetworkedInt( ammo, amt );
self.Ammunition[ ammo ] = amt;
net.Start( "bs_Ammo" );
//net.WriteString( ammo );
//net.WriteInt( amt, 32 );
net.WriteTable( self.Ammunition );
net.Send( self );
end
function meta:AddAmmoType( ammo, amt )
self:SetAmmoType( ammo, self:AmmoType( ammo ) + amt );
end
function meta:SetIronSights( bool )
//self:SetNetworkedBool( "bIronSights", bool );
self.bIronSights = bool;
net.Start( "bs_Ironsights" );
net.WriteBit( bool );
net.Send( self );
if ( bool ) then
self:SetWalkSpeed( BrainStock.Configuration.WalkSpeed - 40 );
self:SetFOV( self:GetFOV() - 10, 0.2 );
else
self:SetWalkSpeed( BrainStock.Configuration.WalkSpeed );
self:SetFOV( 0, 0.2 );
end
end
function meta:SetHunger( int )
//self:SetNetworkedInt( "HUNGER", int );
self.nHunger = int;
net.Start( "bs_Hunger" );
net.WriteInt( int, 8 );
net.Send( self );
end
function meta:AddHunger( int )
self:SetHunger( self:GetHunger() + int );
end
function meta:SetStamina( int )
//self:SetNetworkedFloat( "STAMINA", int );
self.fStamina = int;
net.Start( "bs_Stamina" );
net.WriteFloat( int );
net.Send( self );
end
function meta:AddStamina( int )
self:SetStamina( self:GetStamina() + int );
if ( self:GetStamina() >= BrainStock.Configuration.MaxStamina ) then
self:SetStamina( BrainStock.Configuration.MaxStamina )
end
end
function meta:SetGoodEvil( int )
//self:SetNetworkedInt( "GOODEVIL", float );
self.nGoodEvil = int;
net.Start( "bs_GoodEvil" );
net.WriteInt( int, 8 );
net.Send( self );
end
function meta:AddGoodEvil( int )
self:SetGoodEvil( self:GetGoodEvil() + int );
if ( self:GetGoodEvil() > BrainStock.Configuration.MaxGoodEvil ) then
self:SetGoodEvil( BrainStock.Configuration.MaxGoodEvil );
elseif ( self:GetGoodEvil() < -BrainStock.Configuration.MaxGoodEvil ) then
self:SetGoodEvil( -BrainStock.Configuration.MaxGoodEvil );
end
end[/lua]
[QUOTE=JVanover;39462243]Look at what I have here:
[code]function GM:OnPlayerChat( ply )
surface.PlaySound( "jessev92/ui/msgsend.wav" )
return true
end[/code]
That plays when someone chats; try replacing the OnPlayerChat with your own function & see if it works.
I wrote the one below this, and have no idea if it will work, but feel free to try it.
[code]function RoundStart( ply )
BroadcastLua( 'surface.PlaySound( "jessev92/ui/msgsend.wav" )' )
return true
end
hook.Add("TTTPrepareRound", "Sounds", RoundStart)[/code][/QUOTE]Aww it didn't work.
Sorry, you need to Log In to post a reply to this thread.