25% off items for donator & donator get more points over time...



PS.Config.PointsOverTime = true -- Should players be given points over time?
PS.Config.PointsOverTimeDelay = 1 -- If so, how many minutes apart?
PS.Config.PointsOverTimeAmount = 10 -- And if so, how many points to give after the time?

-- Edit below if you know what you're doing


I want to make it so Donators get like 20 points every minute + 25% off all items.

Could you tell me where to edit all of this and if not make a quick code for me? That’d be really awesome.

if you’re using ulx just do



if ply:GetUserGroup() == "donor" then --or w/e your donator group is
PS.Config.PointsOverTimeAmount = 20
else
PS.Config.PointsOverTimeAmount = 10
end


do the same thing for prices, I don’t use Point shop so I can’t relaly help you there :stuck_out_tongue:

Doesn’t work, creates script errors.

That configuration option is for all players, there is no per player variable for the amount of points over time, it’ll have to be put in manually.

[editline]8th January 2013[/editline]

If you copied and pasted that code without putting it in a hook or anything, of course it’ll error.

So where do I start? What file? Which line? Any help would be appreciated as I said.

Forgive me if I’m being mean, but a good place to start is to learn lua. Try the Hello World example!

I swear to god I’ll be better off doing that, and then I’ll come back and charge $500 for every single beginner script/plugin, because that’s how FP works.

Welp you can pay me $500 to do this for you, or learn Lua.

Is this for points shop at a guess?

You need to check the lua really, not the config settings. Find the act that adds the points to the players and then do the math there for adding more to supporters.

I’d start first by searching the lua files for where “Config.PointsOverTimeAmount” is used as a start.



if PS.Config.PointsOverTime then
		timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
			self:PS_GivePoints(PS.Config.PointsOverTimeAmount)
			self:PS_Notify("You've been given ", PS.Config.PointsOverTimeAmount, " points for playing on the server!")
		end)
	end
end


And now?

Edit: Yes it is for Pointshop

I may not know pointshop., but I know Lua enough to say that’s probably what you’re looking for.

You’ll need to get their rank data and decide what their points over time should be, depending on what rank they are. I don’t know what you use for ranks, so I can’t really give you a code example.

“Donator” and I use ULX.

[lua]
if PS.Config.PointsOverTime then
timer.Create(‘PS_PointsOverTime_’ … self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
local pointsget = ( self:GetUserGroup() == “donator” ) and PS.Config.PointsOverTimeDonatorAmount or PS.Config.PointsOverTimeAmount

		self:PS_GivePoints( pointsget )
		self:PS_Notify("You've been given ", pointsget, " points for playing on the server!")
	end)
end

end
[/lua]

then in your config

[lua]
PS.Config.PointsOverTimeAmount = 10
PS.Config.PointsOverTimeDonatorAmount = 20
[/lua]

replace “donator” with whatever your usergroup is called for donators.

Can someone tell me why when I try to add more than one, it doesn’t work?

The gold one was working by itself just fine. Then I added the diamond one and only the diamond worked. Once I was in usergroup gold, it would give me the default point gain.

Here’s the sv_player_extension.lua


if PS.Config.PointsOverTime then
		timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
			local pointsget = ( self:GetUserGroup() == "gold" ) and PS.Config.PointsOverTimeGoldAmount or PS.Config.PointsOverTimeAmount
                       
			self:PS_GivePoints( pointsget )
			self:PS_Notify("You've been given ", pointsget, " points for playing on the server!")
		end)
	end
	
if PS.Config.PointsOverTime then
		timer.Create('PS_PointsOverTime_' .. self:UniqueID(), PS.Config.PointsOverTimeDelay * 60, 0, function()
			local pointsget = ( self:GetUserGroup() == "diamond" ) and PS.Config.PointsOverTimeDiamondAmount or PS.Config.PointsOverTimeAmount
                       
			self:PS_GivePoints( pointsget )
			self:PS_Notify("You've been given ", pointsget, " points for playing on the server!")
		end)
	end

end




Here’s the sh_config.lua


PS.Config.ShopKey = 'F3' -- F1, F2, F3 or F4, or blank to disable
PS.Config.ShopCommand = 'ps_shop' -- Console command to open the shop, set to blank to disable
PS.Config.ShopChatCommand = '!shop' -- Chat command to open the shop, set to blank to disable

PS.Config.NotifyOnJoin = true -- Should players be notified about opening the shop when they spawn?

PS.Config.PointsOverTime = true -- Should players be given points over time?
PS.Config.PointsOverTimeDelay = 1 -- If so, how many minutes apart?
PS.Config.PointsOverTimeAmount = 1 -- And if so, how many points to give after the time?

PS.Config.PointsOverTimeGoldAmount = 5
PS.Config.PointsOverTimeDiamondAmount = 10


PS.Config.AdminCanAccessAdminTab = false -- Can Admins access the Admin tab?
PS.Config.SuperAdminCanAccessAdminTab = true -- Can SuperAdmins access the Admin tab?

PS.Config.CanPlayersGivePoints = true -- Can players give points away to other players?
PS.Config.DisplayPreviewInMenu = true -- Can players see the preview of their items in the menu?

PS.Config.PointsName = 'Points' -- What are the points called?
PS.Config.SortItemsBy = 'Name' -- How are items sorted? Set to 'Price' to sort by price.

Why on earth do you have two if statements about the same thing? Just combine them into an elseif statement.

Could you provide an example for an extra rank? :eng101: I’m not too familiar with esleif’s.

I had an extra set of it because I’m fairly new to lua so I thought if I simply pasted it and changed the rank name, that it would work for that rank.