Pointshop ULX Command, Send

I’m looking for a ULX command to partner with pointshop called send points.

I’m not a LUA wiz, but this is how I’d like it done:

“ulx sendpoints {name} {amount}”
!sendpoints {name} {amount}

If someone could give me a tutorial on how to do that, or send me aworking script :)P

Why don’t you take a look how the default ULX commands are written, for example ‘slap’: https://github.com/TeamUlysses/ulx/blob/master/lua/ulx/modules/sh/fun.lua#L3-L24

You can probably remove the ‘v:IsFrozen()’ check, since that doesn’t matter in your case.

Then, instead of the ‘ULib.slap’ function, use the Pointshop function to give points; http://pointshop.burt0n.net/player-meta-functions/points

Of course you’ll finally want to change variables relating to slap; such as ‘ulx.slap’, ‘!slap’ etc

The thing is with that, is that the Give points function from the burt0n wiki gives them the points from the server, it doesn’t send them from your own balance.

Check if the player has the points he’s trying to send, then take those points from the player and give the points to the player he’s sending them to.

PS_HasPoints, PS_TakePoints, and PS_GivePoints are what you’d most likely use for something like this.

This is off the top of my head, since I refuse to use ULX. Let me know if it works or not.

[lua]local CATEGORY_NAME = ‘Pointshop’

------------------- Pointshop Send Money -------------------
function ulx.sendMoney( callingPly, targetPlys, sentAmount )
local affectedPlys = {}
local playerWallet, totalSent = callingPly:PS_GetPoints(), sentAmount * #targetPlys

if (callingPly:PS_HasPoints(totalSent)) then
	for i=1, #targetPlys do
		local v = targetPlys*
		
		v:PS_GivePoints(sentAmount)			
		table.insert( affectedPlys, v )
	end
	
	callingPly:PS_TakePoints(totalSent)
end

ulx.fancyLogAdmin(callingPly, '#A sent #T #i money', affectedPlys, sentAmount)

end

local sendMoney = ulx.command(CATEGORY_NAME, ‘ulx send’, ulx.sendMoney, ‘!send’)
sendMoney:addParam{type=ULib.cmds.PlayersArg}
sendMoney:addParam{type=ULib.cmds.NumArg, min=0, default=0, hint=‘amount to send’, ULib.cmds.optional, ULib.cmds.round}
sendMoney:defaultAccess(ULib.ACCESS_ALL)
sendMoney:help(‘Sends money to the target(s).’)[/lua]