Update Bump:
Code:
//TODO: TODOs
//TODO: Spellcheck
local SpawnedTexts = 0
local sbox_maxftexts = CreateConVar("sbox_e2_maxftexts","50", FCVAR_ARCHIVE)
local E2Helper = {Descriptions = {}}
E2Helper.Descriptions["fTextCreate"] = "Create a floating text at V with the string S and Radius N"
e2function entity fTextCreate(string text, vector pos, number radius)
pos = Vector(pos[1],pos[2],pos[3])
if (sbox_maxftexts:GetInt() >= 0) then
if (SpawnedTexts >= sbox_maxftexts:GetInt()) then return end
end
ent = ents.Create("point_message")
if not ent then return end
ent:Activate()
ent:SetKeyValue("message",text)
ent:SetKeyValue("radius",radius)
ent:SetPos(pos)
ent:Spawn()
local phys = ent:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
//TODO: Something to the texts spawned by E2 disappear on removal and lowering counter MAYOR!!!!
ent:Fire("Activate","",0)
return ent
end
E2Helper.Descriptions["fTextPos"] = "Resets the position of a Floating Text to V"
e2function void entity:fTextPos(vector pos)
pos = Vector(pos[1],pos[2],pos[3])
if (!self.player:IsAdmin()) then
if (this:GetOwner() != self.player) then return end
end
if (!this:IsValid()) then return end
if (this:GetClass() != "point_message") then return end
this:SetPos(pos)
return void
end
E2Helper.Descriptions["fTextText"] = "Sets the Text of a Floating Text to S"
e2function void entity:fTextText(string text)
if (!self.player:IsAdmin()) then
if (this:GetOwner() != self.player) then return end
end
if (!this:IsValid()) then return end
if (this:GetClass() != "point_message") then return end
this:SetKeyValue("message",text)
return void
end
E2Helper.Descriptions["fTextRadius"] = "Sets the Radius of a Floating Text to N"
e2function void entity:fTextRadius(number radius)
if (!self.player:IsAdmin()) then
if (this:GetOwner() != self.player) then return end
end
if (!this:IsValid()) then return end
if (this:GetClass() != "point_message") then return end
this:SetKeyValue("radius", radius)
end This is still early progress... I have no idea how to get it to lower the counter or simply remove the texts on E2 removal. The Limit is GLOBAL, but this is on purpose.
It also needs further testing. I only checked the create function, if it works. I also don't know if the limit works, or if you can change the limit.
Setting it to -1 should disable it.
And this is were I don't wanna continue :P Have fun!
Xan
Bookmarks