- Initiateur de la discussion
alilou901
Geek suprême
- Messages
- 238
- Score réaction
- 34
- Points
- 100
Bonjour !
J'utilise le eliteF4 menu !
J'ai ajouté la nourriture dans mon food.lua.
Voici mon food.lua.
Mon problème est que l'on ne vois pas la nourriture dans le job "TEAM_COOK" !
Merci de m'aider !
J'utilise le eliteF4 menu !
J'ai ajouté la nourriture dans mon food.lua.
Voici mon food.lua.
Code:
--[[---------------------------------------------------------------------------
DarkRP custom food
---------------------------------------------------------------------------
This file contains your custom food.
This file should also contain food from DarkRP that you edited.
THIS WILL ONLY LOAD IF HUNGERMOD IS ENABLED IN darkrp_config/disabled_defaults.lua.
IT IS DISABLED BY DEFAULT.
Note: If you want to edit a default DarkRP food, first disable it in darkrp_config/disabled_defaults.lua Once you've done that, copy and paste the food item to this file and edit it.
The default food can be found here:
https://github.com/FPtje/DarkRP/blob/master/gamemode/modules/hungermod/sh_init.lua#L33
Add food under the following line:
---------------------------------------------------------------------------]]
local checkModel = function(model) return model ~= nil and (CLIENT or util.IsValidModel(model)) end
local validFood = {"name", model = checkModel, "energy", "price"}
FoodItems = {}
function DarkRP.createFood(name, mdl, energy, price) local foodItem = istable(mdl) and mdl or {model = mdl, energy = energy, price = price} foodItem.name = name if DarkRP.DARKRP_LOADING and DarkRP.disabledDefaults["food"][name] then return end for k,v in pairs(validFood) do local isFunction = isfunction(v) if (isFunction and not v(foodItem[k])) or (not isFunction and foodItem[v] == nil) then ErrorNoHalt("Corrupt food \"" .. (name or "") .. "\": element " .. (isFunction and k or v) .. " is corrupt.\n") end end table.insert(FoodItems, foodItem)
end
AddFoodItem = DarkRP.createFood
local plyMeta = FindMetaTable("Player")
plyMeta.isCook = fn.Compose{fn.Curry(fn.GetValue, 2)("cook"), plyMeta.getJobTable}
--[[
Valid members: model = string, -- the model of the food item energy = int, -- how much energy it restores price = int, -- the price of the food requiresCook = boolean, -- whether only cooks can buy this food customCheck = function(ply) return boolean end, -- customCheck on purchase function customCheckMessage = string -- message to people who cannot buy it because of the customCheck
]]
DarkRP.DARKRP_LOADING = true
DarkRP.registerDarkRPVar("Energy", net.WriteFloat, net.ReadFloat)
DarkRP.createFood("Pizza au fromage", { model = "models/cheesepizza01/cheesepizza01.mdl", energy = 30, price = 50
})
DarkRP.createFood("Pizza au kebab", { model = "models/peppizza02/peppizza02.mdl", energy = 50, price = 70
})
DarkRP.createFood("Hamburger", { model = "models/FoodNHouseholdItems/mcdburgerbox.mdl", energy = 20, price = 45
})
DarkRP.createFood("Cheeseburger", { model = "models/FoodNHouseholdItems/mcdburgerbox.mdl", energy = 35, price = 15
})
DarkRP.createFood("Hot-dog", { model = "models/FoodNHouseholdItems/hotdog.mdl", energy = 25, price = 15
})
DarkRP.createFood("Menu une personne", { model = "models/FoodNHouseholdItems/McdMeal2.mdl", energy = 75, price = 50
})
DarkRP.createFood("Menu deux personne", { model = "models/FoodNHouseholdItems/McdMeal.mdl", energy = 100, price = 70
})
DarkRP.createFood("Sushi", { model = "models/sushipack/sushi01.mdl", energy = 35, price = 35
})
DarkRP.createFood("Homard", { model = "models/FoodNHouseholdItems/lobster.mdl", energy = 85, price = 120
})
DarkRP.createFood("Part de Gateau au chocolat", { model = "models/FoodNHouseholdItems/cakepiece.mdl", energy = 30, price = 30
})
DarkRP.createFood("Sachet de cookies", { model = "models/FoodNHouseholdItems/cookies.mdl", energy = 30, price = 25
})
DarkRP.createFood("Donut", { model = "models/FoodNHouseholdItems/donut.mdl", energy = 20, price = 10
})
DarkRP.createFood("Coca-cola", { model = "models/FoodNHouseholdItems/cola.mdl", energy = 20, price = 10
})
DarkRP.createFood("Jus d'orange", { model = "models/FoodNHouseholdItems/juice.mdl", energy = 20, price = 10
})
DarkRP.createFood("Bouteille de champagne", { model = "models/FoodNHouseholdItems/champagneonplate.mdl", energy = 25, price = 150
})
Merci de m'aider !