Console commands for Undefined's Pointshop?

Are there console commands for it? I need a console command that can give people points (basically the functionality of going into the admin tap, right clicking and selecting give points, but in a rcon console command)

if there are console commands, what is the give one? and also, if there arent but theres a known way of adding console commands to do what im trying to accomplish (give points for undefined’s pointshop), then please link thread.

EDIT::
I found this, but it dosen’t work…


concommand.Add("ps_give_points", function(ply, cmd, args)
	if #args != 2 then
		ply:ChatPrint("Missing arguments! ps_give_points <player-id> <points>")
		return
	end
	other = player.GetByID(args[1])
	points = tonumber(args[2])
	if points < 0 then
		ply:ChatPrint("You can't give a negative amount of points")
		return
	end
	if (ply:IsAdmin()) and other and points and IsValid(other) and other:IsPlayer() then
		other:PS_GivePoints(points)
		other:PS_Notify(ply:Nick(), ' gave you ', points, ' points.')
		ply:PS_Notify('You gave "', other:Nick(), '" ', points, ' points.')
	end
end)

“it doesn’t work” is simply not enough information. Do you get errors when the file loads or when you try to run the console command, and if so what is the error message. If the file loads with no error, what happens when you try the command?

Well no… the console command works, but the points aren’t given successfully when you do ps_give_points <name> <points> format

it works in a sense if you just type ps_give_points it tells you the correct format to type the console command, but the action dosen’t work (give the person the points)

The line that gets the player to give the points to:
[lua]other = player.GetByID(args[1])[/lua]

It’s doing GetByID (and using args[1]) so it expects the first argument to be a player id, not a name.
If you were the first and only person on the server then ‘ps_give_points 1 50’ should give you 50 points.


As for the rest of the code, it’s declaring ‘other’ and ‘points’ as global instead of local. This shouldn’t be a problem by itself but could easily result in undefined behaviour elsewhere.

I’m alone on my server and tried ps_give_points 1 50 and i got script errors… the way i installed this script was putting the posted code into a lua file then putting the lua file into lua > autorun (dont know if thats right)

The file should probably be in lua/autorun/server, OR it is fine inside lua/autorun if you wrap the code inside ‘if SERVER then’
[lua]if SERVER then
–that code
end[/lua]

Need the exact error to be able to help anymore.

Also do status in console to make sure you have the correct id…

How would you modify this code to work with steamids? I tried some stuff out but failed.