So I just realised that if you check my original coding post that I did use both () and (player) on this
When I use this code -
Code:
local ITEM = Clockwork.item:New();
ITEM.name = "Keys";
ITEM.cost = 100;
ITEM.model = "models/gibs/metal_gib4.mdl";
ITEM.weight = 0.1;
ITEM.access = "I";
ITEM.category = "Citizen Keys";
ITEM.business = true;
ITEM.description = "A pair of jingling keys.";
function ITEM:OnUse()
ITEM:AddData("ID", -1);
ITEM:AddQueryProxy("name", ITEM.GetName);
return false;
end;
function ITEM:GetName()
return "Keys - "..self:GetData("ID", -1);
end;
if (SERVER) then
function ITEM:OnInstantiated(player)
ITEM:SetData("ID", player:GetCharacterData("citizenid"));
end;
end;
-- Called when a player drops the item.
function ITEM:OnDrop(player, position) end;
ITEM:Register();
It doesn't let me have the item because it throws an error in the console; something to do with player having a nil value or something like that. Any ideas why?
edit - I've also tried this -
Code:
local ITEM = Clockwork.item:New();
ITEM.name = "Keys";
ITEM.cost = 100;
ITEM.model = "models/gibs/metal_gib4.mdl";
ITEM.weight = 0.1;
ITEM.access = "I";
ITEM.category = "Citizen Keys";
ITEM.business = true;
ITEM.description = "A pair of jingling keys.";
function ITEM:OnUse(player)
ITEM:AddQueryProxy("name", "name");
ITEM:AddData("name", -1);
ITEM:SetData("name", player:GetCharacterData("citizenid"));
return false;
end;
-- Called when a player drops the item.
function ITEM:OnDrop(player, position) end;
ITEM:Register();
And other variations of it.