You can use a static variable in PrimaryAttack client side. Then, you return
from the function if not enough time has elapsed since your previous shot...
<=- Micha�l "Cortex" Monerau -=>
Rockefeller wrote:
> hi,
>
> when trying to do some advanced weapon coding i discovered a strange
> behavior of the client weapon prediction.
> I'm using a counter in PrimaryAttack(). On the server everything works
> perfectly, but on client the counter is almost always wrong.
>
> Now here's the problem: PrimaryAttack() gets called MANY times on
> client
> when its just called once on the server.
>
> m_flNextPrimaryAttack is set in PrimaryAttack(), but on next frame it
> seems to be gone, m_flNextPrimaryAttack is still <0, and
> PrimaryAttack()
> gets called again! That changes not until a few frames later (maybe
> when
> the next server packet arrive?)
>
> I reproduced this what i think is a bug with an clean version of
> SDK2.3.
>
> Add this to hl_weapons.cpp before calling into PrimaryAttack():
> gEngfuncs.Con_Printf("attack: %f\n", gEngfuncs.GetClientTime());
> Take a pistol and fire once. You see many calls into PrimaryAttack().
>
>
> Maybe there's something wrong with my HL? Can someone plz try to
> reproduce this? If this is indeed a bug, it's very bad: it makes the
> random_seed useless.
>
> Rockefeller
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list
> archives, please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders