Page 1 of 1

Accessing sess.aWeaponStats

Posted: Sat Jun 10, 2006 12:27 pm
by Hendrek'
How can I access sess.aWeaponStats from LUA ? The appended code prints only garbrage :(

Code: Select all

function et_InitGame( levelTime, randomSeed, restart )
  maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) )
end

function et_Print( text )
  local s, e = string.find( text, "Exit: " )
  if s == 1 then
    ShowStats( )
  end
end

function ShowStats( )
  local i
  for i = 0, maxclients - 1 do
    local team = et.gentity_get( i, "sess.sessionTeam" )
    if team == 1 or team == 2 then
      for j = 0, 21 do
        local stats = et.gentity_get( i, "sess.aWeaponStats", j )
        et.G_Print( "player " .. i .. ", weapon " .. j .. ": " .. stats[1] .. "," .. stats[2] .. "," .. stats[3] .. "," .. stats[4] .. "," .. stats[5] .. "\n" )
      end
    end
  end
end

Posted: Sat Jun 10, 2006 10:38 pm
by =FF=im2good4u
if its so barbage then sorry to say i bu maybe u should lean some LUA

Posted: Sun Jun 11, 2006 12:20 am
by Hendrek'
=FF=im2good4u wrote:if its so barbage then sorry to say i bu maybe u should lean some LUA
hmm... very useful help. thx

This is the output from the LUA script:

player 4, weapon 0: 3307417600,3295985664,1134788608,3307261952,3295363072
player 4, weapon 1: 1137213440,3307339776,3295674368,1135869952,0
player 4, weapon 2: 0,0,1023,0,0
player 4, weapon 3: 0,573263712,1,0,0
player 4, weapon 4: 0,537849280,0,0,0
player 4, weapon 5: 0,0,0,0,0
player 4, weapon 6: 0,0,0,33619969,0
player 4, weapon 7: 0,0,0,0,0
player 4, weapon 8: 0,0,0,0,0
player 4, weapon 9: 0,0,0,0,0
player 4, weapon 10: 0,0,0,0,0
player 4, weapon 11: 0,0,0,0,0
player 4, weapon 12: 0,0,0,0,0
player 4, weapon 13: 0,0,0,0,0
player 4, weapon 14: 0,0,0,0,0
player 4, weapon 15: 0,0,0,0,0
player 4, weapon 16: 0,0,0,0,0
player 4, weapon 17: 0,0,0,0,0
player 4, weapon 18: 0,537202640,0,0,0
player 4, weapon 19: 1,2,0,0,0
player 4, weapon 20: 0,0,0,0,0
player 4, weapon 21: 0,0,0,0,0

Posted: Tue Jun 13, 2006 5:36 am
by =FF=im2good4u
hmm oke its either a singed / unsinged missmatch or broken :p

Code: Select all

// OSP - weapon stat counters
typedef struct {
	unsigned int atts;
	unsigned int deaths;
	unsigned int headshots;
	unsigned int hits;
	unsigned int kills;
} weapon_stat_t;

Posted: Mon Nov 20, 2006 12:30 am
by McSteve
Does anyone have any further information on this? I've been having the same problem.

thanks in advance

Posted: Mon Nov 20, 2006 12:41 am
by ReyalP
It's bugged, wait for the next release.

Posted: Mon Nov 20, 2006 1:07 am
by McSteve
:(

Any workaround?

Posted: Mon Nov 20, 2006 2:05 am
by ReyalP
McSteve wrote::(

Any workaround?
I'm afraid not. :(