
Originally Posted by
ahref
I was gonna sugest that but that wouldnt that be a bit laggy?
it would work though

No way, just index them in a unique slot specific for this purpose:
Code:
wire_exp2_TextList = {}
registerFunction("lastSaid", "e:", "s", function(self, args)
local op1 = args[2]
local rv1 = op1[1](self, op1)
local entity = checkEntity(rv1)
if(!entity || !rv1:IsValid()) then return nil end
if(!entity:IsPlayer()) then return nil end
if !wire_exp2_TextList[entity] then return "" end
return wire_exp2_TextList[entity][1]
end)
registerFunction("lastSaid", "", "s", function(self, args)
if (!wire_exp2_TextList['last'] || !wire_exp2_TextList['last'][2] then return "" end
return wire_exp2_TextList['last'][2]
end)
registerFunction("lastSpoke", "", "e", function(self, args)
if (!wire_exp2_TextList['last'] || !wire_exp2_TextList['last'][1] then return null end
local ply = wire_exp2_TextList['last'][1]
if (!ply:IsValid() || !ply:IsPlayer()) then return null end
return wire_exp2_TextList['last'][1]
end)
function Exp2TextReceiving( ply, text, toall )
wire_exp2_TextList[ply] = {text,toall}
wire_exp2_TextList['last'] = {ply, text, toall}
end
hook.Add("PlayerSay","Exp2TextReceiving",Exp2TextReceiving) There, two more functions added:
LastPersonToSpeak = lastSpoke()
LastPersonSaid = lastSaid()
Bookmarks