[QUOTE=Hyper Iguana;35487788]I don't want to rely on the client for it.[/QUOTE]
but spamming concommands is?
[QUOTE=BlackAwps;35489165]Do DTVars conflict with NetworkedStrings or something? I can't figure out what the hell is going on here.
[lua]print( "body.GetName", rag:GetNWString( "playerName", "WHAT THE FUCK IS GOING ON" ) )[/lua]
This is returning a player object??
[code]body.GetName Player [1][BlackAwps][/code]
I do have a DT entity set, that should point to myself, on the ragdoll so I figured that it may be interfering somehow? I really just don't get it.[/QUOTE]
Code where you're setting the NWString? Maybe you set the NW string to the player object instead of the players name, and SetNWString ran tostring on it to give the result you're getting?
I'm pretty sure DTVars shouldn't conflict, but you could always double check. Remove the DT entity and see if it works? Or change the DT entity to another player (bot?) and see if body.GetName changes too?
[QUOTE=Banana Lord.;35489180]but spamming concommands is?[/QUOTE]
That's for him to realize that he's been muted. The return false is what is muting him.
[QUOTE=DarthTealc;35492646]Old versions of Gmod used to make a very short 'tick' sound whenever someone sent a text chat message. I've realised this doesn't happen any more, and would like to add it to the TTT server I help manage.
Did it happen in old versions of Gmod, or am I remembering incorrectly? I think it still does it in TF2. Is it possibly a console command? Or would I need to modify the chat box?[/QUOTE]
[b][url=wiki.garrysmod.com/?title=Gamemode.OnPlayerChat]Gamemode.OnPlayerChat [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[b][url=http://wiki.garrysmod.com/?title=Chat.PlaySound]Chat.PlaySound [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
[lua]
hook.Add( "OnPlayerChat", "PlayChatSound", function()
chat.PlaySound()
end )
[/lua]
how can i enable/disable a cloroed tint on a specific players screen?
ive tried everything i could think of
[QUOTE=comet1337;35496523]how can i enable/disable a cloroed tint on a specific players screen?
ive tried everything i could think of[/QUOTE]
Try something like this.
[lua]
if SERVER then
function _R.Player:EnabledTint()
umsg.Start("tint",self) --Sends user message to client.
umsg.End()
end
end
if CLIENT then
local tint=false
usermessage.Hook("tint",function() --Receives user message.
tint=not tint --Toggles tint boolean
end)
hook.Add("HUDPaint","tint",function()
if tint then
local w,h=surface.ScreenWidth(),surface.ScreenHeight()
draw.RoundedBox(0,0,0,w,h,Color(200,0,120,5)) --Draws a purple rectangle with 5 alpha.
end
end)
end
[/lua]
I'm lost on this one:
[code]
for k in pairs( t ) do
if not ( k:IsPlayer( ) or k:IsNPC( ) ) then
if k:Health( ) <= info:GetDamage( ) and k:Health( ) ~= 0 then
ErrorNoHalt( "Gibbing " .. tostring( k ) .. "\n" )
k:GibBreakClient( info:GetDamageForce( ) )
--k:TakeDamageInfo( info )
--k:Input( "Shatter" )
--k:Input( "Break" )
else
k:TakeDamageInfo( info )
end
else
k:TakeDamageInfo( info )
end
end
[/code]
info is a properly setup DamageInfo.
If you run this in the console:
[code]lua_run Entity( 1 ):GetEyeTrace( ).Entity:GibBreakClient( Entity( 1 ):GetAimVector( ) * 50 )[/code]
It works. Given the debug output is printer, I know the code block is being ran, but absolutely nothing happens - no gibs are generated.
[lua]timer.Simple( 0, k.GibBreakClient, k, force )[/lua] works though, so it is a weapon issue.
Never mind, I'm an idiot.
My problem was consisting in that I thought constraint.Rope wanted a local position in regards to the Entity, but it wants it in regards to the bone :|
[QUOTE=Kogitsune;35505927]I'm lost on this one:
[code]
for k in pairs( t ) do
if not ( k:IsPlayer( ) or k:IsNPC( ) ) then
if k:Health( ) <= info:GetDamage( ) and k:Health( ) ~= 0 then
ErrorNoHalt( "Gibbing " .. tostring( k ) .. "\n" )
k:GibBreakClient( info:GetDamageForce( ) )
--k:TakeDamageInfo( info )
--k:Input( "Shatter" )
--k:Input( "Break" )
else
k:TakeDamageInfo( info )
end
else
k:TakeDamageInfo( info )
end
end
[/code]
info is a properly setup DamageInfo.
If you run this in the console:
[code]lua_run Entity( 1 ):GetEyeTrace( ).Entity:GibBreakClient( Entity( 1 ):GetAimVector( ) * 50 )[/code]
It works. Given the debug output is printer, I know the code block is being ran, but absolutely nothing happens - no gibs are generated.
[lua]timer.Simple( 0, k.GibBreakClient, k, force )[/lua] works though, so it is a weapon issue.[/QUOTE]
[lua]
for k in pairs( t ) do
[/lua]
Sure that works how you want it to?
[lua] if (SERVER) then
AddCSLuaFile("autorun/ttt_points.lua")
end
------------------
-- PLAYER HOOK --
------------------
function playerDies( victim, weapon, killer )
if (victim:IsRole(ROLE_TRAITOR)) and (killer:IsRole(ROLE_INNOCENT)) and (killer:IsUserGroup("VIP")) then
killer:GivevipPoints(10, "[VIP] You've been given 10 credit for killing " .. victim:Name() .. " who was a traitor!")
elseif (victim:IsRole(ROLE_INNOCENT) or victim:IsRole(ROLE_DETECTIVE)) and (killer:IsRole(ROLE_TRAITOR)) and (killer:IsUserGroup("VIP")) then
killer:GivevipPoints(5, "[VIP] You've been given 5 credit for killing " .. victim:Name() .. " who was an innocent/detective!")
end
end
hook.Add( "PlayerDeath", "playerDeathCredits", playerDies ) [/lua]
I have this setup to give VIP's points for my vip shop when they kill traitors as innocents and when they kill a traitor as a innocent. But when I use this it doesn't work. The giving of the points works but not only to VIP. Any ideas?
Edit : Also,
[lua] if (SERVER) then
AddCSLuaFile("autorun/ttt_tags.lua")
end
if (CLIENT) then
function Insert( pl, msg )
local tab = {}
if pl:IsUserGroup( "owner" ) then
table.insert( tab, Color( 255, 47, 23, 255 ) )
table.insert( tab, "[Owner]" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
elseif pl:IsUserGroup( "coowner" ) then
table.insert( tab, Color( 255, 47, 23, 255 ) )
table.insert( tab, "[Co-Owner]" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
else pl:IsUserGroup( "moderator" ) then
table.insert( tab, Color( 251, 125, 0, 255 ) )
table.insert( tab, "[Moderator]" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
else pl:IsUserGroup( "admin" ) then
table.insert( tab, Color( 193, 0, 0, 255 ) )
table.insert( tab, "[Admin]" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
else pl:IsUserGroup( "headadmin" ) then
table.insert( tab, Color( 0, 128, 204, 255 ) )
table.insert( tab, "[Head Admin]" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
else pl:IsUserGroup( "tech" ) then
table.insert( tab, Color( 0, 255, 0, 255 ) )
table.insert( tab, "[Tech]" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
else pl:IsUserGroup( "cotech" ) then
table.insert( tab, Color( 0, 255, 0, 255 ) )
table.insert( tab, "[Co-Tech]" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
else pl:IsUserGroup( "respected" ) then
table.insert( tab, Color( 187, 72, 255, 255 ) )
table.insert( tab, "[Respected]" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
else pl:IsUserGroup( "vip" ) then
table.insert( tab, Color( 254, 221, 35, 255 ) )
table.insert( tab, "[VIP]" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
else
table.insert( tab, Color( 255, 216, 0, 255 ) )
table.insert( tab, "" )
table.insert( tab, Color( 255, 255, 255, 255 ) )
table.insert( tab, pl )
table.insert( tab, ": " )
table.insert( tab, msg )
end
chat.AddText( unpack(tab) )
return true
end
end
hook.Add("OnPlayerChat", "InsertTags", Insert) [/lua]
Results in
[url]http://cloud.steampowered.com/ugc/596966984567194034/B965A49CA8C4832C054EB1A56D4DD2388F60E7F2/[/url]
Not even sure why D:
Any ideas?
[QUOTE=Hoffa1337;35508145][lua]
for k in pairs( t ) do
[/lua]
Sure that works how you want it to?[/QUOTE]
Yes:
[code]t = {
[ "Apples" ] = 1,
[ "Bongos" ] = 2,
[ "Chariots" ] = 3,
[ "Dog" ] = 4,
}
for k in pairs( t ) do
print( k )
end[/code]
[code]Dog
Bongos
Apples
Chariots[/code]
Not exactly Lua but someone will probably know, where are crash dumps found for linux?
[QUOTE=Drakehawke;35517722]Not exactly Lua but someone will probably know, where are crash dumps found for linux?[/QUOTE]
/tmp/dumps I believe
[editline]10th April 2012[/editline]
my server doesn't write any for some reason though
[QUOTE=Banana Lord.;35518617]/tmp/dumps I believe
[editline]10th April 2012[/editline]
my server doesn't write any for some reason though[/QUOTE]
I get files but they're all empty, that what happens to you?
ok quick question i'm coding a turret spawner, and everything is working except when it spawns im using ( ent:SetAngles(self.Owner:GetAimVector:Angle()) ), which works.. but it goes at the angle my players eyes are to the ground. so what i need to know is how do i center it to spawn perfectly parallel to the ground without spawning partially in the ground. here's the snippet for the turret if you need it...
[lua]
local turret = ents.Create("npc_turret_floor")
if ValidEntity(turret) then
turret:SetPos(self.Owner:GetEyeTrace().HitPos)
turret:SetHealth(200)
turret:Spawn()
turret:PhysWake()
turret:SetAngles(self.Owner:GetAimVector():Angle())
local phys = turret:GetPhysicsObject()
if ValidEntity(phys) then
--phys:SetVelocity(vthrow)
phys:SetMass(100)
end
end
[/lua]
Neddy, you are using else, not elseif.
Also, for the turret, when you set it's position, you can makemit above the ground and use the DropToFloor method.
Anyone have any idea how to rotate an ragdolls head via its physobject?
Right now I'm trying to use ply:GetCurrentCommand() with GetMouseX() and GetMouseY() to turn the head respectively, with AddAngleVelocity and other functions but for some reason the CUserCmd is fucking up in my Think hook and saying it's not valid.
Not sure where to go from here.
[QUOTE=Kogitsune;35505927]I'm lost on this one:
-gib stuff-[/QUOTE]
I had this same problem recently in a scripted entity. I found if you spawn the model through the spawn menu and break it, GibBreakClient will from then on function normally. I assumed it was because the gib models need to be precached in order to work right which I guess the scripted entity wasn't doing. I never got to test that though, so I could be wrong.
[QUOTE=Feihc;35520100]Anyone have any idea how to rotate an ragdolls head via its physobject?
Right now I'm trying to use ply:GetCurrentCommand() with GetMouseX() and GetMouseY() to turn the head respectively, with AddAngleVelocity and other functions but for some reason the CUserCmd is fucking up in my Think hook and saying it's not valid.
Not sure where to go from here.[/QUOTE]
I could never get CUserCmd to work properly anywhere outside a Move hook, you could try putting it in there instead, I can't quite remember why now but I gave up with CUserCmd in the end and used ply:EyeAngles() instead.
Everything is fine and dandy up until you get a split second of freeze lag and get:
[code]
ERROR: GAMEMODE:'CalcView' Failed: [gamemodes\base\gamemode\cl_init.lua:460] attempt to call field 'CalcView' (a nil value)
[/code]
Which makes the body of the scripted vehicle go invisible:
[img]http://i203.photobucket.com/albums/aa111/Hoffa1337/gm_dddustbowl20001.jpg[/img]
My CalcView hook is obviously working since the camera positioning is unaffected its just the rendering of the vehicle.
Why is this happening? What can I do to stop it? It's been bugging me for a long time.
Are you guys making stuff for garrysmod 13 or the normal version?
i'm tempted to create a new gamemode but i'm unsure whether i should wait till garrysmod 13 is released publicly.
[QUOTE=Bambo.;35524479]Are you guys making stuff for garrysmod 13 or the normal version?
i'm tempted to create a new gamemode but i'm unsure whether i should wait till garrysmod 13 is released publicly.[/QUOTE]
If you're making an entire gamemode I'd probably do it for GMod 13 then release it at the same time, no-one really seems to know when it's going to happen though.
[QUOTE=Drakehawke;35524507]If you're making an entire gamemode I'd probably do it for GMod 13 then release it at the same time, no-one really seems to know when it's going to happen though.[/QUOTE]
Alright thanks.
[QUOTE=Drakehawke;35524507]If you're making an entire gamemode I'd probably do it for GMod 13 then release it at the same time, no-one really seems to know when it's going to happen though.[/QUOTE]
I'm sure there will be a week notice when garry is confident he's really close to completing everything.
So I have this bit of code to fade out the players view
[lua]
ply:SetNetworkedFloat("Vision", math.Approach(ply:GetNetworkedFloat("Vision"), 1, FrameTime() / 30))
surface.SetDrawColor(0,0,0,ply:GetNetworkedFloat("Vision") * 255)
surface.DrawRect(0,0,ScrW(), ScrH())
[/lua]
Which works fine, except for some reason as soon as the NWFloat hits its "Max" of 1, it resets to 0, and clears up the screen again. I have no idea why its doing it and it just started happening really. I'm not changing that value anywhere else besides initializing it when it should be, but the entity that does that gets removed when this code is being run, so that can't be changing it.
I'm very confused.
[editline]11th April 2012[/editline]
I just got rid of the NWFloats entirely, and it seems to be working with player vars on the client... just sucks that now I have to network those for what I want that var to do on the server
*shrugs* oh well.
-snip-, found what I was looking for.
Hpw exactly can I create a prop_physics clientside? Everything I've tried crashes my game :v:
Menu hook?
Like when you open your gmod...(gmod 13 uses "MenuStart" in the menu, but it doesn't work on other files)
I want to make this code:
[CODE]RunConsoleCommand( "my command", "1" )[/CODE]
will exec for players that joins to server
[QUOTE=airidas338;35553686]I want to make this code:
[CODE]RunConsoleCommand( "my command", "1" )[/CODE]
will exec for players that joins to server[/QUOTE]
[lua]
hook.Add("PlayerInitialSpawn", "MyInitSpawnFunc", function( ply )
ply:ConCommand( "my command", "1" )
end )
[/lua]
Sorry, you need to Log In to post a reply to this thread.