local CATEGORY_NAME = "Advanced Simplicity" -- Category name
function ulx.duel( ply, weapon, target ) -- Make the command
ply:ChatPrint( target, "Challenged #T to a duel with #s.", weapon ) -- Re tell the calling_ply
target:ChatPrint( ply, "#A challenged you to a duel with #s.", weapon ) -- Alerts the target
--[[
A hook! The messed up thing that ruined the last code as it did not incorperate the previous function arguments, so all commands were in the function( ply, text ) crap, which does not use the ulx.duel function with a ( ply, weapon, and a target ). So what I need here is something that detects if the target types !accept and if so run the commands below, not the ones inside the hook function.
]]--
sbox_godmode:GetConVar( "sbox_godmode" ) -- Gets original value of sbox_godmode, used later.
game.ConsoleCommand( "sbox_godmode 0" ) -- Makes the godmode off for all
game.ConsoleCommand( "ulx god *" ) -- Gods all the affected players from the sbox_godmode 1 revomal.
game.ConsoleCommand( ply, "ulx ungod #A,#T", target ) -- Un gods the ULX god from the Player and the Target
local function DisallowSpawnMenu( ) -- Blocks spawn menu to avoid cheating with other guns
if not ply:IsUserGroup( "superadmin" ) or target:IsUserGroup( "superadmin" ) then -- I want admins to be able to use the menu if things get out of hand.
return false -- So if they are an admin, return = end script, dont block the menu
end -- End the if
end -- end the DisallowSpawnMenu function
hook.Add( "SpawnMenuOpen", "DisallowSpawnMenu", DisallowSpawnMenu) -- A hook for the disallowing of the menu
ply:Give( weapon ) -- Gives the player the specified weapon
target:Give( weapon ) -- Gives the player the specified weapon
if weapon == "m9k_davy_crockett" or weapon == "m9k_orbital_strike" then -- I have the Addon M9K Specialties and the Davy unwelds/launches EVERY thing, orbitals, a pain in the butt because they are an insta kill.
ply:ChatPrint( "Nice try getting past URS, Davy Crockets and Orbital Air Strikes are NOT allowed!" ) -- URS would not block the ply:Give( weapon ), this blocks that.
target:ChatPrint( "Nice try getting past URS, Davy Crockets and Orbital Air Strikes are NOT allowed!" ) -- URS would not block the ply:Give( weapon ), this blocks that.
end -- End the if about Davies
PrintMessage( HUD_PRINTTALK, "Fight!" ) -- Alert to fight
if not ply:IsAlive() or target:IsAlive() then -- If they are dead, game over.
PrintMessage( HUD_PRINTTALK, "Duel over!" ) -- Say its over.
local function DisallowSpawnMenu( ) -- Re-allow spawn menu
return true -- No admin necessary here, just to end the function but turn on the Menu.
end -- End the function
hook.Add( "SpawnMenuOpen2", "DisallowSpawnMenu2", DisallowSpawnMenu) -- Same hook, renamed, as we had another one
game.ConsoleCommand( "ulx ungod *" ) -- Re god everyone
game.ConsoleCommand( "sbox_godmode" .. sbox_godmode:GetBool( "sbox_godmode" ) ) -- Grabs the value of the sbox_godmode before the game and sets it to that
end -- End the dead if statement
end -- End the duel function
local duel = ulx.command( CATEGORY_NAME, "ulx duel", ulx.duel, "!duel" ) -- Says its a ulx command, with the associated category, and the command to use it
duel:defaultAccess( ULib.ACCESS_ALL ) -- Everyone should be able to use the command
duel:addParam{ type = ULib.cmds.PlayerArg } -- Monkeymacman said this is necessary?
duel:help( "Duel a friend or enemy!" ) -- Help for the command.