There are multiple ways, but normally the simplest way to call another lua function is to just call the name of the function directly.
function my_function(calling_ply, target_ply)
... some_code ...
ulx.hp(calling_ply, target_ply, 200)
end
The name of the ULX hp function is 'ulx.hp()', and expects the same parameters be passed as your function (calling player, target player
S, and the amount of hp.
Here's the code for it at line 296 (as of this posting)
https://github.com/TeamUlysses/ulx/blob/master/lua/ulx/modules/sh/fun.lua#L296You _could_ call "ulx hp" using
RunConsoleCommand , but that adds the additional ULX checks that are likely not necessary in your situation, and could cause complication depending on the scope of the call.
All that being said, You don't need to use ulx.hp function. SetHealth is a standard Gmod function.
It's not special. See
Entity:SetHealthAnd, the command you wrote will likely not work "as is" right now, even without trying to add HP.
You're using ULib's Player
SArg in your command setup,
warlock:addParam{ type=ULib.cmds.PlayersArg }
and your function is being passed a table, even if it contains only one player.
You then try to treat your drawmaterialoverlay as a single player entity (even the variable name target_player is single/treated as one, and no, renaming it players won't fix it.)
You have a design decision - update the function to allow multiple targets (see the 'for' loop in the ulx.hp for how to do this), or, make it a single target using type=ULib.cmds.PlayerArg (no s) in your command setup; and then just you don't even have to use ulx.hp, you can use use target_ply:SetHealth(#)
My personal recommendation/opinion, don't even call ulx hp function, just make yours accept multiple targets using a for loop, adding the overlay and sethealth on each index.
Then your challenge is figuring out how to turn off warlock.