NoHero
-
Posts
5 -
Joined
-
Last visited
Content Type
Forums
Profiles
Events
Gallery
Downloads
Articles
Posts posted by NoHero
-
-
I was looking at sol's stats logger lua script and couldn't understand one thing, i hope it can be explained by someone. In the extra lib dblib.lua the table containing the functions, each function uses a variable called 'c' what is this?
i.e:
DB:Connect("dbname", "dbuser", "dbpassword", "dbhost", 3306)
['Connect'] = function ( c, DBName, DBUser, DBPass, DBAddr, Port ) require "luasql.mysql" c.env = assert( luasql.mysql() ) c.con = assert(c.env:connect(DBName, DBUser, DBPass, DBAddr, Port)) end,
i hope sol doesn't mind me posting snippets
what is c doing? some sort of namespace?
-
Additionally, the "ps.persistant" is probably not a good way to get the score. The better way to get the XP should be to calculate "sess.skill" array values together. This way it won't be necessary to check if the player is in a team, dead or if he is speccing and the returned result will be correct. The ps (playerstate) values depend a lot on what the player is doing.
Thanks for the tip, i will definitely use it since my next project will need to get XP again.
-
If I remember correctly xp will show as 0 until at least one xp is gained in the round/map. (Bugged the hell out of me when testing) This was a long time ago though when I was testing on etpub, so I am unsure if this is still the case in silent mod.
Thanks, that was messing me up everything was working i just didn't realise ^^
-
I was originally asked to modify a autolevel lua script seen the same script in slight different forms around the internet. Thing is both in the original scrip and my modified one i get the same problem:
return et.gentity_get(pID, "ps.persistant", 0)
returns 0 when the players XP is not 0.
Is ps.persistant the right fieldname for XP? I bypassed this section of code and everything else in my script works last nail to be done before implementing it.
Lua question
in Programming (C#, C++, JAVA, VB, .NET etc.)
Posted
Ah i see thanks, confused me because when i looked at OOP in lua examples the class was constructed differently. I see now that there are a few ways of doing it.