Hello!
I just installed new moneyprinters to my server, and then i started getting this error when i tried buying those printers from shop (they didn't spawn...) ---->[url]http://aijaa.com/QdqIAI[/url]
[B][I][U]sh_createitems.lua[/U][/I][/B]
[CODE]local plyMeta = FindMetaTable("Player")
-- automatically block players from doing certain things with their DarkRP entities
local blockTypes = {"Physgun1", "Spawning1", "Toolgun1"}
local checkModel = function(model) return model ~= nil and (CLIENT or util.IsValidModel(model)) end
local requiredTeamItems = {"color", "model", "description", "weapons", "command", "max", "salary", "admin", "vote"}
local validShipment = {model = checkModel, "entity", "price", "amount", "seperate", "allowed"}
local validVehicle = {"name", model = checkModel, "price"}
local validEntity = {"ent", model = checkModel, "price", "max", "cmd", "name"}
local function checkValid(tbl, requiredItems)
for k,v in pairs(requiredItems) do
local isFunction = type(v) == "function"
if (isFunction and not v(tbl[k])) or (not isFunction and tbl[v] == nil) then
return isFunction and k or v
end
end
end
-----------------------------------------------------------
-- Job commands --
-----------------------------------------------------------
local function declareTeamCommands(CTeam)
local k = 0
for num,v in pairs(RPExtraTeams) do
if v.command == CTeam.command then
k = num
end
end
if CTeam.vote or CTeam.RequiresVote then
DarkRP.declareChatCommand{
command = "vote"..CTeam.command,
description = "Vote to become " .. CTeam.name .. ".",
delay = 1.5,
condition = fn.FAnd
{
fn.If(
fn.Curry(isfunction, 2)(CTeam.RequiresVote),
fn.Curry(fn.Flip(fn.FOr{fn.Curry(fn.Const, 2)(CTeam.RequiresVote), fn.Curry(fn.Const, 2)(-1)}()), 2)(k),
fn.Curry(fn.Const, 2)(true)
)(),
fn.If(
fn.Curry(isnumber, 2)(CTeam.NeedToChangeFrom),
fn.Compose{fn.Curry(fn.Eq, 2)(CTeam.NeedToChangeFrom), plyMeta.Team},
fn.If(
fn.Curry(istable, 2)(CTeam.NeedToChangeFrom),
fn.Compose{fn.Curry(table.HasValue, 2)(CTeam.NeedToChangeFrom), plyMeta.Team},
fn.Curry(fn.Const, 2)(true)
)()
)(),
fn.If(
fn.Curry(isfunction, 2)(CTeam.customCheck),
CTeam.customCheck,
fn.Curry(fn.Const, 2)(true)
)(),
fn.Compose{fn.Curry(fn.Neq, 2)(k), plyMeta.Team},
fn.FOr {
fn.Curry(fn.Lte, 3)(CTeam.admin)(0),
fn.FAnd{fn.Curry(fn.Eq, 3)(CTeam.admin)(1), plyMeta.IsAdmin},
fn.FAnd{fn.Curry(fn.Gte, 3)(CTeam.admin)(2), plyMeta.IsSuperAdmin}
}
}
}
DarkRP.declareChatCommand{
command = CTeam.command,
description = "Become " .. CTeam.name .. " and skip the vote.",
delay = 1.5,
condition = fn.FAnd {
fn.FOr {
fn.Curry(fn.Flip(plyMeta.hasDarkRPPrivilege), 2)("rp_"..CTeam.command),
fn.FAnd {
fn.FOr {
fn.Curry(fn.Lte, 3)(CTeam.admin)(0),
fn.FAnd{fn.Curry(fn.Eq, 3)(CTeam.admin)(1), plyMeta.IsAdmin},
fn.FAnd{fn.Curry(fn.Gte, 3)(CTeam.admin)(2), plyMeta.IsSuperAdmin}
},
fn.If(
fn.Curry(isfunction, 2)(CTeam.RequiresVote),
fn.Curry(fn.Flip(fn.FOr{fn.Curry(fn.Const, 2)(CTeam.RequiresVote), fn.Curry(fn.Const, 2)(-1)}()), 2)(k),
fn.FOr {
fn.FAnd{fn.Curry(fn.Eq, 3)(CTeam.admin)(0), plyMeta.IsAdmin},
fn.FAnd{fn.Curry(fn.Eq, 3)(CTeam.admin)(1), plyMeta.IsSuperAdmin}
}
)()
}
},
fn.Compose{fn.Not, plyMeta.isArrested},
fn.If(
fn.Curry(isnumber, 2)(CTeam.NeedToChangeFrom),
fn.Compose{fn.Curry(fn.Eq, 2)(CTeam.NeedToChangeFrom), plyMeta.Team},
fn.If(
fn.Curry(istable, 2)(CTeam.NeedToChangeFrom),
fn.Compose{fn.Curry(table.HasValue, 2)(CTeam.NeedToChangeFrom), plyMeta.Team},
fn.Curry(fn.Const, 2)(true)
)()
)(),
fn.If(
fn.Curry(isfunction, 2)(CTeam.customCheck),
CTeam.customCheck,
fn.Curry(fn.Const, 2)(true)
)(),
fn.Compose{fn.Curry(fn.Neq, 2)(k), plyMeta.Team}
}
}
else
DarkRP.declareChatCommand{
command = CTeam.command,
description = "Become " .. CTeam.name .. ".",
delay = 1.5,
condition = fn.FAnd
{
fn.Compose{fn.Not, plyMeta.isArrested},
fn.If(
fn.Curry(isnumber, 2)(CTeam.NeedToChangeFrom),
fn.Compose{fn.Curry(fn.Eq, 2)(CTeam.NeedToChangeFrom), plyMeta.Team},
fn.If(
fn.Curry(istable, 2)(CTeam.NeedToChangeFrom),
fn.Compose{fn.Curry(table.HasValue, 2)(CTeam.NeedToChangeFrom), plyMeta.Team},
fn.Curry(fn.Const, 2)(true)
)()
)(),
fn.If(
fn.Curry(isfunction, 2)(CTeam.customCheck),
CTeam.customCheck,
fn.Curry(fn.Const, 2)(true)
)(),
fn.Compose{fn.Curry(fn.Neq, 2)(k), plyMeta.Team},
fn.FOr {
fn.Curry(fn.Lte, 3)(CTeam.admin)(0),
fn.FAnd{fn.Curry(fn.Eq, 3)(CTeam.admin)(1), plyMeta.IsAdmin},
fn.FAnd{fn.Curry(fn.Gte, 3)(CTeam.admin)(2), plyMeta.IsSuperAdmin}
}
}
}
end
end
local function addTeamCommands(CTeam, max)
if CLIENT then return end
if not GAMEMODE:CustomObjFitsMap(CTeam) then return end
local k = 0
for num,v in pairs(RPExtraTeams) do
if v.command == CTeam.command then
k = num
end
end
if CTeam.vote or CTeam.RequiresVote then
DarkRP.defineChatCommand("vote"..CTeam.command, function(ply)
if CTeam.RequiresVote and not CTeam.RequiresVote(ply, k) then
DarkRP.notify(ply, 1,4, DarkRP.getPhrase("job_doesnt_require_vote_currently"))
return ""
end
if CTeam.admin == 1 and not ply:IsAdmin() then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("need_admin", "/".."vote"..CTeam.command))
return ""
elseif CTeam.admin > 1 and not ply:IsSuperAdmin() then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("need_sadmin", "/".."vote"..CTeam.command))
return ""
end
if type(CTeam.NeedToChangeFrom) == "number" and ply:Team() ~= CTeam.NeedToChangeFrom then
DarkRP.notify(ply, 1,4, DarkRP.getPhrase("need_to_be_before", team.GetName(CTeam.NeedToChangeFrom), CTeam.name))
return ""
elseif type(CTeam.NeedToChangeFrom) == "table" and not table.HasValue(CTeam.NeedToChangeFrom, ply:Team()) then
local teamnames = ""
for a,b in pairs(CTeam.NeedToChangeFrom) do teamnames = teamnames.." or "..team.GetName(b) end
DarkRP.notify(ply, 1,4, DarkRP.getPhrase("need_to_be_before", string.sub(teamnames, 5), CTeam.name))
return ""
end
if CTeam.customCheck and not CTeam.customCheck(ply) then
DarkRP.notify(ply, 1, 4, CTeam.CustomCheckFailMsg or DarkRP.getPhrase("unable", team.GetName(t), ""))
return ""
end
if not ply:changeAllowed(k) then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", "/vote"..CTeam.command, DarkRP.getPhrase("banned_or_demoted")))
return ""
end
if ply:Team() == k then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("unable", CTeam.command, ""))
return ""
end
local max = CTeam.max
if max ~= 0 and ((max % 1 == 0 and team.NumPlayers(k) >= max) or (max % 1 ~= 0 and (team.NumPlayers(k) + 1) / #player.GetAll() > max)) then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("team_limit_reached", CTeam.name))
return ""
end
if ply.LastJob and 10 - (CurTime() - ply.LastJob) >= 0 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("have_to_wait", math.ceil(10 - (CurTime() - ply.LastJob)), GAMEMODE.Config.chatCommandPrefix..CTeam.command))
return ""
end
if #player.GetAll() == 1 then
DarkRP.notify(ply, 0, 4, DarkRP.getPhrase("vote_alone"))
ply:changeTeam(k)
return ""
end
if CurTime() - ply:GetTable().LastVoteCop < 80 then
DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("have_to_wait", math.ceil(80 - (CurTime() - ply:GetTable().LastVoteCop)), GAMEMODE.Config.chatCommandPrefix..CTeam.command))
return ""
end
DarkRP.createVote(DarkRP.getPhrase("wants_to_be", ply:Nick(), CTeam.name), "job", ply, 20, function(vote, choice)
local ply = vote.target
if not IsValid(ply) then return end
if choice >= 0 then
ply:changeTe
[QUOTE=garry]Do not post huge scripts and expect people to fix them. If you wrote the script then you should know why it doesn't work. If you're editing someone's script and can't get it to work then don't! Learn how to code![/QUOTE]
And sh_createitems.lua is part of DarkRP, not the printer
[QUOTE=Netheous;42839830]And sh_createitems.lua is part of DarkRP, not the printer[/QUOTE]
Still got error from there.
[QUOTE=Niskuo;42839846]Still got error from there.[/QUOTE]
If you add any entity that doesn't work to a menu and try to spawn it afterwards, it'll still be something else than the entity causing errors.
Also that error is most likely caused by printer not having data values set in shared.lua.
Try adding this to shared.lua of the money printer:
[lua]function ENT:SetupDataTables()
self:DTVar("Entity", 1, "owning_ent")
end[/lua]
[QUOTE=Netheous;42839858]If you add any entity that doesn't work to a menu and try to spawn it afterwards, it'll still be something else than the entity causing errors.
Also that error is most likely caused by printer not having data values set in shared.lua.
Try adding this to shared.lua of the money printer:
[lua]function ENT:SetupDataTables()
self:DTVar("Entity", 1, "owning_ent")
end[/lua][/QUOTE]
Still not spawning...
also getting same error
[QUOTE=Niskuo;42840159]Still not spawning...
also getting same error[/QUOTE]
Are you sure you have added it to shared.lua of the printer ?
[QUOTE=Netheous;42840270]Are you sure you have added it to shared.lua of the printer ?[/QUOTE]
Yes.. i think it has nothing to do with THIS ---> *******[url]http://aijaa.com/QdqIAI*******[/url]
Voi ei!
Kuva tai video on poistettu tai poistunut palvelusta..
I have no idea what that means.
Also if you meant that the 'dt' error has nothing to do with data tables not being set then you are really wrong.
That error literally says that it can't access a table that doesn't exist, a table that is named 'dt' which btw. is created using either entity.dt = {} or the function I've sent you.
In fact, take a look at this:
My function:
[lua]function ENT:SetupDataTables()
self:DTVar("Entity", 1, "owning_ent")
end[/lua]
Line 373 of sh_createitems.lua
[lua] item.dt.owning_ent = ply[/lua]
[QUOTE=Netheous;42840427]Voi ei!
Kuva tai video on poistettu tai poistunut palvelusta..
I have no idea what that means.
Also if you meant that the 'dt' error has nothing to do with data tables not being set then you are really wrong.
That error literally says that it can't access a table that doesn't exist, a table that is named 'dt' which btw. is created using either entity.dt = {} or the function I've sent you.
In fact, take a look at this:
My function:
[lua]function ENT:SetupDataTables()
self:DTVar("Entity", 1, "owning_ent")
end[/lua]
Line 373 of sh_createitems.lua
[lua] item.dt.owning_ent = ply[/lua][/QUOTE]
[url]http://aijaa.com/QdqIAI[/url]
Well, you'r function didn't help at all. So what should i do now?
[editline]12th November 2013[/editline]
[QUOTE=Netheous;42840427]Voi ei!
Kuva tai video on poistettu tai poistunut palvelusta..
Line 373 of sh_createitems.lua
[lua] item.dt.owning_ent = ply[/lua][/QUOTE]
What about that?
[QUOTE=Niskuo;42840469][url]http://aijaa.com/QdqIAI[/url]
Well, you'r function didn't help at all. So what should i do now?[/QUOTE]
I am clueless, you have only posted code from sh_createitems so it's like trying to use broken TV remote and then getting TV inspected instead.
Google Gemstone printers on steam workshop. Download the addon and extract it with GMAD extractor. You can then add printers in there.
They're probably outdated if you're on 2.5..
[QUOTE=pablo67340;42840784]Google Gemstone printers on steam workshop. Download the addon and extract it with GMAD extractor. You can then add printers in there.[/QUOTE]
How?
[QUOTE=Niskuo;42841223]How?[/QUOTE]
He gave you all the pieces of information you need, now use your brain a little and try to do something for yourself.
GMad is located in common/garrysmod/bin
[QUOTE=KevinnTCG;42841581]He gave you all the pieces of information you need, now use your brain a little and try to do something for yourself.[/QUOTE]
I meant the last part...
Sorry, you need to Log In to post a reply to this thread.