Lua Error

ERROR: GAMEMODE:‘PlayerSay’ Failed: DarkRP\gamemode\main.lua:1125: attempt to index field ‘dt’ (a nil value)
Error: hook->PlayerSay returned a non-string!

Editing dark rp, making a custom entity.

Fixed the spawn icon.
It also says
Attempted to create unknown entity type entity_name.
How do I find out the actual name of the entity?
I’ve put in the folder name but that doesnt work.

How do you expect us to fix the problem if we dont have the code


function ENT:OnTakeDamage(dmg)
	self.damage = self.damage - dmg:GetDamage()

	if (self.damage <= 0) then
		local effectdata = EffectData()
		effectdata:SetOrigin(self.Entity:GetPos())
		effectdata:SetMagnitude(2)
		effectdata:SetScale(2)
		effectdata:SetRadius(3)
		util.Effect("Sparks", effectdata)
		self.Entity:Remove()
	end
end

function ENT:Use
		local Weed = ents.Create("durgz_weed")
		Chance = math.random(5)
		if Chance = 1
		Weed:Spawn()
	self.CanUse = false
	self.Entity:Remove()
end


That isn’t the code that is causing the first error, but your ENT.Use function has some syntax errors.

[lua]function ENT:Use()
local Chance = math.random(5)
if Chance == 1 then
local Weed = ents.Create(“durgz_weed”)
Weed:Spawn()
self.CanUse = false
self.Entity:Remove()
end
end[/lua]

Okay I did that, I also get this error.

Attempted to create unknown entity type weed_plant!

How do I know the name of the entity? Is it just the name of the folder?

Should be.

Hmm could it be that im not giving it a position to spawn durgz_weed?
also


 function ENT:Initialize()
	self.Entity:SetModel("weedplant_pot_dirt.mdl") 
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	self.CanUse = false
	local phys = self.Entity:GetPhysicsObject()

	if phys and phys:IsValid() then phys:Wake() end

	self.damage = 10

also the error says line 1125 in darkrp/main or whatever
I went to that and:
item.dt.owning_ent = ply

I think its something to do with ownership.

Anyone, Please i need this fixed.

You should probably go ask in the DarkRP thread.

Got it working.
It has a timer in it, If i make two the old timer stops.
and its timer.Create

ok where do i start hmm, I play a game called cs2d (couter-strike2d) and there is a system called amx2d and it runs luas for servers, my problem is i can’t seem to find a way to change my user privs, like when people in my server use @say it shows up on the screen as ex: Joe (Admin) hey guys! and i would like to change the Admin oart with diffrent things like Super Admin and Vip. i found the 1 part of the lua that i can change the Admin part to what ever i want but it changes it for everyone and i want to have certain people for Vip, Super Admin, and Admin.
here is the part that i found i hope this helps you help me :slight_smile:

function adm_say_admin(p, typ, cmd)
local color = “©032178170”
if sv.color[playeruid[p]] then
color = sv.color[playeruid[p]]
end
msg(color…player(p, “name”) … "(ADMIN): "…cmd)
end

Make your own thread.

Well On topic.
As I said before when I have 2 of the entitys only 1 entity has a timer.
So i spawn 1 its timer is working, spawn another and the first one pauses/stops and the second one starts.

What im trying to do is when the entity touches another entity to kill them both.


function ENT:PassesTriggerFilters(ent)
return ent:GetClass() == "entity1"
end

function ENT:Touch( hitEt )
if ( hitEnt:IsValid() ) then
hitEnt:Kill()
self.Entity:Remove()


Also I get this error.
entities/entity2/init.lua:36: attempt to index global ‘hitEnt’ (a nil value)

ahh come on someone please!

Your function argument is ‘HitEt’.

You forgot the parentheses. ENT:Use()

As for this dt error show us your shared.lua.

Yes I did, fixed.