• Fixing a Hook
    3 replies, posted
I just need it to list the acceptable hooks under Jailbreak. [CODE]hook.Add("PostGamemodeLoaded","exclserver.melee.override",function() if gmod.GetGamemode().Name == "Trouble in Terrorist Town" then ES.MeleeBaseClass = "weapon_zm_improvised" elseif gmod.GetGamemode().Name == "Jail Break" then ES.MeleeBaseClass = "weapon_jb_ak47" ES.MeleeBaseClass = "weapon_jb_m4a1" ES.MeleeBaseClass = "weapon_jb_deagle" ES.MeleeBaseClass = "weapon_jb_knife" end[/CODE] I am trying to get ES.MeleeBaseClass to list, but it won't work. Also I am trying to get this to work. My changes: [CODE] ////This here is so that if they dont have the SWEP and they pick it off the ground, they are given the SWEP, or if they do have the SWEP and they pick it off the ground, they get ammo for it//// function ENT:Use(activator, caller) self.Entity:Remove() if (activator:IsPlayer()) then if activator:GetWeapon("weapon_jb_knife") == NULL then activator:Give("weapon_jb_knife") end end end[/CODE] Original: [CODE]function ENT:Use(activator, caller) self.Entity:Remove() if (activator:IsPlayer()) then if activator:GetWeapon("weapon_jb_knife") == NULL then activator:Give("weapon_jb_knife") else activator:GiveAmmo(1, "HelicopterGun") end end end[/CODE] Basically, I want to make it so they can't pick up the knife if they have "weapon_jb_knife." However, it still allows them to pick up the knife while holding the knife.
w...what Do you mean you want it as a table? Because this seems to be part of a different module that requires it to be a string As for the 2nd thing - [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerCanPickupWeapon]GM:PlayerCanPickupWeapon[/url]
[QUOTE=JasonMan34;51969308]w...what Do you mean you want it as a table? Because this seems to be part of a different module that requires it to be a string[/QUOTE] Trying to make it list. Currently it only works like this: [CODE]hook.Add("PostGamemodeLoaded","exclserver.melee.override",function() if gmod.GetGamemode().Name == "Trouble in Terrorist Town" then ES.MeleeBaseClass = "weapon_zm_improvised" elseif gmod.GetGamemode().Name == "Jail Break" then ES.MeleeBaseClass = "weapon_jb_ak47" end[/CODE] I want to make it use multiple weapons instead of one. [CODE]ES.MeleeBaseClass = ("weapon_jb_ak47", "weapon_jb_m4a1")[/CODE] This code won't work, but it is to give you an example. [editline]16th March 2017[/editline] [QUOTE=JasonMan34;51969308]w...what Do you mean you want it as a table? Because this seems to be part of a different module that requires it to be a string As for the 2nd thing - [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerCanPickupWeapon]GM:PlayerCanPickupWeapon[/url][/QUOTE] Like this? [CODE]hook.Add( "PlayerCanPickupWeapon", "noDoublePickup", function( ply, wep ) if ( ply:HasWeapon( "weapon_jb_knife" ) ) then return false end end )[/CODE] Also this is an entity. It is activating an entity to be converted into a Weapon. This code won't allow me to pick up the knife now. :P
If you have the knife, it won't let you pick up another one by default (As seen in the example here [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerCanPickupWeapon]GM:PlayerCanPickupWeapon[/url]) What is ES.MeleeBaseClass, what are you trying ti do with the table?
Sorry, you need to Log In to post a reply to this thread.