• How to give Death it's own weapon.
    9 replies, posted
Hello guys. I have two all questions today about deathrun. 1st question is how would I give Death it's own sepret weapon to hold, such as the death scythe instead of the crowbar. And my last question is how would I go about adding an extra weapon for the runners... Such as the new garrys mod fists along with the crowbar. Sorry to bug you guys, lol. I just need some help on this. Thanks.
I'm online right now on steam. Anyways, wherever the characters are given their weapons. Search for :Give( so to give the new weapons add: Player:Give( "weapon_fists" ) Player:Give( "weapon_crowbar" ) If you want them to select that weapon right away, after they're added: Player:SelectWeapon( "weapon_fists" )
-snip- Thanks, it worked lol. But how would I change Deaths weapon? or is it the same way?
-snip- didn't see you edited. You can remove Death's weapons then add your OWN weapon you want him to have.
[QUOTE=InfernalCookie;41544730]-snip- didn't see you edited. You can remove Death's weapons then add your OWN weapon you want him to have.[/QUOTE] Okay, also the weapon_fists show up as invisible. any idea why?
To remove all of Deaths weapons, use Player:StripWeapons( ) and then add your own. Use the SelectWeapon at the end to choose which weapon he pulls out on default. You need to use/actvate player classes on player spawn: [lua]function GM:PlayerSpawn( Player ) player_manager.SetPlayerClass( Player, "player_acecool_dev" ) player_manager.OnPlayerSpawn( Player ) player_manager.RunClass( Player, "Spawn" ) hook.Call( "PlayerSetModel", GAMEMODE, Player ) hook.Call( "PlayerLoadout", GAMEMODE, Player ) return true; end[/lua] And the class, important part is the vm hands var and get hands model function: [lua]// local PLAYER_CLASS = {} PLAYER_CLASS.DisplayName = "AcecoolDev Player Class" PLAYER_CLASS.WalkSpeed = 100 -- How fast to move when not running PLAYER_CLASS.RunSpeed = 300 -- How fast to move when running PLAYER_CLASS.CrouchedWalkSpeed = 0.3 -- Multiply move speed by this when crouching PLAYER_CLASS.DuckSpeed = 0.3 -- How fast to go from not ducking, to ducking PLAYER_CLASS.UnDuckSpeed = 0.3 -- How fast to go from ducking, to not ducking PLAYER_CLASS.JumpPower = 160 -- How powerful our jump should be PLAYER_CLASS.CanUseFlashlight = false -- Can we use the flashlight PLAYER_CLASS.MaxHealth = 100 -- Max health we can have PLAYER_CLASS.StartHealth = 100 -- How much health we start with PLAYER_CLASS.StartArmor = 0 -- How much armour we start with PLAYER_CLASS.DropWeaponOnDie = false -- Do we drop our weapon when we die PLAYER_CLASS.TeammateNoCollide = false -- Do we collide with teammates or run straight through them PLAYER_CLASS.AvoidPlayers = false -- Automatically swerves around other players PLAYER_CLASS.UseVMHands = true -- Uses viewmodel hands -- -- Name: PLAYER:GetHandsModel -- Desc: Called on player spawn to determine which hand model to use -- Arg1: -- Ret1: table|info|A table containing model, skin and body -- function PLAYER_CLASS:GetHandsModel() -- return { model = "models/weapons/c_arms_cstrike.mdl", skin = 1, body = "0100000" } local cl_playermodel = self.Player:GetInfo( "cl_playermodel" ) return player_manager.TranslatePlayerHands( cl_playermodel ) end player_manager.RegisterClass( "player_acecool_dev", PLAYER_CLASS, "player_default" )[/lua]
[QUOTE=Acecool;41544922]To remove all of Deaths weapons, use Player:StripWeapons( ) and then add your own. Use the SelectWeapon at the end to choose which weapon he pulls out on default. You need to use/actvate player classes on player spawn: [lua]function GM:PlayerSpawn( Player ) player_manager.SetPlayerClass( Player, "player_acecool_dev" ) player_manager.OnPlayerSpawn( Player ) player_manager.RunClass( Player, "Spawn" ) hook.Call( "PlayerSetModel", GAMEMODE, Player ) hook.Call( "PlayerLoadout", GAMEMODE, Player ) return true; end[/lua] And the class, important part is the vm hands var and get hands model function: [lua]// local PLAYER_CLASS = {} PLAYER_CLASS.DisplayName = "AcecoolDev Player Class" PLAYER_CLASS.WalkSpeed = 100 -- How fast to move when not running PLAYER_CLASS.RunSpeed = 300 -- How fast to move when running PLAYER_CLASS.CrouchedWalkSpeed = 0.3 -- Multiply move speed by this when crouching PLAYER_CLASS.DuckSpeed = 0.3 -- How fast to go from not ducking, to ducking PLAYER_CLASS.UnDuckSpeed = 0.3 -- How fast to go from ducking, to not ducking PLAYER_CLASS.JumpPower = 160 -- How powerful our jump should be PLAYER_CLASS.CanUseFlashlight = false -- Can we use the flashlight PLAYER_CLASS.MaxHealth = 100 -- Max health we can have PLAYER_CLASS.StartHealth = 100 -- How much health we start with PLAYER_CLASS.StartArmor = 0 -- How much armour we start with PLAYER_CLASS.DropWeaponOnDie = false -- Do we drop our weapon when we die PLAYER_CLASS.TeammateNoCollide = false -- Do we collide with teammates or run straight through them PLAYER_CLASS.AvoidPlayers = false -- Automatically swerves around other players PLAYER_CLASS.UseVMHands = true -- Uses viewmodel hands -- -- Name: PLAYER:GetHandsModel -- Desc: Called on player spawn to determine which hand model to use -- Arg1: -- Ret1: table|info|A table containing model, skin and body -- function PLAYER_CLASS:GetHandsModel() -- return { model = "models/weapons/c_arms_cstrike.mdl", skin = 1, body = "0100000" } local cl_playermodel = self.Player:GetInfo( "cl_playermodel" ) return player_manager.TranslatePlayerHands( cl_playermodel ) end player_manager.RegisterClass( "player_acecool_dev", PLAYER_CLASS, "player_default" )[/lua][/QUOTE] Now I would just like to say I'm a noob, SO I have no clue ware to put that code... So If you could help me out Juts a bit more that would be great :)
Sure, the class should be included in a shared file, PlayerSpawn is serverside. Basically, find PlayerSpawn in your game-mode and add this to it before the model and load-out are set. [lua] player_manager.SetPlayerClass( Player, "player_acecool_dev" ) player_manager.OnPlayerSpawn( Player ) player_manager.RunClass( Player, "Spawn" )[/lua]
Or instead of editing base class of gamemode you can remove them whenever player spawns: NOTE: This should be in a serverside folder, this is a serverside file, you can do this if you want to make it an addon: Create these folders inside addons folder: deathweap deathweap/addon.txt - Put whatever you want on it, copy paste from any addon you got deathweap/lua deathweap/lua/autorun deathweap/lua/autorun/load.lua deathweap/lua/death.lua load.lua: [lua] if SERVER then include("death.lua") end [/lua] death.lua: [lua] hook.Add("PlayerSpawn", "RemoveDeathWeap", function(ply) if ply:HasWeapon("weapon_crowbar") then ply:StripWeapon("weapon_crowbar") end end) [/lua]
Assuming death is a team with the ID 1 [LUA] function GM:PlayerLoadout( ply ) if ply:Team() == 1 then ply:Give("weapon_crowbar") end [/LUA]
Sorry, you need to Log In to post a reply to this thread.