Wizey, dude, let me explain
for ... do...
[b]end[/b]
function ...(...)
...
[b]end[/b]
if ... then ... [b]end[/b]
while ... do ...
[b]end[/b]
hook.Add("...", "...", ...) [b]no end[/b]
hook.Add("...", "...", function ...(...)
...
[b]end, the end belongs to the function inside this hook.Add[/b])
[url=http://www.lua.org/pil/4.3.html]Lua provides a small and conventional set of control structures, with if for conditional and while, repeat, and for for iteration. All control structures have an explicit terminator: end terminates the if, for and while structures; and until terminates the repeat structure.
[/url]
Same for functions, they need an end.
arguments of functions, like in hook.Add, do not need ends.
Well contented to what ive tryed, Nothing seems to be working. So either the new system is broken... Or im just to stupid to even get it working, The stupid end isnt really a possiblity since ive been making sweps for like the past couple of months XD
Again, I invite you to post your code so we can show you what it should look like, so you can see what you're doing wrong and learn from it.
IS it me or is does the bottom of this page look fucked up? all the avatars are on wierd spots and the writing is scattered everywhere o.O
[QUOTE=Wizey!;17158293]IS it me or is does the bottom of this page look fucked up? all the avatars are on wierd spots and the writing is scattered everywhere o.O[/QUOTE]
Well done! You have once again failed to produce your item code! Could it be that you're only complaining for the sake of complaining, rather than actually hoping to end up with working product?
[QUOTE=Wizey!;17156541]Or im just to stupid to even get it working,[/QUOTE]
That.
I liked the old way of making items better.
Damn this page is fucked up....
[code]
-- This particular items table, must have it.
local ITEM = { }
-- The UniqueID for this item, this is used to spawn the item and it's the ID for the item. Text always has to be lowered.
ITEM.UniqueID = "ammokit"
-- The model that will be shown in the inventory and on the map.
ITEM.Model = "models/Items/ammopack_small.mdl"
-- The name for this item, used in the inventory menu.
ITEM.Name = "Small Ammo Kit"
-- The description for this item, used in the inventory menu.
ITEM.Description = "Gives you a small amount of ammo."
-- Remove this item from the inventory when you press use on it?
-- True will make it remove, false will make it stay.
ITEM.RemoveOnUse = true
-- The USE item function.
if ( SERVER ) then -- Only used on server so use this check.
function ITEM:USE( ply )
ply:GiveAmmo(75,"smg1")
ply:GiveAmmo(75,"ar2")
ply:GiveAmmo(25,"buckshot")
ply:GiveAmmo(15,"357")
ply:GiveAmmo(200,"pistol")
ply:GiveAmmo(20,"xbowbolt")
end
end
-- Register the item so it exists in the main stuff.
InventoryAddon:RegisterItem( ITEM )[/code]
[QUOTE=Wizey!;17176340]Damn this page is fucked up....
[code]
-- This particular items table, must have it.
local ITEM = { }
-- The UniqueID for this item, this is used to spawn the item and it's the ID for the item. Text always has to be lowered.
ITEM.UniqueID = "ammokit"
-- The model that will be shown in the inventory and on the map.
ITEM.Model = "models/Items/ammopack_small.mdl"
-- The name for this item, used in the inventory menu.
ITEM.Name = "Small Ammo Kit"
-- The description for this item, used in the inventory menu.
ITEM.Description = "Gives you a small amount of ammo."
-- Remove this item from the inventory when you press use on it?
-- True will make it remove, false will make it stay.
ITEM.RemoveOnUse = true
-- The USE item function.
if ( SERVER ) then -- Only used on server so use this check.
function ITEM:USE( ply )
ply:GiveAmmo(75,"smg1")
ply:GiveAmmo(75,"ar2")
ply:GiveAmmo(25,"buckshot")
ply:GiveAmmo(15,"357")
ply:GiveAmmo(200,"pistol")
ply:GiveAmmo(20,"xbowbolt")
end
end
-- Register the item so it exists in the main stuff.
InventoryAddon:RegisterItem( ITEM )[/code][/QUOTE]
Replace the last line with [lua]InventoryAddon:NewItem( ITEM.Name, ITEM.Description, ITEM.Model, ITEM.RemoveOnUse, true, nil, function(ply) ITEM:Use(ply) end ) [/lua]
I am unsure of the folder structure, but you will also require a script in the place the new script wants items to loop through your items folder.
[editline]07:35PM[/editline]
Or, to convert your item to the single function method:
[lua]InventoryAddon:NewItem("Small Ammo Kit", "Gives you a small amount of ammo.", "models/Items/ammopack_small.mdl", true, true, nil, function( Entity )
Entity:GiveAmmo(75,"smg1")
Entity:GiveAmmo(75,"ar2")
Entity:GiveAmmo(25,"buckshot")
Entity:GiveAmmo(15,"357")
Entity:GiveAmmo(200,"pistol")
Entity:GiveAmmo(20,"xbowbolt")
end) [/lua]
Thats funny. even when i made a new Garrysmod folder, with just the inventory addon all by itself in there...
...It still errors, and it only worked once.
Something aint right ._.
I wonder how chew got ban exactly?
What rule did he break?
I hope he gets unbanned soon. This inventory Addon shows alot of promise and i'd like to see it get fixed T.T
I was really enjoying it.
But what i hoped for is is to make a item to fully restore armor, health and all means of ammunition.
I have a question. If I can get inventory addon to work... Although i wont do much LUAing since i cant even make a donut weapon or such... what is the coding for Battery? I'd like to know so if this does get fixed, i can add that to my "Full restore" Item xD
I used some of the coding stated above for weapons, i added health for a full 1000.
Now i need to know one for restoring armor.
[QUOTE=Xemgoa;17382209]This inventory Addon shows alot of promise and i'd like to see it get fixed T.T[/QUOTE]
You're doing something horribly wrong then, it works fine for me.
Thats just it! I never did anything to it. Its messing up. One moment...
Hook 'LoadInventoryData' Failed: includes/modules/glon.lua:327: Unknown type ID, 34!
Hook 'InventoryAddonPickupItem' Failed: IA_init.lua:57: attempt to index field 'InventoryAddon' (a nil value)
Either is changed that way, i probably didnt have this... "glon" lua or such, and i'd fix this if i could redownload Inventory Addon2.20 but since this lad is banned, somehow it disappeared.
Something isnt right, some help Ms.?
I mean seriously, it gives me the first line on startup...
then when i spawn a healthkit prop... it says the second line...am i really doing something wrong?
Garrysmod comes with glon, doesn't it?
Did you purchase garrysmod?
[QUOTE=Zero Cucumber;17052717]Ehh, what do you want to save? The shipment crates and stick them in your inventory? I don't believe that can be done.[/QUOTE]
Anything can be done.
Its working again when i deleted the inventory addon stuff in the Data folder. its good as new now ^^
-- This particular items table, must have it.
local ITEM = { }
-- The UniqueID for this item, this is used to spawn the item and it's the ID for the item. Text always has to be lowered.
ITEM.UniqueID = "ammopack_large"
-- The model that will be shown in the inventory and on the map.
ITEM.Model = "models/Items/ammopack_large.mdl"
-- The name for this item, used in the inventory menu.
ITEM.Name = "Largeammopack"
-- The description for this item, used in the inventory menu.
ITEM.Description = "A reusable ammo box that refills health and ammo entirely. But not armor till that is figured out."
-- Remove this item from the inventory when you press use on it?
-- True will make it remove, false will make it stay.
ITEM.RemoveOnUse = false
-- The USE item function.
if ( SERVER ) then -- Only used on server so use this check.
function ITEM:USE( ply )
ply:SetHealth( ply:Health() + 1000 )
ply:GiveAmmo(9999,"smg1")
ply:GiveAmmo(9999,"ar2")
ply:GiveAmmo(9999,"buckshot")
ply:GiveAmmo(9999,"357")
ply:GiveAmmo(9999,"pistol")
ply:GiveAmmo(9999,"xbowbolt")
InventoryAddon:SendMessage( "Restored! Now kick their bottoms!", ply, false )
end
end
-- Register the item so it exists in the main stuff.
InventoryAddon:RegisterItem( ITEM )
May i get help with this code?
Some of the coding is off the topic so i experimented, i think i got it alright but it wont register as a item to put in me inventory, Can i get this fixed and a code to restore the armor to full?
I try to spawn and obtain it but it wont pick up and just says its a prop...
...Help?
And yes i purchased Garry's mod Legally ^^
I dont know if im a little retarded, but without question I won't get the answer.
This inventory addon.. will I be able to pick things up and then they will be in my inventory?
Also. Am I able to drop the items rather than using it?
[QUOTE=Uzalon;17466731]I dont know if im a little retarded, but without question I won't get the answer.
This inventory addon.. will I be able to pick things up and then they will be in my inventory?
Also. Am I able to drop the items rather than using it?[/QUOTE]
As long as the item is an item that belongs to the inventory addon, meaning one of the few items that you get with it by default or one that you make on your own, yes you may pick it up and drop it. You will not however be able to pick up any random item like let's say the statue of the horse(Unless you turned that into an item).
Yeah okay, thanks! :)
[QUOTE=Uzalon;17466958]Yeah okay, thanks! :)[/QUOTE]
Yeah guys, i cant make new ones, and when i do, when i spawn the prop that should be what i lua'd, It wont come up with the name or let me bring it into my inventory, just saying its a prop.
Can i get help with me Lua code above? I dont even have the slightest idea now, i need some sort of complete restore Inventory Addon item ^^; Completely restored health, ammunition, and armor life ^^;
Are you using the latest version of inventory addon or the older version?
[QUOTE=Zero Cucumber;17482994]Are you using the latest version of inventory addon or the older version?[/QUOTE]
Latest ^^
has anybody got a valid download link for V2? :)
[QUOTE=Apophis 1;17486904]has anybody got a valid download link for V2? :)[/QUOTE]
Im unsure my friend ^^;
[QUOTE=alwaysenls69123;17492874][url=http://www.beklo.com/hedeade/]hedeade[/url][url=http://www.beklo.com/ade09ww/]ade09ww[/url][url=http://www.beklo.com/lindefe23/]lindefe23[/url][url=http://www.beklo.com/nijiande245/]nijiande245[/url][url=http://www.beklo.com/heniyiqi23/]heniyiqi23[/url][/QUOTE]
...was that a spammed link of vhat?
i got a question is it possible to let invertory addon work on a prop for example like a fridge where you can store items in
[QUOTE=x-x090;17549933]i got a question is it possible to let invertory addon work on a prop for example like a fridge where you can store items in[/QUOTE]
Im unsure...you'd have to make it a entity with unlimited storage capacity.
Can anyone reupload the v2 of this? Since GMFiles is down, and since ChewGum is banned...
If anyone has the 2nd version please reupload it for me, thanks :D
Hi again, here you go if you still want it:
[url=http://www.garrysmod.org/downloads/?a=view&id=82203][img]http://www.garrysmod.org/img/?t=dll&id=82203[/img][/url]
I'll just not get my ass banned this time lol.
This is quite good. Just one question: can the function be anything or does it have to be a specific one?
Sorry, you need to Log In to post a reply to this thread.