For some reason, they still can hurt each other :/
(But I saw the message in the chat saying the cvar has changed)
Why is your server being weird? Fix it please. Turn sbox_godmode on and see if players can still hurt each other.
So what's up with resource.AddWorkshop() anyway, because I've been operating under the assumption that nothing is ever added unless you explicitly add it with the function. How much of [URL="http://wiki.garrysmod.com/page/resource/AddWorkshop"]this[/URL] is true? Specifically, is this correct: "The server's current map is also automatically added, if it is loaded from a workshop addon."? Because I've seen scripts and have gone through the trouble of making a script that adds maps based on which one is currently running.
How do you freeze a jeep? This code doesn't work.
[lua]
local count = jeep:GetPhysicsObjectCount()
for I = 0, count - 1 do
local p = jeep:GetPhysicsObjectNum(I)
if p:IsValid() then
p:EnableMotion(false)
end
end
[/lua]
I don't think you can? Evidently there was an issue with Linux where freezing vehicles would cause a crash. This is from a three second Google, so give me boxes if I'm way off.
Damn. I really need that.
[QUOTE=thegrb93;47434747]How do you freeze a jeep? This code doesn't work.
[lua]
local count = jeep:GetPhysicsObjectCount()
for I = 0, count - 1 do
local p = jeep:GetPhysicsObjectNum(I)
if p:IsValid() then
p:EnableMotion(false)
end
end
[/lua][/QUOTE]
Try setting MOVETYPE to MOVETYPE_NONE.
You could weld the jeep to the world, it would have a similar effect depending on what exactly you want it frozen for.
Is there a way to stop timers from pausing in single player when in the menu/console? It's not very important, it would just make my debugging a hell of a lot easier.
[QUOTE=James xX;47435450]Is there a way to stop timers from pausing in single player when in the menu/console? It's not very important, it would just make my debugging a hell of a lot easier.[/QUOTE]
Start a local multiplayer server. There's no other way.
[QUOTE=G4MB!T;47433392]Why is your server being weird? Fix it please. Turn sbox_godmode on and see if players can still hurt each other.[/QUOTE]
Here's my cfg file, something wrong inside it?
[CODE]
// General HL Cvars
mp_fraglimit 0
mp_footsteps 1
mp_flashlight 1
decalfrequency 60
mp_decals 100
mp_falldamage 1
sv_cheats 0
sv_maxrate 0
sv_minrate 100000
sv_maxupdaterate 60
sv_maxcmdrate 60
sv_timeout 120
sv_allowupload 0
sv_allowdownload 0
sbox_godmode 0
sbox_plpldamage 0
sbox_playergod 0
sv_allowlua 0
sbox_maxprops 100
sbox_maxtextscreens 5
sbox_maxvehicles 10
sbox_maxbuttons 10
sbox_maxsents 10
sv_noclip 0
sv_loadingurl "google.com"
[/CODE]
[QUOTE=Robotboy655;47435461]Start a local multiplayer server. There's no other way.[/QUOTE]
Yeah I've been doing that (after sending a day trying to find a flaw in my code that would cause my timers not to work properly). It's a shame though.
[QUOTE=James xX;47435525]Yeah I've been doing that (after sending a day trying to find a flaw in my code that would cause my timers not to work properly). It's a shame though.[/QUOTE]
You should be testing your addons on multiplayer anyway. Its better to test on multiplayer due to stuff like this.
[QUOTE=Lixquid;47435224]Try setting MOVETYPE to MOVETYPE_NONE.[/QUOTE]
Hey that works pretty well.
[QUOTE=RocknRolla513;47432794]Another question,
I was looking to modify the [URL="https://scriptfodder.com/scripts/view/669"]purge addon[/URL], to make the players invincible when the purge is not active.
Here are the two function from the sv_purge.lua:
(if you need the client one, ask me)
[CODE]
function Purge:Start()
timer.Stop("purgeDelay")
if !Purge.Enabled then return end
timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function()
MsgN("The Purge has begun!")
timer.Start("purgeLastsFor")
net.Start("PurgeStart")
net.Broadcast()
local playertable = player.GetAll()
if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end
for k,v in pairs(playertable) do
if !v:IsAdmin() then
for i,w in pairs(Purge.StrippedWeapons) do
v:StripWeapon(w)
end
end
end
Purge.Active = true
end)
end
[/CODE]
[CODE]
function Purge:End()
timer.Stop("purgeLastsFor")
if !Purge.Enabled then return end
timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function()
MsgN("End of the purge!")
timer.Start("purgeDelay")
net.Start("PurgeEnd")
net.Broadcast()
Purge.Active = false
local playertable = player.GetAll()
if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end
for k,v in pairs(playertable) do
if !v:IsAdmin() then
for i,w in pairs(Purge.StrippedWeapons) do
for j,ww in pairs(RPExtraTeams[v:Team()].weapons) do
if w == ww then
v:Give(w)
break
end
end
for j,ww in pairs(Purge.NoJobWeapons) do
if w == ww then
v:Give(w)
break
end
end
end
end
end
end)
end
[/CODE]
Is that possible?[/QUOTE]
Can someone help me with this please?
Use v:GodEnable()
[QUOTE=thegrb93;47435643]Use v:GodEnable()[/QUOTE]
I've already try it, but the player who connect after the purge ending still taking damages...
On player spawn check if purgeLastFor timer is running, if it is give them god
[QUOTE=AnonTakesOver;47435695]On player spawn check if purgeLastFor timer is running, if it does give them god[/QUOTE]
Can you write the code? (i'm a noob with Lua :( )
if you need the full lua, just PM me
[QUOTE=RocknRolla513;47435710]Can you write the code? (i'm a noob with Lua :( )
if you need the full lua, just PM me[/QUOTE]
It's easy to choke with a silver spoon down your throat.
Learn to code, I assume you run a server, how long you gonna keep getting people to code and fix your servers problems?
Google these terms:
PlayerSpawn GMod lua wiki
timer library GMod lua wiki
[QUOTE=RocknRolla513;47435710]Can you write the code? (i'm a noob with Lua :( )
if you need the full lua, just PM me[/QUOTE]
You didnt say that players who joined were taking damage, instead you just said "Players still take damage".
[lua]
function Purge:Start()
timer.Stop("purgeDelay")
if !Purge.Enabled then return end
timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function()
MsgN("The Purge has begun!")
timer.Start("purgeLastsFor")
net.Start("PurgeStart")
net.Broadcast()
local playertable = player.GetAll()
if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end
for k,v in pairs(playertable) do
if !v:IsAdmin() then
for i,w in pairs(Purge.StrippedWeapons) do
v:StripWeapon(w)
end
end
v:GodEnable(true);
end
Purge.Active = true
end)
end
function Purge:End()
timer.Stop("purgeLastsFor")
if !Purge.Enabled then return end
timer.Create("PurgeSyncTime", Purge.SyncTime, 1, function()
MsgN("End of the purge!")
timer.Start("purgeDelay")
net.Start("PurgeEnd")
net.Broadcast()
Purge.Active = false
local playertable = player.GetAll()
if !playertable then Purge.Active = true MsgN("Purge error: Player table is empty!") return end
for k,v in pairs(playertable) do
if !v:IsAdmin() then
for i,w in pairs(Purge.StrippedWeapons) do
for j,ww in pairs(RPExtraTeams[v:Team()].weapons) do
if w == ww then
v:Give(w)
break
end
end
for j,ww in pairs(Purge.NoJobWeapons) do
if w == ww then
v:Give(w)
break
end
end
end
end
v:GodEnable(false);
end
end)
end
hook.Add("PlayerSpawn", "PurgeGodMode", function(ply)
ply:GodEnable(Purge.Active);
end);
[/lua]
Quick edit: Apparently the code above doesnt work properly because I dont read the wiki about functions. He added me and solve the problem.
[editline]1st April 2015[/editline]
Shoo Anon >:(.
[QUOTE=G4MB!T;47435729]You didnt say that players who joined were taking damage, instead you just said "Players still take damage".
[lua]
CODE
[/lua]
[editline]1st April 2015[/editline]
Shoo Anon >:(.[/QUOTE]
Thanks for all your help once again
[QUOTE=ApplePart;47432594]I'm trying to make a headshot perk that creates an explosion on their head but for some reason it doesn't run any help would be appreciated
[LUA]hook.Add("PlayerDeath", "Explode", function( victim, killer)
if victim.lastHitGroup && victim.lastHitGroup == HITGROUP_HEAD then
local explode = ents.Create("env_explosion")
explode:Spawn()
explode:SetPos(victim:EyePos())
explode:SetOwner(ply)
explode:SetKeyValue("iMagnitude", 0)
explode:Fire("Explode", 1, 0)
end
end)[/LUA][/QUOTE]
Still need help with this if anyone can :V
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ScalePlayerDamage]GM/ScalePlayerDamage[/url]
Something like this might work.
[lua]
hook.Add("PlayerDeath", "Explode", function(victim, killer)
if (isnumber(victim.lastHitGroup) && victim.lastHitGroup == HITGROUP_HEAD && util.IsValidModel(victim:GetModel())) then
local explode = ents.Create("env_explosion")
explode:Spawn()
explode:SetPos(victim:GetAttachment(victim:LookupAttachment("eyes")).Pos);
explode:SetOwner(ply)
explode:SetKeyValue("iMagnitude", 0)
explode:Fire("Explode", 1, 0)
end
end)
hook.Add("ScalePlayerDamage", "Explode", function(ply, hg, dmginfo)
ply.lastHitGroup = hg;
end);
[/lua]
I know this will sound dense but I would like to log all damage to the console for only a specific ULX usergroup to see. Example: PlayerA damaged PlayerB for x HP with weapon_y. This would only be visible to ''moderators''.
Would this be possible? Could someone please start me off?
Thanks
Has anyone made a function to draw rotated text in a DLabel? PushModelMatrix doesn't work, probably because there already is a translation matrix.
[QUOTE=RogerRagequit;47436929]I know this will sound dense but I would like to log all damage to the console for only a specific ULX usergroup to see. Example: PlayerA damaged PlayerB for x HP with weapon_y. This would only be visible to ''moderators''.
Would this be possible? Could someone please start me off?
Thanks[/QUOTE]
use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/EntityTakeDamage]GM/EntityTakeDamage[/url]
add a [lua] if ply:IsUserGroup("user") then ... end[/lua]
add some logging code in the middle like:
[lua]
damageText = string.format("%s damaged %s for %sHP using %s", dmg:GetAttacker():Nick(), ply:Nick(), dmg:GetDamage(), dmg:GetInflictor())
for k,v in pairs(player.GetAll()) do
if v:IsUserGroup("moderator") then
v:PrintMessage(HUD_PRINTCONSOLE,damageText)
end
end
[/lua]
You'll have to fine tune the text because the inflictor is not always a weapon.. and you might even need to convert it to a readable name, but that should get you started..
edit: Probably will also have to make sure you are dealing with players, and not to assume the damage will always be between 2 players.
I am trying to animate a player's mouth by modifying the flex weights and it doesn't work on the flexes that are being used by [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/MouthMoveAnimation]GM/MouthMoveAnimation[/url]
[URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/base/gamemode/animations.lua#L267"]I used this as a reference[/URL]
My code:
[lua]function SWEP:SecondaryAttack()
self.Owner:EmitSound("weapons/VOLKSWAGEN/HORN1.WAV",511,math.Rand(80,120),1,CHAN_VOICE_BASE)
local ply = self:GetOwner()
local FlexNum = ply:GetFlexNum() - 1
if ( FlexNum <= 0 ) then return end
ply:SetFlexScale( 1 )
for i = 0, FlexNum - 1 do
local Name = ply:GetFlexName( i )
ply:SetFlexWeight( i, 0 )
//MsgN(Name.." "..ply:GetFlexWeight(i))
if ( Name == "jaw_drop" || Name == "right_part" || Name == "left_part" || Name == "right_mouth_drop" || Name == "left_mouth_drop" ) then
ply:SetFlexWeight( i, math.Rand(0,3) )
end
end
self.Weapon:SetNextSecondaryFire(CurTime())
self:ShootEffects()
end
[/lua]
Hello!
Was wondering if anyone can help me with 2 problems with the Applejack gamemode based off cider!
The first problem I am having is with the database, I have inputted the database details correctly and added the players table, however no player data is being saved to the database. The only error I can find is this:
ServerLog: [Debug] SQL Statement successful for "Zee89"
[Debug] SQL Statement successful for "Zee89"
The second error I am getting is with a tool made for the toolgun: [lua][ERROR] gamemodes/applejack/entities/weapons/gmod_tool/stools/door.lua:168: attempt to call field 'Create' (a nil value)
1. MakeGhostEntity - gamemodes/applejack/entities/weapons/gmod_tool/stools/door.lua:168
2. Think - gamemodes/applejack/entities/weapons/gmod_tool/stools/door.lua:192
3. unknown - gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua:197[/lua]
Here is the code I think it's talking about
[lua]-- This is in here so we can have all doors ghosted.
function TOOL:MakeGhostEntity( model, pos, angle )
if (!util.IsValidModel(model)) then return end
util.PrecacheModel( model )
// We do ghosting serverside in single player
// It's done clientside in multiplayer
if (SERVER && !game.SinglePlayer()) then return end
if (CLIENT && game.SinglePlayer()) then return end
// Release the old ghost entity
self:ReleaseGhostEntity()
self.GhostEntity = ents.Create( "prop_physics" )
// If there's too many entities we might not spawn..
if (!self.GhostEntity:IsValid()) then
self.GhostEntity = nil
return
end
self.GhostEntity:SetModel( model )
self.GhostEntity:SetPos( pos )
self.GhostEntity:SetAngles( angle )
self.GhostEntity:Spawn()
self.GhostEntity:SetSolid( SOLID_VPHYSICS );
self.GhostEntity:SetMoveType( MOVETYPE_NONE )
self.GhostEntity:SetNotSolid( true );
self.GhostEntity:SetRenderMode( RENDERMODE_TRANSALPHA )
self.GhostEntity:SetColor( 255, 255, 255, 150 )
end
function TOOL:Think()
if (!self.GhostEntity || !self.GhostEntity:IsValid() || self.GhostEntity:GetModel() != self:GetClientInfo( "model" )) then
self:MakeGhostEntity( self:GetClientInfo( "model" ), Vector(0,0,0), Angle(0,0,0) )
end
self:UpdateGhost( self.GhostEntity, self:GetOwner() )
end[/lua]
If anyone can shed some light on these issues it would be greatly appreciated! Thanks in advance :)
.
Sorry, you need to Log In to post a reply to this thread.