• WIP: PointShop
    528 replies, posted
i know a bit of lua but since im learning and im a human i guess i can make mistakes some times
Some players are getting this error: [lua]"Hook 'PointShop_PostPlayerDraw' Failed: [cl_pointshop.lua:252] attempt to index field 'Config' (a nil value)"[/lua] and therefor are unable to see any hats :> Tested on Dedi Server Edit: And also if you buy a hat, leave the server, and rejoin you will not be able to see ur hat unless u sell it and buy it gain ( losing the % of money depending on the cut)
[QUOTE=Kazak1;28335240]Some players are getting this error: [lua]"Hook 'PointShop_PostPlayerDraw' Failed: [cl_pointshop.lua:252] attempt to index field 'Config' (a nil value)"[/lua] and therefor are unable to see any hats :> Tested on Dedi Server Edit: And also if you buy a hat, leave the server, and rejoin you will not be able to see ur hat unless u sell it and buy it gain ( losing the % of money depending on the cut)[/QUOTE] I'm working on this.
[QUOTE=Mrkrabz;27479955]Right i put the default shop in, and when someone buy's an item everyone seems to get it, even new people who join.[/QUOTE] I got the same problem. :/
I'm rewriting the full thing from scratch because it's a complete mess. If you want a working version, checkout revision 61. It's only problem is glitchy hats.
[QUOTE=_Undefined;28339763]I'm rewriting the full thing from scratch because it's a complete mess. If you want a working version, checkout revision 61. It's only problem is glitchy hats.[/QUOTE] Speaking about rev 61. Im using at atm, slight customized but yeah. I havne touched the hat codes and they are working perfectly. Its only in singleplayer that it spazzes out, everything else is working.
[QUOTE=Crap-Head;28340391]Speaking about rev 61. Im using at atm, slight customized but yeah. I havne touched the hat codes and they are working perfectly. Its only in singleplayer that it spazzes out, everything else is working.[/QUOTE] Was there some code you'd worked on that you wanted adding to the SVN? [editline]28th February 2011[/editline] My rewrite will fix all the problems anyway, so I meant additional features.
Dunno if you got to try it out, but adding a few lines to the hat drawing function will fix the double model issue completly, tested on a dedicated server, with camera, without camera(auto-following), from another player's prespective, singleplayer, ect... [lua] hat.Model, pos, ang = hat.Modify(hat.Model, pos, ang) hat.Model:SetPos(pos) hat.Model:SetAngles(ang) hat.Model:SetRenderOrigin( pos ) hat.Model:SetRenderAngles( ang ) hat.Model:SetupBones() hat.Model:DrawModel() hat.Model:SetRenderOrigin() hat.Model:SetRenderAngles()[/lua]
[QUOTE=Kazak1;28341050]Dunno if you got to try it out, but adding a few lines to the hat drawing function will fix the double model issue completly, tested on a dedicated server, with camera, without camera(auto-following), from another player's prespective, singleplayer, ect... [lua] hat.Model, pos, ang = hat.Modify(hat.Model, pos, ang) hat.Model:SetPos(pos) hat.Model:SetAngles(ang) hat.Model:SetRenderOrigin( pos ) hat.Model:SetRenderAngles( ang ) hat.Model:SetupBones() hat.Model:DrawModel() hat.Model:SetRenderOrigin() hat.Model:SetRenderAngles()[/lua][/QUOTE] Yeah I've added that, thanks.
Just a tiny little fix but I might aswell mention it. The SpotlightHead item code "OnTake" function is currently like this: [lua] OnTake = function(ply, item) ply:PS_AddHat(item) end,[/lua] and should be changed to [lua] OnTake = function(ply, item) ply:PS_RemoveHat(item) end,[/lua] otherwise when ppl sell it, the model won't be removed.
[QUOTE=Kazak1;28341552]Just a tiny little fix but I might aswell mention it. The SpotlightHead item code "OnTake" function is currently like this: [lua] OnTake = function(ply, item) ply:PS_AddHat(item) end,[/lua] and should be changed to [lua] OnTake = function(ply, item) ply:PS_RemoveHat(item) end,[/lua] otherwise when ppl sell it, the model won't be removed.[/QUOTE] Wow, I'm a dumbass. Thanks.
[QUOTE=_Undefined;28341651]Wow, I'm a dumbass. Thanks.[/QUOTE] no ur not :P ur awesome doing this for free for the ppl ;D -- Also what script do I need to run to get a Hat's item ID in order to, for example: Remove a players hat using the hat-remove function.
The item ID's are taken from the filename of the item, in lowercase. Or did you mean programmatically?
So I can (f.e.) do run this: [lua]lua_run for k,v in pairs(player.GetAll()) do v:PS_RemoveHat(conehat100) end[/lua] to remove the "conehat" from all the players.
[QUOTE=Kazak1;28341834]So I can (f.e.) do run this: [lua]lua_run for k,v in pairs(player.GetAll()) do v:PS_RemoveHat(conehat100) end[/lua] to remove the "conehat" from all the players.[/QUOTE] I do think that if you either remove the file or disable the item, it will disapear from the shop AND from the players inventory.
[QUOTE=Kazak1;28341834]So I can (f.e.) do run this: [lua]lua_run for k,v in pairs(player.GetAll()) do v:PS_RemoveHat(conehat100) end[/lua] to remove the "conehat" from all the players.[/QUOTE] [lua]for _, ply in pairs(player.GetAll()) do ply:PS_RemoveHat(POINTSHOP.FindItemByID("conehat")) end[/lua] [editline]28th February 2011[/editline] That will only remove the clientside model stuff, though.
I asked this because of all the testing, ppl are getting free hats X)... but after all this is done I will want to remove them, so I might aswell reset the server's Pdata then ?
Heres the code that im actually triying to implement to add a third tab -- StorageTab local StorageTab = vgui.Create("DPanelList", POINTSHOP.Menu) StorageTab:SetSize(Tabs:GetWide() - 10, Tabs:GetTall() - 30) StorageTab:SetSpacing(5) StorageTab:SetPadding(5) StorageTab:EnableHorizontal(true) StorageTab:EnableVerticalScrollbar(false) for id, item_id in pairs(LocalPlayer():PS_GetItems()) do local item = POINTSHOP.FindItemByID(item_id) if item then if item.Model then local Icon = vgui.Create("DShopModel") Icon:SetData(item) Icon:SetSize(96, 96) Icon.Sell = true Icon.DoClick = function() local menu = DermaMenu() menu:AddOption("Sell", function() Derma_Query("Do you want to sell '" .. item.Name .. "' for " .. POINTSHOP.Config.SellCost(item.Cost) .. " points?", "Sell Item", "Yes", function() RunConsoleCommand("pointshop_sell", item_id) end, "No", function() end ) end) if item.Respawnable then menu:AddOption("Equip Item", function() RunConsoleCommand("pointshop_respawn", item_id) end) end menu:Open() end StorageTab:AddItem(Icon) elseif item.Material then Icon = vgui.Create("DShopMaterial") Icon:SetData(item) Icon:SetSize(96, 96) Icon.Sell = true Icon.DoClick = function() local menu = DermaMenu() menu:AddOption("Sell", function() Derma_Query("Do you want to sell '" .. item.Name .. "' for " .. POINTSHOP.Config.SellCost(item.Cost) .. " points?", "Sell Item", "Yes", function() RunConsoleCommand("pointshop_sell", item_id) end, "No", function() end ) end) if item.Respawnable then menu:AddOption("Equip Item", function() RunConsoleCommand("pointshop_respawn", item_id) end) end menu:Open() end StorageTab:AddItem(Icon) end end end Tabs:AddSheet("Storage", StorageTab, "gui/silkicons/box", false, false, "Browse your Storage") else if POINTSHOP.Menu then POINTSHOP.Menu:Remove() end end end) just for test i copied and paste inventory code and appareantly if i have more than 2 tabs i get [addons\pointshop\lua\cl_pointshop.lua:226] '<eof>' expected near 'else'
Paste line 226 and 10 lines either side of it. And mark 226 with a comment.
[QUOTE=werewolf0020;28443715]just for test i copied and paste inventory code and appareantly if i have more than 2 tabs i get [addons\pointshop\lua\cl_pointshop.lua:226] '<eof>' expected near 'else'[/QUOTE] The problem is not that you have more than 2 tabs, i have 3 tabs in the version i got. Imma go ingame and TRY and fix this now. Il report back either in this post, or in a new one. EDIT: Sorted. What are you are doing wrong is that you have to of these: [lua] else if POINTSHOP.Menu then POINTSHOP.Menu:Remove() end end end) [/lua] You are having one above the storage code and one under it. Remove the one above it/under the inventory code and then it shuld work fine. Atleast it works for me. Well i cannot equip anything as i dont have the newest version so i cant do "pointshop_respawn" (Im using REV 61). Il probably go ahead and try to implant that into rev 61. Il see what i can get out of it. Edit: Also a slightly bug report. I dont know if this is for all versions, but my PlayerDeath hook does not work. Meaning that you can only earn points by killing NPCs. Ive trying sorting the code but it all looks fine. I also looked in the newest revision and its the exact same code.
Sorry for the double post but i had a few new "bug reports" and this could also be taken as a slightly bump. Just see the pictures, shuld explain enough. [img]http://filesmelt.com/dl/Items_out1.jpg[/img] The items are out of the actually menu. [img]http://filesmelt.com/dl/Items_out_hover1.jpg[/img] You can JUST hold your mouse over the item and then it spins around out of the menu. Its not really anything that is a must, but i guess if you got time to it you could get around it. EDIT: Aww. What happend to the thumb tags? :/
[QUOTE=Crap-Head;28528691]Sorry for the double post but i had a few new "bug reports" and this could also be taken as a slightly bump. Just see the pictures, shuld explain enough. [img_thumb]http://filesmelt.com/dl/Items_out1.jpg[/img_thumb] The items are out of the actually menu. [img_thumb]http://filesmelt.com/dl/Items_out_hover1.jpg[/img_thumb] You can JUST hold your mouse over the item and then it spins around out of the menu. Its not really anything that is a must, but i guess if you got time to it you could get around it. EDIT: Aww. What happend to the thumb tags? :/[/QUOTE] I think someone posted a fix for this in the WAYWO thread. Something with the render library and scissors.
Alright so _Undefined, I am using your shop for my deathrun server, and i have a question. When people leave the server after buying a hat and come back the hat doesnt show up. Is there a way to fix this? I am using current version of pointshop, and need this fixed
I aren't working on it any more. Use revision 61 if you want a working copy.
[QUOTE=_Undefined;28709829]I aren't working on it any more. Use revision 61 if you want a working copy.[/QUOTE] sad =/
Does someone know how to make REV61 draw the models when a player buys it instantly ? instead of having to respawn in order to see it ?
Why would you stop working on this? [i]Why[/i]?
Exactly how do we get revision61? are there archives?
[QUOTE=Stinger771;28803714]Exactly how do we get revision61? are there archives?[/QUOTE] Posted this back on page 5 (or 6) Quoting myself: "Alright so for the people who does not know how to put back your SVN here is a little guide: 1. Right click your folder. 2. Press TortoiseSVN and then press Update to revision. 3. You will have a window appearing and you simply time in 61. It will delete the folder items and it will update some files aka downgrading them."
[QUOTE=Crap-Head;28528691]Sorry for the double post but i had a few new "bug reports" and this could also be taken as a slightly bump. Just see the pictures, shuld explain enough. [img_thumb]http://filesmelt.com/dl/Items_out1.jpg[/img_thumb] The items are out of the actually menu. [img_thumb]http://filesmelt.com/dl/Items_out_hover1.jpg[/img_thumb] You can JUST hold your mouse over the item and then it spins around out of the menu. Its not really anything that is a must, but i guess if you got time to it you could get around it. EDIT: Aww. What happend to the thumb tags? :/[/QUOTE] What version is this, i like it and want it!!! Also, REV 61 gives me the same old thing as the origonal post, the first version. I did what you said to do with tortoiuse and it said it did it but...... apperently not
Sorry, you need to Log In to post a reply to this thread.