So I took the original shock command, author I forgot the name of (sorry), and played with it a little to make it suit my tastes a bit more. Yet whenever I execute the command it gives me the following error in the server side console:
03:18:38 Lua Error: [ERROR] gamemodes/base/gamemode/player.lua:205: Tried to use a NULL entity!
1. GetClass - [C]:-1
2. old_hook_call - gamemodes/base/gamemode/player.lua:205
3. unknown - addons/pills/lua/includes/modules/momo/compat.lua:23
4. TakeDamageInfo - [C]:-1
5. call - addons/ulx/lua/ulx/modules/sh/bluenova-custom.lua:818
6. __fn - addons/ulib/lua/ulib/shared/commands.lua:943
7. unknown - addons/ulib/lua/ulib/shared/commands.lua:1306
8. pcall - [C]:-1
9. pcallError - addons/ulib/lua/ulib/shared/util.lua:570
10. fn - addons/ulib/lua/ulib/server/concommand.lua:67
11. old_hook_call - addons/ulib/lua/ulib/shared/hook.lua:109
12. unknown - addons/pills/lua/includes/modules/momo/compat.lua:23
The modified version is the following:
local zaptable = {
"ambient/energy/zap1.wav",
"ambient/energy/weld2.wav",
"ambient/levels/labs/electric_explosion3.wav",
"ambient/levels/labs/electric_explosion1.wav"
}
function ulx.shock( calling_ply, target_plys, damage )
for k,v in ipairs( target_plys ) do
local fx = EffectData()
fx:SetEntity( v )
fx:SetOrigin( v:GetPos() )
fx:SetStart( v:GetPos() )
fx:SetScale( 1 )
fx:SetMagnitude( 15 )
util.Effect( "TeslaHitboxes", fx )
v:EmitSound( tostring( table.Random( zaptable ) ) )
local dmginfo = DamageInfo()
dmginfo:SetDamage( damage )
dmginfo:SetDamageType( DMG_DISSOLVE )
v:TakeDamageInfo( dmginfo )
end
ulx.fancyLogAdmin( calling_ply, "#A has shocked #T", target_plys )
end
local shock = ulx.command( CATEGORY_NAME, "ulx shock", ulx.shock, "!shock" )
shock:addParam{ type=ULib.cmds.PlayersArg }
shock:addParam{ type=ULib.cmds.NumArg, default=1000, ULib.cmds.optional }
shock:defaultAccess( ULib.ACCESS_ADMIN )
shock:help( "Shock players" )
I tried everything I could think of and everything either ended with no changed results or the desired outcome of the command (basically a more fun version of slay) being changed.
Thanks for any help, advice, etc.
BlueNova,