• Custom ULX command to work with Pointshop 2
    0 replies, posted
So I recently installed pointshop 2 onto my Prop Hunt server. With the old pointshop, I had a custom command that would give hunters a grenade (It worked through Pointshop because the grenade cost points.) But now I'm needing to re-write the code to work with Pointshop 2. Just wanting to see if anyone here can help me out before I go pay money for a simple code. Here's the code that worked with the old pointshop. [lua]local CATEGORY_NAME = "Utility" local PRICE = (750) --- Price per nade. local INVALID_RANK = ("You don't have access to that feature") --- Notifies player if they aren't in the correct rank. local NOT_ENOUGH_POINTS = ("You can't afford nades") --- Notifies player they don't have enough points. local INVALID_TEAM = ("You must be a hunter to buy nades.") --- Notifies player if they are on Props team. function ulx.buy( calling_ply, num ) local ranks = { ["superadmin"] = true, ["admin"] = true, ["user"] = true, ["Owner"] = true, ["Admin"] = true, ["VIP"] = true, ["custom rank"] = true, } if ranks[calling_ply:GetUserGroup()] then if calling_ply:Team() == TEAM_PROPS then calling_ply:PS_Notify(INVALID_TEAM) return else if calling_ply:Team() == TEAM_HUNTERS then if not calling_ply:PS_HasPoints(PRICE) then calling_ply:PS_Notify(NOT_ENOUGH_POINTS) return else for i=1,num do if calling_ply:PS_HasPoints(PRICE) then calling_ply:PS_TakePoints(PRICE) calling_ply:Give( "item_ar2_grenade" ) else calling_ply:PS_Notify(" ") return end end end end end else calling_ply:PS_Notify(INVALID_RANK) return end end local buy = ulx.command( CATEGORY_NAME, "ulx buy", ulx.buy, "!buy" ) buy:addParam{ type=ULib.cmds.NumArg, min=1, max=100, default=1, hint="Number of nades", ULib.cmds.optional, ULib.cmds.round } buy:defaultAccess( ULib.ACCESS_ALL) buy:help( "Buys nades" )[/lua] Any help is appreciated.
Sorry, you need to Log In to post a reply to this thread.