Looking for someone to fix my code

I’ve made a currency system with a shop, and it worked well in single before I made some changes and added it to server. Now it’s all fucked up and I cant get it work. If someone, who has high experience in gmod lua code wants to fix my script, please contact me.

I will not post my code there, because it’s in 6 differrent files with much code and the problem could also be the addon structure. I’ll zip the packpage for anyone who wants to help me.

Add my steamnick ankkafin if you’re willing to help me.

… really, I’ve submitted over 3 help requests and all of them got no answers and the projects died… Please, if someone even has some time to check the code, reply in this topic and I’ll PM you the zip.

People are more likely to respond if you post more information about the specific problem you are having. If you are getting a Lua error, post the error and the code it appears in as a start.

well the problem is that I dont know what the problem is. No lua error, nothing. It just doesnt work. It worked before on singleplayer, but I edited a bit to make it work in action on multi.

PM me i will help , i have nothing else todo , better be quick posting it tho , i wont be able to help tmro

dingusnin wasnt able to help me… Anyone else?

well, because I wont get answers, I’ll post whole packpage to public. I hope nobody will steal it.

-snip-

Lua Error: Timer Error: [addons\activitypoints\lua\autorun\server\money.lua:30] attempt to perform arithmetic on field ‘points’ (a nil value)

That’s the only error I found from server console, but one weird thing is that the code where error message is located at works perfectly… Maybe problems with addon structure?

Add ply.points = 0 in activitypoints’s PlayerInitialSpawn hook.
So like this:
[lua]
function PlayerInitialSpawn( ply )
ply:player_exists()
ply:Initialize()
ply.points = 0
end

[/lua]

I could of helped you if you gave me the addon 3 hours befor

You didnt read whole project?

in sql.lua:
[lua]function meta:player_exists()

result = sql.Query("SELECT unique_id, points FROM player_info WHERE unique_id = '"..self:SteamID().."'")
if (result) then
    self:GetPoints()
    self:SendPoints()
else
    self:new_player()
end

end[/lua]

and in money.lua:
[lua]function meta:GetPoints()
result = sql.QueryValue( “SELECT points FROM player_info WHERE unique_id = '”…self:SteamID()…"’" )
if (result) then
self.points = result
else
Msg("Couldnt get points from database!
")
end
end[/lua]

and well, the currency is working. Only shop is fucked up…

I fixed the error you asked to get fixed…

k, anyways lemme test it on server then.

[editline]03:41PM[/editline]

Well, that change made it so people lost all their activitypoints and they start from 0… Other ideas?

It was only a example… It should be something like: ply.points = ply:GetPoints() or 0

But playerexists already gets the points?

Put this before pleyerexistes. The problem is (If I remember correct) is that you didn’t set the player var to any value. So just use ply.poins = 0 before playerexistes, and then the correct value should be loaded after that.

hmm, that didnt help… Anyways found the solution myself! there was a problem in concommands.lua, as I kinda guessed. Thanks for everyone who even tried to help me!