• PointMod - Earn points and buy items with them!
    214 replies, posted
[QUOTE=Siemz;25765031]ps_setpoints and ps_givepoints dont work :([/QUOTE] Didn't look at the code so I never added those. [QUOTE=Siemz;25765031]and cant see hats :p when i respawn ( thirdperson )[/QUOTE] Use a camera, and other people can see them.
[QUOTE=_Undefined;25767267]Didn't look at the code so I never added those. Use a camera, and other people can see them.[/QUOTE] k nice, :)
[QUOTE=_Undefined;25763575]Here ya go: [url]https://equinox-studios.svn.beanstalkapp.com/pointshop/[/url][/QUOTE] Is there anyway to change the button to bring up the shop? Also does this not work with Darkr? Everytime i try to buy eg. a hat from the PS i get this error. [@gamemodes\darkrp\gamemode\player.lua:340] bad argument #1 to 'floor' (number expected, got string)
Edit sh_config.lua? Post line 340 of player.lua.
Line 340: return math.floor(amount) >= 0 and self.DarkRPVars.money - math.floor(amount) >= 0 The whole function: function meta:CanAfford(amount) if not amount then return false end return math.floor(amount) >= 0 and self.DarkRPVars.money - math.floor(amount) >= 0 end Omg how did i miss sh_config -_-
Seems DarkRP uses the same function names I have. Updated.
I just tested it, it now lets me buy stuff but i had 550 points, went to buy a turtle hat for 100 points and it took all 550. I managed to get 175 points and bought a 50 point mask, but it always comes up with: [PS] -0 points! (bought No Entry Mask) and removes all my points.
Will look at it a little later when I get home from work.
what are the console commands/lua commands for setting/giving points? your mod looks awsome, but i need a way to give points.
Have you considered adding an optional MySQL storage system, for player by player settings? I had a working one for pointmod, so now I have to change that :P (I could send you the lua file if you want.)
[QUOTE=tgp1994;25790896]Have you considered adding an optional MySQL storage system, for player by player settings? I had a working one for pointmod, so now I have to change that :P (I could send you the lua file if you want.)[/QUOTE] sorry for posting this - @ on topic What do u mean like player settings colours etc ?
[QUOTE=Siemz;25791905]sorry for posting this - @ on topic What do u mean like player settings colours etc ?[/QUOTE] I suppose the only thing to save would be bought items.
[QUOTE=tgp1994;25798506]I suppose the only thing to save would be bought items.[/QUOTE] And points? Otherwise players would have like unlimited points.
I've made a MySQL PData (SetPData/GetPData) replacement (with local sql backup and sync), so I might bundle it into this. Will be a few days from now though.
Did you find out whats going on with Darkrp?
No was busy last night. Will prob be tomorrow or thurday when I fix it.
[QUOTE=Assault_Trooper;25800794]And points? Otherwise players would have like unlimited points.[/QUOTE] I knew I was forgetting something :P [editline]2nd November 2010[/editline] [QUOTE=_Undefined;25802715]I've made a MySQL PData (SetPData/GetPData) replacement (with local sql backup and sync), so I might bundle it into this. Will be a few days from now though.[/QUOTE] Awesome, thank you :) So will we be able to enter the database login information into the settings lua file?
Yeah. You'll just have to edit a config file and it'll just work.
[QUOTE=_Undefined;25825811]Yeah. You'll just have to edit a config file and it'll just work.[/QUOTE] Oh, and if you need any testing... I'll be watching the SVN :)
[QUOTE=tgp1994;25841989]Oh, and if you need any testing... I'll be watching the SVN :)[/QUOTE] Made a thread, if you're interested: [url]http://www.facepunch.com/threads/1022682-WIP-PointShop[/url]
Can you make it so if you die you lose points?
[QUOTE=CombineGuru;21904583][lua] local PointsToGive = 10 timer.Create( "GivePoints", 300, 0, function() for k, v in ipairs( player.GetAll() ) do v:GivePoints( PointsToGive ) end end ) [/lua][/QUOTE] How can i make it say something in chat when peoples get "payday" ? [editline]25th February 2011[/editline] 2 questions more.. 1. What files are the points saved in? 2. Every time i add more than 10 items in the shope its bug.. What to do?
Could you make me a special deathrun code, like everytime players win they earn 25 points, and every time the death wins he gets 15 points.
Sure I will do it for money
[QUOTE=CombineGuru;21719726][img_thumb]http://www.cubeupload.com/files/a40e00screen1.png[/img_thumb] [release][b]Name:[/b] PointMod [b]Features:[/b] Allows you to earn points and buy items in a shop! You can buy items by pressing F2 to get into the shop. Items are made in the sh/items.lua file, and it's easy to do. A few items have been included. You can also sell back items you have bought, for 1/3rd of the price. For example, if I bought an SMG for 100 points, I could sell it back for 33 points. I have included two admin-only commands - ps_setpoints <name> <value> and ps_givepoints <name> <value>. You can use these, but it is recommended to integrate this addon into another script or gamemode, you can do this with the ply:SetPoints(), ply:TakePoints(), and ply:GivePoints() functions. To add items, go to sh/items.lua. Here is an example item: [lua]PointMod.Items[7] = { "Sprays", "Have the ability to use a spray!", "models/Gibs/HGIBS.mdl", "sprays", 100, "PlayerSpray", function( ply ) return false end, true }[/lua] The format is: "Item Name", "Description", "Model", "Internal Name", Price, "Hook Name", function, default value to return if the person doesn't have the upgrade(optional). Enjoy :buddy: [b]Download:[/b] [url=http://www.garrysmod.org/downloads/?a=view&id=97699][img_thumb]http://www.garrysmod.org/img/?t=dll&id=97699[/img_thumb][/url] [/release][/QUOTE] hey can you help me? i have a xenomorph add on and when i ki it i get no points its a npc and i have a thing that makes it for killed npcs but how can i add the xenomorph in>
Hello, I use your famous pointmod systems and I am not so experinced with this type of lua. I am attempting to add a item in the sv folder that allows the user to deal more damage. I plan to use the fist.mdl for the picture. Your assitance would be very much appreciated and may result in cash as a token of graditude for your good will. Thank you for your time, help, and amazingly executed mod that has made my server a complete product. This simple addition would suite my server very well. If required I can use remote connections, but the best route would be to just email the coding. If you are intrested in a cash sum's details, I am willingly offering 7$ via Paypal. I hope to work out agreements in the future as well. Best wishes, Shane Snelling (freshtunafish).
[B]HOW TO CHANGE MENU FROM F2 TO F1, F3 OR F4[/B] Go to addon/pointmod/lua/autorun/sv/hooks.lua This is the original, which opens the menu with F2: [lua]hook.Add( "ShowTeam", "Points", function( ply ) datastream.StreamToClients( ply, "ShopItems", ply:GetItems() ) return false end )[/lua] This is what you should change it to for F1 [lua]hook.Add( "ShowHelp", "Points", function( ply ) datastream.StreamToClients( ply, "ShopItems", ply:GetItems() ) return false end )[/lua] F3: [lua]hook.Add( "ShowSpare1", "Points", function( ply ) datastream.StreamToClients( ply, "ShopItems", ply:GetItems() ) return false end )[/lua] F4: [lua]hook.Add( "ShowSpare2", "Points", function( ply ) datastream.StreamToClients( ply, "ShopItems", ply:GetItems() ) return false end )[/lua] Enjoy.
Now you spawn with the weapons. But i strip at the spawn. So How to this-> if you click it you get the item derect.
[QUOTE=CombineGuru;25039898][lua] hook.Add("PlayerGiveSWEP", "DisableSWEPSpawning", function( ply ) return( ply:IsSuperAdmin() ) end ) hook.Add("PlayerSpawnSWEP", "DisableSWEPSpawning", function( ply ) return( ply:IsSuperAdmin() ) end ) [/lua][/QUOTE] Where can I put this? Every time I try something I end up screwing the thing up lol
Someone please help me :) [editline]20th April 2011[/editline] [lua] require( "datastream" ) function PointMod.Menu( handler, id, encoded, decoded ) local MainFrame = vgui.Create( "DFrame" ) local sheet = vgui.Create( "DPropertySheet" ) local store = vgui.Create( "DLabel", sheet ) local inv = vgui.Create( "DLabel", sheet ) local pow = vgui.Create( "DLabel", sheet ) local sell = vgui.Create( "DLabel", sheet ) local IconList = vgui.Create( "DPanelList", store ) local IconList2 = vgui.Create( "DPanelList", inv ) local IconList3 = vgui.Create( "DPanelList", sell ) local IconList4 = vgui.Create( "DPanelList", pow ) local points = vgui.Create( "DLabel", MainFrame ) store:SetText( "Store" ) inv:SetText( "Enventory" ) sell:SetText( "Sell" ) MainFrame:Center() MainFrame:SetSize( 480, 380 ) MainFrame:SetPos( 300, 300 ) MainFrame:SetTitle( "MingeMod Store" ) MainFrame:MakePopup() function MainFrame:Paint() draw.RoundedBox( 0, 0, 0, self:GetWide(), self:GetTall(), Color( 0, 0 ,0 ,220 ) ) end sheet:SetParent( MainFrame ) sheet:SetPos( 5, 25 ) sheet:SetSize(430, 330 ) IconList:EnableVerticalScrollbar( true ) IconList:EnableHorizontal( true ) IconList:SetPadding( 4 ) IconList:SetPos( 5, 5 ) IconList:SetSize( 410, 310 ) IconList2:EnableVerticalScrollbar( true ) IconList2:EnableHorizontal( true ) IconList2:SetPadding( 4 ) IconList2:SetPos( 5, 5 ) IconList2:SetSize( 410, 310 ) IconList3:EnableVerticalScrollbar( true ) IconList3:EnableHorizontal( true ) IconList3:SetPadding( 4 ) IconList3:SetPos( 5, 5 ) IconList3:SetSize( 410, 310 ) IconList4:EnableVerticalScrollbar( true ) IconList4:EnableHorizontal( true ) IconList4:SetPadding( 4 ) IconList4:SetPos( 5, 5 ) IconList4:SetSize( 410, 310 ) points:SetText( "Wallet: " .. PointMod.Points .. " Points" ) points:SizeToContents() points:SetPos( 125, 230 ) for k, v in pairs( PointMod.Items ) do if !table.HasValue( decoded, v[4] ) then local icon = vgui.Create( "SpawnIcon", IconList ) icon:SetModel( v[3] ) icon:SetTooltip( "Name: " .. v[1] .. "\nDescription: " .. v[2] .. "\nPrice: " .. v[5] .. " points" ) IconList:AddItem( icon ) icon.DoClick = function( icon ) surface.PlaySound( "ui/buttonclickrelease.wav" ) RunConsoleCommand("ps_buy", v[4] ) points:SetText( "Wallet: " .. PointMod.Points .. " Points" ) end end end for k, v in pairs( PointMod.Items ) do if table.HasValue( decoded, v[4] ) then local icon = vgui.Create( "SpawnIcon", IconList2 ) icon:SetModel( v[3] ) icon:SetTooltip( "Name: " .. v[1] .. "\nDescription: " .. v[2] ) IconList2:AddItem( icon ) end end for k, v in pairs( PointMod.Items ) do if table.HasValue( decoded, v[4] ) then local icon = vgui.Create( "SpawnIcon", IconList3 ) icon:SetModel( v[3] ) icon:SetTooltip( "Name: " .. v[1] .. "\nDescription: " .. v[2] .. "\nSell Price: " .. math.Round( v[5] / 3 ) .. " points" ) IconList3:AddItem( icon ) icon.DoClick = function( icon ) surface.PlaySound( "ui/buttonclickrelease.wav" ) RunConsoleCommand("ps_sell", v[4] ) points:SetText( "Wallet: " .. PointMod.Points .. " Points" ) end end end sheet:AddSheet( "Store", store, "gui/silkicons/brick_add", false, false, "Purchase new items!" ) sheet:AddSheet( "Inventory", inv, "gui/silkicons/box", false, false, "View your existing items!" ) sheet:AddSheet( "Sell", sell, "gui/silkicons/folder_go", false, false, "Sell back items you've bought!" ) sheet:AddSheet( "PowerUps", store, "gui/silkicons/brick_add", false, false, "Purchase new powerups!" ) end datastream.Hook( "ShopItems", PointMod.Menu ) [/lua] Can someone tell me if this would add a extra menu? thanks.
Sorry, you need to Log In to post a reply to this thread.