• Help with modding Murder gamemode..
    3 replies, posted
Alright so I own a Murder server and it's relatively basic as far as addons and whatnot. My goal is to make it so that whenever a Bystander kills another Bystander, they are instantly ignited via the ULX command "ulx ignite <player>" as punishment for killing an innocent. Is this possible? If so, how might I go about it?
[url]http://wiki.garrysmod.com/page/GM/PlayerDeath[/url] Check if both bystander, dont know ulx, find whatever function it is to ignite and set it on attacker
Doesnt know anything about Murder but do something like this: [LUA]function IgniteBystander(victim,inflictor,attacker) if victim:IsBystander() and attacker:IsBystander() then attacker:Ignite() end end hook.Add("PlayerDeath", "BystanderPunishment", IgniteBystander)[/LUA]
Alright, so I was digging around through all the Murder gamemode files and the "sv_player.lua" seems to be the one to add the code. (at least that's my guess) I found this bit of code within the script that looks like it may be what i'm looking to modify. I'm just not sure WHAT exactly to change/modify. (I'm a lua noob) [CODE]function GM:DoPlayerDeath( ply, attacker, dmginfo ) for k, weapon in pairs(ply:GetWeapons()) do if weapon:GetClass() == "weapon_mu_magnum" then ply:DropWeapon(weapon) end end ply:Freeze(false) // why?, *sigh* ply:CreateRagdoll() local ent = ply:GetNWEntity("DeathRagdoll") if IsValid(ent) then ply:CSpectate(OBS_MODE_CHASE, ent) end ply:AddDeaths( 1 ) if ( attacker:IsValid() && attacker:IsPlayer() ) then if ( attacker == ply ) then attacker:AddFrags( -1 ) else attacker:AddFrags( 1 ) end end end local plyMeta = FindMetaTable("Player") function plyMeta:CalculateSpeed() // set the defaults local walk,run,canrun = 250,310,false local jumppower = 200 if self:GetMurderer() then canrun = true end if self.LastTKTime then walk = walk * 0.7 run = run * 0.7 jumppower = jumppower * 0.5 end // handcuffs -- if self:GetHandcuffed() then -- walk = walk * 0.3 -- jumppower = 150 -- canrun = false -- end -- if self:GetTasered() then -- walk = 40 -- jumppower = 100 -- canrun = false -- end // set out new speeds if canrun then self:SetRunSpeed(run) else self:SetRunSpeed(walk) end self.CanRun = canrun self:SetWalkSpeed(walk) self:SetJumpPower(jumppower) end local function isValid() return true end local function getPos(self) return self.pos end local function generateSpawnEntities(spawnList) local tbl = {} for k, pos in pairs(spawnList) do local t = {} t.IsValid = isValid t.GetPos = getPos t.pos = pos table.insert(tbl, t) end return tbl end function GM:PlayerSelectTeamSpawn( TeamID, pl ) local SpawnPoints = team.GetSpawnPoints( TeamID ) SpawnPoints = generateSpawnEntities(TeamSpawns["spawns"]) if ( !SpawnPoints || table.Count( SpawnPoints ) == 0 ) then return end local ChosenSpawnPoint = nil for i=0, 6 do local ChosenSpawnPoint = table.Random( SpawnPoints ) if ( GAMEMODE:IsSpawnpointSuitable( pl, ChosenSpawnPoint, i==6 ) ) then return ChosenSpawnPoint end end return ChosenSpawnPoint end function GM:PlayerDeathSound() // don't play sound return true end function GM:ScalePlayerDamage( ply, hitgroup, dmginfo ) // Don't scale it depending on hitgroup end function GM:PlayerDeath(ply, Inflictor, attacker ) self:DoRoundDeaths(ply, attacker) if !ply:GetMurderer() then self.MurdererLastKill = CurTime() local murderer local players = team.GetPlayers(2) for k,v in pairs(players) do if v:GetMurderer() then murderer = v end end if murderer then murderer:SetMurdererRevealed(false) end if IsValid(attacker) && attacker:IsPlayer() then if attacker:GetMurderer() then -- self:SendMessageAll("The murderer has struck again") elseif attacker != ply then if self.ShowBystanderTKs:GetBool() then local ct = ChatText() local col = attacker:GetPlayerColor() ct:Add(attacker:Nick() .. ", " .. attacker:GetBystanderName(), Color(col.x * 255, col.y * 255, col.z * 255)) ct:Add(" killed an innocent bystander") ct:SendAll() end attacker.LastTKTime = CurTime() attacker:CalculateSpeed() timer.Simple(0, function () if IsValid(attacker) && attacker:HasWeapon("weapon_mu_magnum") then local wep = attacker:GetWeapon("weapon_mu_magnum") wep.LastTK = attacker wep.LastTKTime = CurTime() attacker:DropWeapon(wep) end end) end else -- self:SendMessageAll("An bystander died in mysterious circumstances") end else if attacker != ply && IsValid(attacker) && attacker:IsPlayer() then local ct = ChatText() local col = attacker:GetPlayerColor() ct:Add(attacker:Nick() .. ", " .. attacker:GetBystanderName(), Color(col.x * 255, col.y * 255, col.z * 255)) ct:Add(" killed the murderer") ct:SendAll() else local ct = ChatText() ct:Add("The murderer died in mysterious circumstances") ct:SendAll() end end ply.NextSpawnTime = CurTime() + 5 ply.DeathTime = CurTime() ply.SpectateTime = CurTime() + 4 umsg.Start("rp_death", ply) umsg.Long(5) umsg.Long(4) umsg.End() if ( Inflictor && Inflictor == attacker && (Inflictor:IsPlayer() || Inflictor:IsNPC()) ) then Inflictor = Inflictor:GetActiveWeapon() if ( !Inflictor || Inflictor == NULL ) then Inflictor = attacker end end self:RagdollSetDeathDetails(ply, Inflictor, attacker) end function GM:PlayerDeathThink(ply) if self:CanRespawn(ply) then ply:Spawn() else self:ChooseSpectatee(ply) end end function EntityMeta:GetPlayerColor() return self.playerColor or Vector() end function EntityMeta:SetPlayerColor(vec) self.playerColor = vec self:SetNWVector("playerColor", vec) end function GM:PlayerFootstep(ply, pos, foot, sound, volume, filter) self:FootstepsOnFootstep(ply, pos, foot, sound, volume, filter) end function GM:PlayerCanPickupWeapon( ply, ent ) // can't pickup a weapon twice if ply:HasWeapon(ent:GetClass()) then return false end if ent:GetClass() == "weapon_mu_magnum" then // murderer can't have the gun if ply:GetMurderer() then return false end // penalty for killing a bystander if ply.LastTKTime && ply.LastTKTime + self:GetTKPenaltyTime() > CurTime() then if ply.TempGiveMagnum then ply.TempGiveMagnum = nil return true end return false end end if ent:GetClass() == "weapon_mu_knife" then // bystanders can't have the knife if !ply:GetMurderer() then return false end end return true end[/CODE] I just want to make sure it ONLY affects bystanders that kill EACHOTHER, and not when they kill the murderer.
Sorry, you need to Log In to post a reply to this thread.