• Help with give weapon on prophunt
    6 replies, posted
I have this [CODE]hook.Add("PlayerLoadout", "RandomUniqueName", function(ply) if ply:Team() == TEAM_HUNTERS then if pl:IsUserGroup("superadmin") then ply:Give("weapon_ss_cannon") return true --hides default loadout end end)[/CODE] but don't work. I need give me weapon when I'm hunter... Please help me Regards.
oh boy.. you should have a CLASS:Loadout function in your prophunt gamemode It will be something like this [lua] function CLASS:Loadout(pl) pl:GiveAmmo(64, "Buckshot") pl:GiveAmmo(255, "SMG1") pl:GiveAmmo(12, "357") pl:Give("weapon_crowbar") pl:Give("weapon_shotgun") pl:Give("weapon_smg1") pl:Give("item_ar2_grenade") pl:Give("weapon_357") local cl_defaultweapon = pl:GetInfo("cl_defaultweapon") if pl:HasWeapon(cl_defaultweapon) then pl:SelectWeapon(cl_defaultweapon) end end [/lua] Just add this [lua] if pl:IsUserGroup( "superadmin" ) then pl:Give("weapon_ss_cannon") end [/lua] So it'd be like [lua] function CLASS:Loadout(pl) if pl:IsUserGroup( "superadmin" ) then pl:Give("weapon_ss_cannon") end pl:GiveAmmo(64, "Buckshot") pl:GiveAmmo(255, "SMG1") pl:GiveAmmo(12, "357") pl:Give("weapon_crowbar") pl:Give("weapon_shotgun") pl:Give("weapon_smg1") pl:Give("item_ar2_grenade") pl:Give("weapon_357") local cl_defaultweapon = pl:GetInfo("cl_defaultweapon") if pl:HasWeapon(cl_defaultweapon) then pl:SelectWeapon(cl_defaultweapon) end end [/lua] and of course remember not to abuse ;)
The above code doesn't check if you're on TEAM_HUNTERS or not, also you can use IsSuperAdmin() and it will give to everyone superadmin & above in ulx for example. [CODE] function CLASS:Loadout(pl) if pl:Team() == TEAM_HUNTERS and pl:IsSuperAdmin() then pl:Give("weapon_ss_cannon") end pl:GiveAmmo(64, "Buckshot") pl:GiveAmmo(255, "SMG1") pl:GiveAmmo(12, "357") pl:Give("weapon_crowbar") pl:Give("weapon_shotgun") pl:Give("weapon_smg1") pl:Give("item_ar2_grenade") pl:Give("weapon_357") local cl_defaultweapon = pl:GetInfo("cl_defaultweapon") if pl:HasWeapon(cl_defaultweapon) then pl:SelectWeapon(cl_defaultweapon) end end [/CODE]
[QUOTE=JamesScott;51934743]The above code doesn't check if you're on TEAM_HUNTERS or not, also you can use IsSuperAdmin() and it will give to everyone superadmin & above in ulx for example. [/QUOTE] You don't know how prop hunt works.. it has separate folders for hunter and prop loadouts.. no need to check if player is hunter. Also, maybe he only wants it for the superadmin group rather than all groups that inherit superadmin.
[QUOTE=covey88;51934818]You don't know how prop hunt works.. it has separate folders for hunter and prop loadouts.. no need to check if player is hunter. Also, maybe he only wants it for the superadmin group rather than all groups that inherit superadmin.[/QUOTE] The second part was a suggestion, considering many people have an "owner" rank or something above superadmin. Also, I didn't know about the difference in loadouts, my bad, but it shouldn't stop it working anyway as their team is hunters - I took the reference from OP.
[QUOTE=JamesScott;51935829] Also, I didn't know about the difference in loadouts, my bad, but it shouldn't stop it working anyway as their team is hunters - I took the reference from OP.[/QUOTE] Maybe I was a bit harsh with that reply, my apologies. To the OP, either of our codes would work just fine. You can find that bit of code in prop_hunt>gamemode>player_class>class_hunter.lua
Thank you very much
Sorry, you need to Log In to post a reply to this thread.