Author Topic: Stripguns  (Read 2388 times)

0 Members and 1 Guest are viewing this topic.

Offline Donkie

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Stripguns
« on: September 05, 2009, 07:23:15 AM »
Hello there folks!
New ulx function from me!
I dont know if this is already made but then its made again.
This function strips only the guns of the target. So you will still have the physgun, toolgun, gravgun and camera.
It also works in darkRP where it gives keys and that stuff. <-- Needs updating. (only works for jobs without any special sweps)
Paste at the end of the code in the ulx/lua/ulx/modules/fun.lua
Code: [Select]
function ulx.cc_stripguns( ply, command, argv, args )
if #argv < 1 then
ULib.tsay( ply, ulx.LOW_ARGS )
return
end

local targets, err = ULib.getUsers( argv[ 1 ], _, true, ply ) -- Enable keywords
if not targets then
ULib.tsay( ply, err )
return
end

for _, v in ipairs( targets ) do
ulx.logUserAct( ply, v, "#A stripped #T's guns." )
v:StripWeapons()
v:Give("weapon_physgun")
v:Give("weapon_physcannon")
v:Give("gmod_tool")
v:Give("gmod_camera")

if gamemode.Get("darkrp") == nil and gamemode.Get("Darkrp") == nil and gamemode.Get("DarkRp") == nil and gamemode.Get("DarkRP") == nil then
return
end
v:Give("keys")
v:Give("weapon_physcannon")
v:Give("gmod_camera")

if CfgVars["toolgun"] == 1 or v:HasPriv(ADMIN) or v:HasPriv(PTOOL) then
v:Give("gmod_tool")
end

if CfgVars["pocket"] == 1 then
v:Give("pocket")
end

if CfgVars["physgun"] == 1 or v:HasPriv(ADMIN) or v:HasPriv(PHYS) then
v:Give("weapon_physgun")
end
end
end
ulx.concommand( "stripguns", ulx.cc_stripguns, "<user(s)> - Strips user(s)'s guns, not physgun, toolgun, camera or gravgun. Also works with Darkrp!", ULib.ACCESS_ADMIN, "!stripguns", _, ulx.ID_PLAYER_HELP )
ulx.addToMenu( ulx.ID_MCLIENT, "Stripguns", "ulx stripguns" )
Untested but should work, command:
!stripguns <user(s)>
For using with darkrp, the darkrp gamemode folder needs to be named:
  • darkrp
  • Darkrp
  • DarkRp
  • DarkRP
kthxbai