Rejected zak bad code thread

Warwick

Mum Looks Like Tracy Beaker
GTA RP Playtester
Joined
Apr 26, 2016
Messages
2,470
Nebulae
6,039
ITEM.name = " " -- The item's name.
ITEM.width = # -- The item's width in the inventory.
ITEM.height = # -- The item's height in the inventory.
ITEM.price = # -- The item's price.
ITEM.desc = " " -- A description of what the item is/what it does.
ITEM.uniqueID = " " -- ALL LOWERCASE. A unique ID to identify the item in LUA, no spaces, make it simple and precise, for example '9mm_pistol' or 'apple'.
ITEM.worth = # -- Rarity of the item in comparison to other items. 1-10 please. 1 being common, 10 being mega rare. Can have decimals.

im not just if this is right i copied it off novabox forums
That's not right, no.

local Clockwork = Clockwork;
local ITEM = Clockwork.item:New(nil, true);
ITEM.name = "Alcohol Base";
ITEM.useText = "Drink";
ITEM.category = "Consumables";
ITEM.useSound = {"npc/barnacle/barnacle_gulp1.wav", "npc/barnacle/barnacle_gulp2.wav"};
ITEM.expireTime = 120;
ITEM.attributes = {};
-- Called when a player uses the item.
function ITEM:OnUse(player, itemEntity)
for k, v in pairs(self("attributes")) do
player:BoostAttribute(self("name"), k, v, self("expireTime"));
end;
Clockwork.player:SetDrunk(player, self("expireTime"));
if (self.OnDrink) then
self:OnDrink(player);
end;
end;
-- Called when a player drops the item.
function ITEM:OnDrop(player, position) end;
Clockwork.item:Register(ITEM);
 

Zak

Resident xenophile
Joined
Apr 26, 2016
Messages
5,887
Nebulae
16,124
width, height, and worth, and price doesn't apply
[doublepost=1481482245][/doublepost]
That's not right, no.

local Clockwork = Clockwork;
local ITEM = Clockwork.item:New(nil, true);
ITEM.name = "Alcohol Base";
ITEM.useText = "Drink";
ITEM.category = "Consumables";
ITEM.useSound = {"npc/barnacle/barnacle_gulp1.wav", "npc/barnacle/barnacle_gulp2.wav"};
ITEM.expireTime = 120;
ITEM.attributes = {};
-- Called when a player uses the item.
function ITEM:OnUse(player, itemEntity)
for k, v in pairs(self("attributes")) do
player:BoostAttribute(self("name"), k, v, self("expireTime"));
end;
Clockwork.player:SetDrunk(player, self("expireTime"));
if (self.OnDrink) then
self:OnDrink(player);
end;
end;
-- Called when a player drops the item.
function ITEM:OnDrop(player, position) end;
Clockwork.item:Register(ITEM);
expireTime also isn't a thing
 
Reactions: List

Warwick

Mum Looks Like Tracy Beaker
GTA RP Playtester
Joined
Apr 26, 2016
Messages
2,470
Nebulae
6,039
width, height, and worth, and price doesn't apply
[doublepost=1481482245][/doublepost]
expireTime also isn't a thing
I ripped that from the old C16 Github, it's the best I could get on the fly.
 

cns - he/him/his

The Winner
Joined
Apr 26, 2016
Messages
23,638
Nebulae
65,342
we dont even need shit like this really
if you want a cool special food item so bad ask an sa to make it
custom food items are great for eating or killing
 
Reactions: List

Zak

Resident xenophile
Joined
Apr 26, 2016
Messages
5,887
Nebulae
16,124
Code:
local ITEM = Clockwork.item:New("consumable_base"); -- Base of the item. Don't change it unless you know what it does.
ITEM.name = ""; -- Name, obviously.
ITEM.uniqueID = ""; -- Should be lowercase, short, and descriptive. Two items cannot share the same uniqueID
ITEM.category = ""; -- Category it appears in the inventory.
ITEM.cost = 7; -- Price in salesmen and the business menu. This is per-item, not per-shipment.
ITEM.batch = 5; -- How many items come in a shipment from the business menu.
ITEM.access = ""; -- Which flags can access this item. It can be placed on multiple flags by simply typing "mV" et al.
ITEM.spawnValue = 7; -- The chance that this item is selected from others in the same itemspawner category.
ITEM.spawnType = "misc"; -- What category the item will be spawned in, in terms of the itemspawner plugin.
ITEM.business = true; -- Set to false to disable this item on the business menu.
ITEM.hunger = 0; -- Hunger to restore. Negative values don't work (yet).
ITEM.thirst = 0; -- Thirst to restore. Negative values don't work (yet).
ITEM.health = 0; -- How much health to restore when consumed.
ITEM.damage = 0; -- How much damage to deal when consumed.
ITEM.model = ""; -- What model to use for the item when dropped.
ITEM.iconModel = ""; -- What model to use for the inventory icon. If this line doesn't exist, it uses ITEM.model.
ITEM.skin = 0; -- What skin the model should use.
ITEM.weight = 0.25; -- In kilograms.
ITEM.description = ""; -- Pretty obvious.

ITEM:Register(); -- Don't touch. Without it the item won't exist.
 
Reactions: List

Warwick

Mum Looks Like Tracy Beaker
GTA RP Playtester
Joined
Apr 26, 2016
Messages
2,470
Nebulae
6,039
Alright, so I've made 16 items in ~15 minutes adhering to the item base Zak posted. So it doesn't take too long at about 1 minute per item.

Here is the download: http://www.mediafire.com/file/u93qku8buv7w78z/items.zip
"Just some beans. Tastes pretty bad."

The quality of descriptions you're getting here, folks.

Edit: Another one... This one is worse. "OH GOD I LOVE CAFFEINE!!!! MOREMOREMOREMORE!"
2nd Edit: None of these descriptions are even remotely passable.
 

MaXenzie

Sexually attracted to robots
Media Developer
GTA RP Playtester
Joined
Apr 26, 2016
Messages
17,277
Nebulae
24,628
"Just some beans. Tastes pretty bad."

The quality of descriptions you're getting here, folks.

Edit: Another one... This one is worse. "OH GOD I LOVE CAFFEINE!!!! MOREMOREMOREMORE!"
2nd Edit: None of these descriptions are even remotely passable.

For reference, give us one of your descriptions.
 
Reactions: List