So i am fairly new to lua scripting and id like to know more about it. But before that... I need some help with this error im getting.
I would like a quick response please! And i dont want details on how i can learn to do it i just want to know whats going wrong and how i can fix it in a detailed paragraph or something. Thanks!
Here is the error
[CODE]Attempted to create unknown entity type copper_money_printer!
[DarkRP] gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:297: Entity 'copper_money_printer' does not exist or is not valid.
1. error - [C]:-1
2. defaultSpawn - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:297
3. callback - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:357
4. callback - gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:17
5. unknown - gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:255
6. unknown - lua/includes/modules/concommand.lua:54[/CODE]
______________________________________________________________________
Here is the printer code
______________________________________________________________________
[CODE]AddCSLuaFile()
-- BASE SETTINGS
ENT.Base = "base_money_printer"
ENT.Type = "anim"
ENT.Spawnable = false
ENT.AdminOnly = false
-- MAIN SETTINGS
ENT.Author = "husho"
ENT.PrintName = "Copper Money Printer"
ENT.PrinterColor = Color(216, 72, 0, 255)
ENT.Pages = {"General", "Upgrades", "Statistics"}
ENT.SparkingEffect = false
-- SOUND SETTINGS
-- Will printer make printing sound ?
ENT.MakePrintingSound = true
-- Volume of this sound
ENT.SoundLevel = 40
-- DISPLAY SETTINGS
if CLIENT then
-- GENERAL BOXES CHANGES
ENT.BoxesRadiusCorner = 5
ENT.ShadowEnabled = false
ENT.ShadowColor = Color(0, 0, 0, 100)
-- TOP MENU
ENT.NameOwnerBoxColor = Color(255, 110, 38, 100)
ENT.NameTextColor = Color(255, 255, 255, 255)
ENT.OwnerTextColor = Color(230, 230, 230, 255)
-- MIDDLE MENU
ENT.PageBoxColor = Color(255, 100, 38, 100)
ENT.PageTextColor = Color(255, 255, 255, 255)
-- BOTTOM MENU
ENT.ButtonsBoxColor = Color(255, 110, 38, 100)
ENT.CurPageTextColor = Color(255, 255, 255, 255)
-- BUTTONS
ENT.ButtonsColor = Color(216, 72, 0, 100)
ENT.ButtonsColorHovered = Color(255, 84, 0, 200)
ENT.ButtonsTextColor = Color(255, 255, 255, 255)
-- BATTERY
ENT.BatteryBoxColor = Color(255, 110, 38, 150)
ENT.BatteryBgColor = Color(255, 255, 255, 255)
ENT.BatteryTextColor = Color(255, 255, 255, 255)
-- SPECIALS
-- Color of the "Withdraw" text
ENT.WithdrawText = Color(70, 90, 240, 255)
-- Color of the "Cool" text
ENT.CoolingText = Color(0, 200, 200, 255)
-- Color of the upgrades text
ENT.UpgradeCostText = Color(0, 140, 0, 255)
-- Color of the "turn off" text
ENT.TurnOffText = Color(180, 0, 0, 255) -- new, added in 3.0
-- Color of the "turn on" text
ENT.TurnOnText = Color(0, 150, 0, 255) -- new, added in 3.0
end
-- TURN ON/OFF
-- Allow players to turn on/off their printers
ENT.TurnOnOffEnabled = true -- new, added in 3.0
-- PRINTING SPEED
-- Time used to print money (decreases over upgrades)
ENT.PrintingSpeed = 30
-- Time takes the printer to reload
ENT.ReloadingTime = 3
-- Will the printer have speed upgrade?
ENT.UpgradablePrintingSpeed = true
-- SPEED LEVELS
ENT.PrintingSpeedLevels = {
{LevelName = "None", NameColor = Color(255, 255, 255, 255), Multiplier = 1, MoneyToUpgrade = 0},
{LevelName = "Copper", NameColor = Color(184, 115, 51, 255), Multiplier = 1.5, MoneyToUpgrade = 1000},
}
-- PRINTER STORAGE
-- Will the printer allow storage ?
ENT.InPrinterStorage = true
-- Will the printer drop money when full ?
ENT.PrintOutsideIfFull = false
-- Will the printer have infinite storage ? (nice feature for VIP printers)
ENT.InfinitePrinterStorage = false
-- Default amount of money that can be stored in the printer (increases with upgrades)
ENT.DefaultMaxMoneyStorage = 10000
-- Will the printer have storage upgrade ?
ENT.UpgradablePrinterStorage = true
-- Storage Levels
ENT.PrinterStorageLevels = {
{LevelName = "None", NameColor = Color(255, 255, 255, 255), Multiplier = 1, MoneyToUpgrade = 0},
{LevelName = "Copper", NameColor = Color(184, 115, 51, 255), Multiplier = 1.5, MoneyToUpgrade = 1000},
}
-- PRINTING QUALITY
-- Amount of money printed (increased with upgrades)
ENT.PrintMoney = 25
-- Will the printer have quality upgrades ?
ENT.UpgradablePrintingQuality = true
-- QUALITY LEVELS
ENT.PrintingQualityLevels = {
{LevelName = "None", NameColor = Color(255, 255, 255, 255), Multiplier = 1, MoneyToUpgrade = 0},
{LevelName = "Copper", NameColor = Color(184, 115, 51, 255), Multiplier = 1.5, MoneyToUpgrade = 1000},
}
-- PRINTER TEMPERATURE AND COOLING
-- Will the printer explode when get damaged ?
ENT.CreateExplosionWhenDestroy = true
-- Will the printer have temperature status ?
ENT.EnableTemperature = true
-- Will the printer have cooling upgrades ?
ENT.UpgradableCooling = true
-- The metric system displayed on the temperature
ENT.TemperatureMetricSystem = "C"
-- Printer temperature on spawn
ENT.TemperatureOnSpawn = 20
-- Maximum temperature of the printer
ENT.DeathTemperature = 100
-- Cooling temperature (increases with upgrades)
ENT.CoolingTemperature = 1
-- Cooling time needed (decreases with upgrades)
ENT.CoolingTime = 30
-- Heating temperature (decreasing with upgrades)
ENT.HeatingTemperature = 0.05
-- Time in ticks the printer will burn before blowing up (better leave it at that)
ENT.BurningTime = 20
-- COOLING LEVELS
ENT.CoolingLevels = {
{LevelName = "None", NameColor = Color(255, 255, 255, 255), CoolingMultiplier = 1, CoolingTimeDivider = 1, HeatingDivider = 1, MoneyToUpgrade = 0, AutoCooling = false},
{LevelName = "Copper", NameColor = Color(184, 115, 51, 255), CoolingMultiplier = 1.5, CoolingTimeDivider = 2, HeatingDivider = 3, MoneyToUpgrade = 2000, AutoCooling = true},
}
-- PRINTER BATTERY
-- Will the printer run on a battery ?
ENT.EnableBattery = true
-- Maximum battery power
ENT.MaxBatteryValue = 1000
-- Battery power on spawn
ENT.BatteryValueOnSpawn = 1000
-- Will the printer use battery when printing ?
ENT.WasteEnergyOnPrinting = true
-- How much power will the battery use when printing ?
ENT.WastingAmountOnPrinting = 0.01
-- Will the printer use battery power when cooling ?
ENT.WasteEnergyOnCooling = true
-- How much power will the battery use when cooling ?
ENT.WastingAmountOnCooling = 0.3[/CODE]
________________________________________________________________________________________________
Here is whats in the sh_init.lua
(All the other printers dont matter atm)
[CODE]local GM = GM or GAMEMODE
GM.Config = GM.Config or {}
GM.Config.PocketBlacklist = GM.Config.PocketBlacklist or {}
GM.Config.PocketBlacklist["standard_money_printer"] = true
GM.Config.PocketBlacklist["extended_money_printer"] = true
GM.Config.PocketBlacklist["vip_money_printer"] = true
GM.Config.PocketBlacklist["copper_money_printer"] = true
DarkRP.createEntity("Money Printer Battery", {
ent = "printer_battery",
model = "models/props_lab/reciever01a.mdl",
price = 1000,
max = 4,
cmd = "buymoneyprinterbattery"
})
DarkRP.createEntity("Standard Money Printer", {
ent = "standard_money_printer",
model = "models/props_c17/consolebox01a.mdl",
price = 2500,
max = 2,
cmd = "buystandardmoneyprinter"
})
DarkRP.createEntity("Copper Money Printer", {
ent = "copper_money_printer",
model = "models/props_c17/consolebox01a.mdl",
price = 5000,
max = 1,
cmd = "buycoppermoneyprinter"
})
DarkRP.createEntity("Extended Money Printer", {
ent = "extended_money_printer",
model = "models/props_c17/consolebox01a.mdl",
price = 7500,
max = 2,
cmd = "buyextendedmoneyprinter"
})
DarkRP.createEntity("VIP Money Printer", {
ent = "vip_money_printer",
model = "models/props_c17/consolebox01a.mdl",
price = 25000,
max = 2,
cmd = "buyvipmoneyprinter",
customCheck =
Is the folder holding the entity called "copper_money_printer"? Aren't there any other errors related to the entity itself?
[QUOTE=AlbertoBC;50760652]Is the folder holding the entity called "copper_money_printer"? Aren't there any other errors related to the entity itself?[/QUOTE]
Thanks for the quick reply, and no. Basically what I have is Steam/steamapps/common/GarrysMod/garrysmod/addons/custommoneyprinters/lua/entities/copper_money_printer.lua
And that's the only error I get
There's probably an error in the file during server startup. Look for an earlier error.
Use code tags, then people can actually read the code.
[QUOTE=ms333;50760670]There's probably an error in the file during server startup. Look for an earlier error.[/QUOTE]
This is the only error it gives me. I just checked
[editline]23rd July 2016[/editline]
[QUOTE=Moku;50760678]Use code tags, then people can actually read the code.[/QUOTE]
Fixed... Now any ideas??
[QUOTE=VoXBox;50760688]This is the only error it gives me. I just checked
[editline]23rd July 2016[/editline]
Fixed... Now any ideas??[/QUOTE]
Does it give an error or not?
You didn't even answer properly to what he asked.
Also what is the file structure of this entity?
[QUOTE=geferon;50761455]Does it give an error or not?
You didn't even answer properly to what he asked.
Also what is the file structure of this entity?[/QUOTE]
I did reply correctly actually.... Ms333 asked if there were any errors before the one I posted an I said the one I'm getting is the only error I'm getting. Then Moku asked me to fix the format of my post so I did. And what do you mean file structure?
[QUOTE=VoXBox;50761620]I did reply correctly actually.... Ms333 asked if there were any errors before the one I posted an I said the one I'm getting is the only error I'm getting. Then Moku asked me to fix the format of my post so I did. And what do you mean file structure?[/QUOTE]
Oh ok then.
Example of file structure:
-addons/ADDON_NAME/lua/entities/weapons/WEAPON_NAME/..
../shared.lua
../init.lua
../cl_init.lua
[QUOTE=geferon;50761740]Oh ok then.
Example of file structure:
-addons/ADDON_NAME/lua/entities/weapons/WEAPON_NAME/..
../shared.lua
../init.lua
../cl_init.lua[/QUOTE]
addons/customizableprinters/lua/entities/copper_money_printer.lua
And it appears as if i only have the sh_init.lua and not the cl_init.lua or shared.lua.....
I only have cl_fonts.lua, sh_init.lua, and sv_stats.lua
But here is where they are all located
addons/customizablemoneyprinters/lua/darkrp_modules/customizablemoneyprinters/ (this is where they are located....)
[QUOTE=VoXBox;50761808]addons/customizableprinters/lua/entities/copper_money_printer.lua
And it appears as if i only have the sh_init.lua and not the cl_init.lua or shared.lua.....
I only have cl_fonts.lua, sh_init.lua, and sv_stats.lua
But here is where they are all located
addons/customizablemoneyprinters/lua/darkrp_modules/customizablemoneyprinters/ (this is where they are located....)[/QUOTE]
You have to put them all inside a folder...
Like, the weapons name folder. No wonder they are not working.
And as well, its not sh_init. Rename it to shared.lua
[QUOTE=geferon;50762020]You have to put them all inside a folder...
Like, the weapons name folder. No wonder they are not working.
And as well, its not sh_init. Rename it to shared.lua[/QUOTE]
Okay... So I re named it. Now for the folder... Would I create one inside of entities just called customizablemoneyprinters and put all the .lua that were in the entities folder in the folder I just made?
Also! Now that I renamed that .lua none of the printers appear in the f4 menu...
[QUOTE=VoXBox;50762037]Okay... So I re named it. Now for the folder... Would I create one inside of entities just called customizablemoneyprinters and put all the .lua that were in the entities folder in the folder I just made?
Also! Now that I renamed that .lua none of the printers appear in the f4 menu...[/QUOTE]
But all those files, the cl_init, init, sh_init(wich should be shared) were they different printers or was it the code for same entity or to be various entities?
[QUOTE=geferon;50762514]But all those files, the cl_init, init, sh_init(wich should be shared) were they different printers or was it the code for same entity or to be various entities?[/QUOTE]
This is what's inside the sh_init.lua not sure if that helps.... But all the different printer.lua files are in addons/custommoneyprinters/lua/entities
[CODE]local GM = GM or GAMEMODE
GM.Config = GM.Config or {}
GM.Config.PocketBlacklist = GM.Config.PocketBlacklist or {}
GM.Config.PocketBlacklist["standard_money_printer"] = true
GM.Config.PocketBlacklist["extended_money_printer"] = true
GM.Config.PocketBlacklist["vip_money_printer"] = true
GM.Config.PocketBlacklist["copper_money_printer"] = true
DarkRP.createEntity("Money Printer Battery", {
ent = "printer_battery",
model = "models/props_lab/reciever01a.mdl",
price = 1000,
max = 4,
cmd = "buymoneyprinterbattery"
})
DarkRP.createEntity("Standard Money Printer", {
ent = "standard_money_printer",
model = "models/props_c17/consolebox01a.mdl",
price = 2500,
max = 2,
cmd = "buystandardmoneyprinter"
})
DarkRP.createEntity("Copper Money Printer", {
ent = "copper_money_printer",
model = "models/props_c17/consolebox01a.mdl",
price = 5000,
max = 1,
cmd = "buycoppermoneyprinter"
})
DarkRP.createEntity("Extended Money Printer", {
ent = "extended_money_printer",
model = "models/props_c17/consolebox01a.mdl",
price = 7500,
max = 2,
cmd = "buyextendedmoneyprinter"
})
DarkRP.createEntity("VIP Money Printer", {
ent = "vip_money_printer",
model = "models/props_c17/consolebox01a.mdl",
price = 25000,
max = 2,
cmd = "buyvipmoneyprinter",
customCheck = function(ply) return ply:IsUserGroup("ExampleDonatorGroupNum76561198056175391") end
})[/CODE]
And you have that in the entities folder? That has to be in a module! Not an entity!
[QUOTE=geferon;50762569]And you have that in the entities folder? That has to be in a module! Not an entity![/QUOTE]
The code I just shared is in addons/custommoneyprinters/lua/darkrp_modules
I was saying that all the different printer.lua 's are in addons/custommoneyprinters/lua/entities
[QUOTE=VoXBox;50762594]The code I just shared is in addons/custommoneyprinters/lua/darkrp_modules
I was saying that all the different printer.lua 's are in addons/custommoneyprinters/lua/entities[/QUOTE]
How are the .luas called?
[QUOTE=geferon;50762710]How are the .luas called?[/QUOTE]
The lua files in entities are called
copper_money_printer.lua
base_money_printer
standard _money_printer.lua
extended_money_printer.lua
money_printer_battery.lua
In darkrp_modules
cl_fonts.lua
sh_init.lua (shared.lua)
sv_stats.lua
Can i see all the code that you have for example in the copper_money_printer.lua?
[QUOTE=geferon;50763491]Can i see all the code that you have for example in the copper_money_printer.lua?[/QUOTE]
[CODE]AddCSLuaFile()
-- BASE SETTINGS
ENT.Base = "base_money_printer"
ENT.Type = "anim"
ENT.Spawnable = false
ENT.AdminOnly = false
-- MAIN SETTINGS
ENT.Author = "husho"
ENT.PrintName = "Copper Money Printer"
ENT.PrinterColor = Color(216, 72, 0, 255)
ENT.Pages = {"General", "Upgrades", "Statistics"}
ENT.SparkingEffect = false
-- SOUND SETTINGS
-- Will printer make printing sound ?
ENT.MakePrintingSound = true
-- Volume of this sound
ENT.SoundLevel = 40
-- DISPLAY SETTINGS
if CLIENT then
-- GENERAL BOXES CHANGES
ENT.BoxesRadiusCorner = 5
ENT.ShadowEnabled = false
ENT.ShadowColor = Color(0, 0, 0, 100)
-- TOP MENU
ENT.NameOwnerBoxColor = Color(255, 110, 38, 100)
ENT.NameTextColor = Color(255, 255, 255, 255)
ENT.OwnerTextColor = Color(230, 230, 230, 255)
-- MIDDLE MENU
ENT.PageBoxColor = Color(255, 100, 38, 100)
ENT.PageTextColor = Color(255, 255, 255, 255)
-- BOTTOM MENU
ENT.ButtonsBoxColor = Color(255, 110, 38, 100)
ENT.CurPageTextColor = Color(255, 255, 255, 255)
-- BUTTONS
ENT.ButtonsColor = Color(216, 72, 0, 100)
ENT.ButtonsColorHovered = Color(255, 84, 0, 200)
ENT.ButtonsTextColor = Color(255, 255, 255, 255)
-- BATTERY
ENT.BatteryBoxColor = Color(255, 110, 38, 150)
ENT.BatteryBgColor = Color(255, 255, 255, 255)
ENT.BatteryTextColor = Color(255, 255, 255, 255)
-- SPECIALS
-- Color of the "Withdraw" text
ENT.WithdrawText = Color(70, 90, 240, 255)
-- Color of the "Cool" text
ENT.CoolingText = Color(0, 200, 200, 255)
-- Color of the upgrades text
ENT.UpgradeCostText = Color(0, 140, 0, 255)
-- Color of the "turn off" text
ENT.TurnOffText = Color(180, 0, 0, 255) -- new, added in 3.0
-- Color of the "turn on" text
ENT.TurnOnText = Color(0, 150, 0, 255) -- new, added in 3.0
end
-- TURN ON/OFF
-- Allow players to turn on/off their printers
ENT.TurnOnOffEnabled = true -- new, added in 3.0
-- PRINTING SPEED
-- Time used to print money (decreases over upgrades)
ENT.PrintingSpeed = 30
-- Time takes the printer to reload
ENT.ReloadingTime = 3
-- Will the printer have speed upgrade?
ENT.UpgradablePrintingSpeed = true
-- SPEED LEVELS
ENT.PrintingSpeedLevels = {
{LevelName = "None", NameColor = Color(255, 255, 255, 255), Multiplier = 1, MoneyToUpgrade = 0},
{LevelName = "Copper", NameColor = Color(184, 115, 51, 255), Multiplier = 1.5, MoneyToUpgrade = 1000},
}
-- PRINTER STORAGE
-- Will the printer allow storage ?
ENT.InPrinterStorage = true
-- Will the printer drop money when full ?
ENT.PrintOutsideIfFull = false
-- Will the printer have infinite storage ? (nice feature for VIP printers)
ENT.InfinitePrinterStorage = false
-- Default amount of money that can be stored in the printer (increases with upgrades)
ENT.DefaultMaxMoneyStorage = 10000
-- Will the printer have storage upgrade ?
ENT.UpgradablePrinterStorage = true
-- Storage Levels
ENT.PrinterStorageLevels = {
{LevelName = "None", NameColor = Color(255, 255, 255, 255), Multiplier = 1, MoneyToUpgrade = 0},
{LevelName = "Copper", NameColor = Color(184, 115, 51, 255), Multiplier = 1.5, MoneyToUpgrade = 1000},
}
-- PRINTING QUALITY
-- Amount of money printed (increased with upgrades)
ENT.PrintMoney = 25
-- Will the printer have quality upgrades ?
ENT.UpgradablePrintingQuality = true
-- QUALITY LEVELS
ENT.PrintingQualityLevels = {
{LevelName = "None", NameColor = Color(255, 255, 255, 255), Multiplier = 1, MoneyToUpgrade = 0},
{LevelName = "Copper", NameColor = Color(184, 115, 51, 255), Multiplier = 1.5, MoneyToUpgrade = 1000},
}
-- PRINTER TEMPERATURE AND COOLING
-- Will the printer explode when get damaged ?
ENT.CreateExplosionWhenDestroy = true
-- Will the printer have temperature status ?
ENT.EnableTemperature = true
-- Will the printer have cooling upgrades ?
ENT.UpgradableCooling = true
-- The metric system displayed on the temperature
ENT.TemperatureMetricSystem = "C"
-- Printer temperature on spawn
ENT.TemperatureOnSpawn = 20
-- Maximum temperature of the printer
ENT.DeathTemperature = 100
-- Cooling temperature (increases with upgrades)
ENT.CoolingTemperature = 1
-- Cooling time needed (decreases with upgrades)
ENT.CoolingTime = 30
-- Heating temperature (decreasing with upgrades)
ENT.HeatingTemperature = 0.05
-- Time in ticks the printer will burn before blowing up (better leave it at that)
ENT.BurningTime = 20
-- COOLING LEVELS
ENT.CoolingLevels = {
{LevelName = "None", NameColor = Color(255, 255, 255, 255), CoolingMultiplier = 1, CoolingTimeDivider = 1, HeatingDivider = 1, MoneyToUpgrade = 0, AutoCooling = false},
{LevelName = "Copper", NameColor = Color(184, 115, 51, 255), CoolingMultiplier = 1.5, CoolingTimeDivider = 2, HeatingDivider = 3, MoneyToUpgrade = 2000, AutoCooling = true},
}
-- PRINTER BATTERY
-- Will the printer run on a battery ?
ENT.EnableBattery = true
-- Maximum battery power
ENT.MaxBatteryValue = 1000
-- Battery power on spawn
ENT.BatteryValueOnSpawn = 1000
-- Will the printer use battery when printing ?
ENT.WasteEnergyOnPrinting = true
-- How much power will the battery use when printing ?
ENT.WastingAmountOnPrinting = 0.01
-- Will the printer use battery power when cooling ?
ENT.WasteEnergyOnCooling = true
-- How much power will the battery use when cooling ?
ENT.WastingAmountOnCooling = 0.3[/CODE]
[QUOTE=geferon;50763491]Can i see all the code that you have for example in the copper_money_printer.lua?[/QUOTE]
So I just tried everything I could possibly think of... I'm completely lost and hopeless at this point... I really need the help, also add me on Skype and I can send you the damn files and maybe you could get a better understanding of them and let me know what you find out? The user is r3a932 (I know it's stupid... Made it when. I was 10)
Someone give him a line of code without saying where he needs to put it since he wants a fast response and no details
[QUOTE=Syff;50766250]Someone give him a line of code without saying where he needs to put it since he wants a fast response and no details[/QUOTE]
Don't be that guy :P
Sorry, you need to Log In to post a reply to this thread.