Re: NightAngel's Development Thead
Alrighty, here's another post explaining my logic and crying out for someone to save me.
So I'm coding a perk framework for something, but I'm having trouble with getting the derma to use the datastream and transfer the selected perk name and player name to the server so that it can add it to the player's table of perks in their characterdata.
Here's what I've got for the path that the variables travel, but for some reason, it gets to the server as nil.
This is the code in the icon click function that sends the data to the server from the client.
Code:
-- Called when the spawn icon is clicked.
function self.spawnIcon.DoClick(spawnIcon)
local transmitTable = {}
transmitTable.name = self.perk.name;
transmitTable.player = LocalPlayer():GetName();
print(transmitTable.name)
print(transmitTable.player)
Clockwork.datastream:Start("PerkGive", transmitTable);
end;
and this is the code on the server side that receives the data and gives the player the perk, but the data returns as nil atm, and I have no idea why.
Code:
Clockwork.datastream:Hook("PerkGive", function(data)
local perkTable = Schema.perk:FindByID(data.name);
print(data.player)
print(data.name)
if (type(data.player) == string) then
local player = Clockwork.player:FindByID(data.player)
local perks = player:GetCharacterData("perkInfo");
if (!perkTable or !player) then return; end;
Schema.perk:GivePlayerPerk(data.player, data.name)
end;
end)
This is what the derma prints client-side before it sends the data through the datastream.
![[IMG]](http://i.imgur.com/JquWb0j.png)
And this is what it prints server-side when it receives the data.
![[IMG]](http://i.imgur.com/dGICi51.png)
Please help me!
[member=5522]Atebite[/member]
[member=5495]Polis[/member]
[member=1476]Gr4Ss[/member]
[member=1314]Arbiter329[/member]
[member=5482]duck[/member]
<3