Get Headshot stats with LUA ?


(ETdemin) #1

hello

Please is there a way to get Head Shot stats in LUA ?

And same question for Accuracy.

Thanks


(Smurfer) #2

Hi BigBear.


(acQu) #3

LOL

I have this little script here

function et_ClientSpawn( clientNum, revived )
	et.G_Print("clientNum is ".. clientNum .. "

")
	test = et.gentity_get(clientNum, "sess.aWeaponStats" , 4)
	et.G_Print("sess.aWeaponStats is ".. test[1] .. "
")
end

bound to et_ClientSpawn func. Can someone tell me how i can now retrieve .atts, .headshots, and all the other stuff ? It must be something with test, but how ? O_O

P.S. i like BigBear by the way :slight_smile: :smiley:


(ETdemin) #4

thanks for the script

why it’s a bigbear script ? thank you to bigbear


(ETdemin) #5

I have found a link that speak of that too

http://bani.anime.net/banimod/forums/viewtopic.php?t=6470

and have tested to use a field {} but when I try I always obtain an error like that
tried to get invalid gentity field “sess.aWeaponStats”


(acQu) #6

The script was mine, not BigBears :stuck_out_tongue:

I get same results as in the thread. When i iterate over the table, it gives me back 5 fields. So that is ok, because you should get 5 unsigned int values. But the numbers i get are like in the thread. Always like 0,0,0.5342314124214,0,0 for Thompson. I tried to convert them, but nothing, still the same. So i guess it was never fixed (in etpro).

EDIT: ah, the error might have to do that you use another mod which does not support sess.aWeaponStats field. Have you checked that ?


(acQu) #7

I see it on the TODO list in etpub:

// TODO: sess.aWeaponStats
//et_gclient_addfield(sess.aWeaponStats, FIELD?_ARRAY, 0),


(Phenomenon) #8

Added it with revision 504 in ETpub but in another way then etpro. We generate a lua table with all weaponstats included. etpro’s implementation looks broken so we don’t need to be compatible to it.

If you want to know how to access the generated table have a look at the lua docs.
To test it out you can grab a nightly server build tomorrow here.

regards
pheno