• PointMod - Earn points and buy items with them!
    214 replies, posted
[img]http://www.cubeupload.com/files/a40e00screen1.png[/img] [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]http://www.garrysmod.org/img/?t=dll&id=97699[/img][/url] [/release]
Yay! first comment! One quick question tought, those ply:SetPoints(), ply:TakePoints() and ply:GivePoints. Just use the command in the gamemode, and have the addon installed? I don't need to "combine" this with the gamemode or anything? Only make sure it's installed in addons? Sorry if this is a stupid question tought, just wondering :P
[QUOTE=Norway174;21720335]Yay! first comment! One quick question tought, those ply:SetPoints(), ply:TakePoints() and ply:GivePoints. Just use the command in the gamemode, and have the addon installed? I don't need to "combine" this with the gamemode or anything? Only make sure it's installed in addons? Sorry if this is a stupid question tought, just wondering :P[/QUOTE] Yes, you put it in addons.
38 reading? What?
[QUOTE=Dlaor;21721221]38 reading? What?[/QUOTE] 44 now :smug:
"Item Name", "Description", "Model", "Internal Name", Price, "Hook Name", function, hmmm...Give me an example anyone? as in, Do this for the SMG but fill out the things in quotation marks. Nevermind, I found the lua.
Lol, 6 said it was useful, 4 said its dumb. (at the time of this post)
Interesting, I've actually wanted this kind of thing in a server. [IMG]http://www.facepunch.com/fp/rating/wrench.png[/IMG]
Question, how do get said points? :P if you get points for killing people, i think i have a good use for it.
[QUOTE=Waffle Boxes;21726833]Question, how do get said points? :P if you get points for killing people, i think i have a good use for it.[/QUOTE] As I said, this is not really meant to be stand-alone, it's to be used with other scripts and/or gamemodes. For what you want: [lua] hook.Add( "DoPlayerDeath", "Points", function( ply, attacker ) if ValidEntity( attacker ) and attacker:IsPlayer() then attacker:GivePoints( 5 ) end end ) [/lua] Stick that in sv/hooks.lua or make a new file in sv/ .
Does this support the spawning of other ENT's through purchase? Or do all entities have to be made part of this addon? For example: Could I use this to make a shop for buying SEnts from SBEP without editing the SBEP files?
[QUOTE=Jeffman12;21727365]Does this support the spawning of other ENT's through purchase? Or do all entities have to be made part of this addon?[/QUOTE] [b][url=http://wiki.garrysmod.com/?title=Ents.Create]Ents.Create [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] [editline]03:54AM[/editline] Currently it uses hooks. Do you want to make it so that they get the ent whenever they spawn?
I have a problem. I might be a noob, but I was wondering, If I wanted a citizen to spawn with me to help me in standalone, how would I acomplish that? (please note: I am a noob in lua)
[QUOTE=blackrock;21728300]I have a problem. I might be a noob, but I was wondering, If I wanted a citizen to spawn with me to help me in standalone, how would I acomplish that? (please note: I am a noob in lua)[/QUOTE] You could try giving the player an npc_citizen in the PlayerSpawn hook with ply:Give().
[QUOTE=CombineGuru;21727112]As I said, this is not really meant to be stand-alone, it's to be used with other scripts and/or gamemodes. For what you want: [lua] hook.Add( "DoPlayerDeath", "Points", function( ply, attacker ) if ValidEntity( attacker ) and attacker:IsPlayer() then attacker:GivePoints( 5 ) end end ) [/lua] Stick that in sv/hooks.lua or make a new file in sv/ .[/QUOTE] Sweet, thanks a bunch!
Nice.
It's like the L4D2 Item Buy system. But In gmod.
[QUOTE=The-Legendsmith;21731467]It's like the L4D2 Item Buy system. But In gmod.[/QUOTE] What?, L4D2 doesn't have a "Item Buy system".
Probably a source/meta-mod thing. I tried this for a test. PointMod.Items[1] = { "Die", "dead", "models/gibs/HGIBS.mdl", "skull", 1, "Player", function( ply ) ply:Kill() end } But it doesn't kill. No errors. Does the hook matter? If so, which should I be using?
[QUOTE=Bletotum;21744833]Probably a source/meta-mod thing. I tried this for a test. PointMod.Items[1] = { "Die", "dead", "models/gibs/HGIBS.mdl", "skull", 1, "Player", function( ply ) ply:Kill() end } But it doesn't kill. No errors. Does the hook matter? If so, which should I be using?[/QUOTE] 7:18 PM - 'Seth: "Player" is not a hook. In the next version, a new hook will be added, "PlayerBuyItem", where you can do this.
Yeah that was a placeholder. I've used PlayerSpray and done this instead. [img]http://i44.tinypic.com/2s6ssg9.jpg[/img] I would hope that PlayerBuyItem can make things that auto-delete from the inventory after being bought too. Or just things you can click inside the inventory to use. EDIT: Also, I hope that the window autoupdates without reloading it in the next one too.
It looks pretty nice. Good job. Also, hooray! Someone else is using the transparent black for the DFrames! Suggestion: your HUD is pretty terrible. Try thinking of a different idea than just words and numbers in a box. However, if that's all you can think of, instead of just throwing it on the HUD do it kind of like the Sassilization money count, where it appears on your screen when looking at the scoreboard [or pressing some key].
Is it possible to rename "points" to something else like credits or money or resource points without crashing too much? Might integrate it in my upcoming gamemode with your full credit for this addon. :)
[QUOTE=Uzalon;21752038]Is it possible to rename "points" to something else like credits or money or resource points without crashing too much? Might integrate it in my upcoming gamemode with your full credit for this addon. :)[/QUOTE] cl/hud.lua and cl/menu.lua
[QUOTE=Uzalon;21752038]Is it possible to rename "points" to something else like credits or money or resource points without crashing too much? Might integrate it in my upcoming gamemode with your full credit for this addon. :)[/QUOTE] You don't have an "upcoming gamemode", if you can't figure out how to change a word in a lua file.
Sweet, wrench for giving me a good base to start my multi-server donation coin system!
[QUOTE=Bletotum;21764682]You don't have an "upcoming gamemode", if you can't figure out how to change a word in a lua file.[/QUOTE] A great truth. In other news, This system is great!
So you finished it, looks cool.
A quick suggestion would be the ability to have items that can be used in the inventory, and items that are deleted when used or bought. I'll be doing this soon, but it seems natural for it to have it by default.
i guess im retarded but whenever i use the playerloadout commands and give it never gives me anything its very weird. it does specify ingame what it will give you would i have to integrate points mod in my gamemode. if so this is going to suck
Sorry, you need to Log In to post a reply to this thread.