Looks good :)
Would this work on other gamemodes? Also How would I change the default key to something else?
Yes, it should be gamemode independent. Change the key in sh_config.lua.
Hey, if I wanted to make something admin buyable, how would I go about doing that? Also wonderful mod, easier to use then the other one.
Thank's in advance.
Add a function under an items 'Functions', like so:
Functions = { CanPlayerBuy = function(ply) if ply:IsAdmin() then return true, "" end return false, "Only admins can buy this!" end }
Use that for now, and I'll add an option to make each item admin only.
Looking good. I might even use it.
Awesome, thank you!
Updated. The headcrab hat is admin only as an example. Few things in the OP which I will add later.
Functions = { CanPlayerBuy = function( ply ) return ply:IsAdmin(), ply:IsAdmin() and "" or "Only admins can buy this!" end }
Sexy.
I keep getting this error when trying to buy an admin only item...[addons\pointmod\lua\sv_pointshop.lua:76] attempt to call method 'admin' (a nil value)
Does your line 76 look like this?
if item.AdminOnly and not ply:IsAdmin() then
if item.AdminOnly and not ply:admin() then
I'm using ulx, I don't know if that makes a difference.
On the inventory panel with all the items (the turtle, the frying pan, etc.) I wouldn't have every single item rotating at the same time -- it's a little overwhelming and doesn't serve much of a purpose. Rather, if you wanted to use that effect it would look better to make it so the item rotates whenever you hover over the item -- essentially, transform the rotation animation into a hover state.
I figured it out!
if item.AdminOnly and not ply:admin() then
Should beif item.AdminOnly and not ply:IsAdmin() then
OOOOhhh... I read yours wrong, that could've saved me loads of time... Now I feel dumb.
Edit:
Hey I am getting another error, when I buy something it says
"[PS] -0 points!" and takes away all of my points. The item was worth 15, but it took away 21.
Updated. See OP for new image. Also should have fixed DarkRP problems, if someone could test and let me know.
If people have added the functions provided in this to their gamemode etc, please update them to include the PS_ prefix, for example, ply:GivePoints() is now ply:PS_GivePoints().
For some reason I can't open the shop any more. I can still get points, but when I press F2 (the key I use) the shop won't even, I tried changing it to F3, and then F4, but it didn't work.
No errors?
None
Strange. Could you try moving the addon folder and redownloading from svn to make sure its not corrupt or something?
Sure hold on...
Well that sucks, guess it did. Hopefully I can move over all my items though...
Very strange. I'm going to make it easier to add/remove items shortly, with a folder of files rather than a table in one file, so people can drag and drop items.
I was able to move over the items without any problems. I wonder what broke it. Anyways this update is pretty kickass. Like how the hats and stuff now spin when you hover over them instead of like before when they just spun.
Nice job! Can't wait to see more updates.
Are we going to be able to do this:
Functions = { Draw = function(self) self:DrawModel() end }
To draw for the item in the shop or in the world?
Sweet ill give this a go on my server see if it works now :)
More errors, now when I try to buy something from the shop (I tried a clean install without changing anything, didn't work) I get this error where there is no limit on how many items:
[addons\pointmod\lua\sv_pointshop.lua:100] attempt to call method 'GiveItem' (a nil value)
And this when there is a limit on how many items you can own:
addons\pointmod\lua\sv_pointshop.lua:90] attempt to call method 'NumItemsFromCategory' (a nil value)
Here is the function for line 100:
ply:GiveItem(item_id, true) end)
And for 90:
if category.NumAllowedItems and ply:NumItemsFromCategory(category) >= category.NumAllowedItems then -- More than would never happen, but just incase. ply:PS_Notify('You can only have ' .. category.NumAllowedItems .. ' items from the ' .. category.Name .. ' category!') return end
I should also note that this error prevents items from spawning/working.
Fixed, thanks.
Working with MySQL?
Not yet. Will do it tomorrow.
Hey I am still getting this error, when I buy something it says
"[PS] -0 points!" and takes away all of my points. The item was worth 15, but it took away 21. It is doing this with all of the items. No error messages in console.
Try that, should be fixed, was a typo.
Alright, it's fixed!
Can't wait for the MySQL capability :) Are you sure you don't want my script, _Undefined?
Awesome, this is way better with mysql. Was waiting for gbps script, but it looks like he lost it in a hdd crash.
-snip-
HURR, im dumb
Edited:
Timer error: @lua/includes/modules/glon.lua:381 expected string to decode! (Got type table)
Just using the normal time-point system.
Anyone know how I could give me myself money or can you not?
ps_givemoney playername money, if I recall correctly.
Did not work.