ok then, but u have to exclude the bitflag of using console (its more than 50 000)crazyfrag wrote:this wont work cuz if u press console or fire or anything else while prone the bitflag gets to high ... and sometimes u start playing ur bitflag is 4 and sometimes ist 0 so i used greater than function ... cuz this is for a headshot server so i dont have the really high bitflags so its working without problems!Luk4ward wrote:
if ( ((et.gentity_get(j, "s.eFlags")) == 524292) or ( (et.gentity_get(j, "s.eFlags")) == 1572868 ) ) then
the loweset bitfalg for prone has to be 524288
anti prone :-)
Moderators: Forum moderators, developers
wolFTeam.pl
I want to catch a vote. From what u r saying this code should works:
But it isnt hmm...
Code: Select all
for j = 0, maxclients-1 do
if (et.gentity_get(j, "s.eFlags")) == 16384 then
voted = true
et.G_LogPrint(string.format("client %d voted\n",j))
end
end
wolFTeam.pl
flags are bitflags
it has to be 16900 i think...
but if i think about it then i think u have a mistake in ur script.
just 4 example if u do notihng and vote ur bitflag is 16900 but if u sit on a tank and vote ur bitflag is 49668
it has to be 16900 i think...
Code: Select all
active 4
console /talking 512 (limbo etc.)
voted 16384
_______________________________
= 16900
just 4 example if u do notihng and vote ur bitflag is 16900 but if u sit on a tank and vote ur bitflag is 49668
I see, what a shit :/crazyfrag wrote:flags are bitflags
it has to be 16900 i think...but if i think about it then i think u have a mistake in ur script.Code: Select all
active 4 console /talking 512 (limbo etc.) voted 16384 _______________________________ = 16900
just 4 example if u do notihng and vote ur bitflag is 16900 but if u sit on a tank and vote ur bitflag is 49668
wolFTeam.pl
How about a simple function to handle this
Array is reversed (of course we can solve it) - but it's better for us.
Now just get the bit value:
bits[1] is a first bit (1)
bits[2] is a second one (2)
bits[3] is a 3rd one (4)
bits[4] and a 4th one (8)
etc.
I haven't checket this, but should work :)
Code: Select all
function tobits( number )
-- bits array
local bits = { }
-- let's get some bits
while( number > 0 ) do
-- bit value (reversed)
table.insert( bits, math.mod( number, 2 ) )
-- divide
number = math.floor( number / 2 )
end
return bits
end
Now just get the bit value:
bits[1] is a first bit (1)
bits[2] is a second one (2)
bits[3] is a 3rd one (4)
bits[4] and a 4th one (8)
etc.
I haven't checket this, but should work :)
Let's see, the flag for prone is:crazyfrag wrote:and what can i do with this :O (im not that expert in lua coding :O )
Code: Select all
#define EF_PRONE 0x00080000
So, we are going to use this function for any number (for example 524292) to get binary code
Code: Select all
local binary = tobits( 524292 )
now we can just simple check 20th bit of this array (because tables in lua begins from 1)524292 = 524288 + 4
1st bit, 1 = 0
2nd bit, 2 = 0
3rd bit, 4 = 1
4th bit, 8 = 0
...
9th bit, 262144 = 0
20th bit, 524288 = 1
Code: Select all
if binary[20] then
--do something, prone flag is set
else
--do something
end
Code: Select all
#define EF_PRONE_MOVING 0x00100000 // player is prone and moving
You have almost done itcrazyfrag wrote:may u code a complete function for this? ty
Code: Select all
samplerate = 200
--
function tobits( number )
-- bits array
local bits = { }
-- let's get some bits
while( number > 0 ) do
-- bit value (reversed)
table.insert( bits, math.mod( number, 2 ) )
-- divide
number = math.floor( number / 2 )
end
return bits
end
function et_InitGame( levelTime, randomSeed, restart )
mclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) ) --gets the maxclients
end
function et_RunFrame( levelTime )
if math.mod( levelTime, samplerate ) ~= 0 or tonumber( et.trap_Cvar_Get( "gamestate" ) ) ~= 0 then
return
end
-- for all clients
for i = 0, mclients -1 do
local bits = tobits( et.gentity_get( i, "s.eFlags" ) )
if bits[20] or bits[21] then
et.gentity_set( i, "health", -200 )
et.G_Sound( i, et.G_SoundIndex( "sound/player/hurt_barbwire.wav" ) )
et.trap_SendServerCommand( -1, "chat "".. et.gentity_get( i, "pers.netname" ) .." ^3proned and has been gibbed!\n"" )
end
end
end
Last edited by X-DOS on Wed Mar 18, 2009 10:52 am, edited 1 time in total.
Code: Select all
samplerate = 200
--
function tobits( number )
-- bits array
local bits = { }
-- let's get some bits
while( number > 0 ) do
-- bit value (reversed)
table.insert( bits, math.mod( number, 2 ) )
-- divide
number = math.floor( number / 2 )
end
return bits
end
function et_InitGame( levelTime, randomSeed, restart )
mclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) ) --gets the maxclients
end
function et_RunFrame( levelTime )
gamestate = tonumber(et.trap_Cvar_Get( "gamestate" ))
if math.mod( levelTime, samplerate ) ~= 0 or gamestate == 1 or gamestate == 2 then
return
end
-- for all clients
for i = 0, mclients -1 do
local bits = tobits( et.gentity_get( i, "s.eFlags" ) )
if bits[20] or bits[21] then
et.gentity_set( i, "health", -200 )
et.G_Sound( i, et.G_SoundIndex( "sound/player/hurt_barbwire.wav" ) )
et.trap_SendServerCommand( -1, "chat \"".. et.gentity_get( i, "pers.netname" ) .." ^3proned and has been gibbed!\n\"" )
end
end
end
works pretty nice i've editetd it there was a mistake with a ; and the gamestate