Page 1 of 1
EntityPreHook bump_weapon lags
Posted: Sun Jul 26, 2015 9:32 am
by MrMalina
If you use the following code to the server logs begin if the player will be on a few weapons at the same time.
Syntax: Select all
from entities.hooks import EntityPreHook
from memory import make_object
from weapons.entity import WeaponEntity
from players.entity import PlayerEntity
@EntityPreHook('player', 'bump_weapon')
def pre_bump_weapon(args):
player = make_object(PlayerEntity, args[0])
if not player.is_fake_client():
weapon = make_object(WeaponEntity, args[1])
if not weapon.classname in "weapon_awp":
return True
When the player stands on a 2-3 weapons simultaneously ping rises to 20-30, if 5-6, then 100+.
Linux server, cs:go.
Posted: Sun Jul 26, 2015 10:43 am
by Predz
From what I know about the "weapon_bump" function in CSGO, and CSS, is that it seems to be fired every game tick as long as you are stood on a weapon. So therefore I think it maybe that your code is being fired every game tick and thus causing some sort of instability in the server.
Not to sure otherwise, because currently I have written a restriction system and have not come across this sort of problem yet.

Posted: Sun Jul 26, 2015 12:40 pm
by MrMalina
Syntax: Select all
from entities.hooks import EntityPreHook
from weapons.entity import WeaponEntity
from players.entity import PlayerEntity
from entities.helpers import index_from_pointer
@EntityPreHook('player', 'bump_weapon')
def pre_bump_weapon(args):
player = PlayerEntity(index_from_pointer(args[0]))
if not player.is_fake_client():
weapon = WeaponEntity(index_from_pointer(args[1]))
if not weapon.classname in "weapon_awp":
return True
Posted: Sun Jul 26, 2015 1:54 pm
by Ayuto
Does that also happen if you just hook the function?
Syntax: Select all
@EntityPreHook('player', 'bump_weapon')
def pre_bump_weapon(args):
pass
Posted: Sun Jul 26, 2015 2:19 pm
by MrMalina
With this code, Ping increases by 1-2, when purchased 15+ weapons.
Posted: Sun Jul 26, 2015 2:25 pm
by MrMalina
Well, I tried to change a little code:
Syntax: Select all
@EntityPreHook('player', 'bump_weapon')
def pre_bump_weapon(args):
index = index_from_pointer(args[0])
edict = edict_from_pointer(args[1])
if not edict.get_class_name() in "weapon_awp":
return True
With this code, Ping increases by 4-5, when purchased 15+ weapons, this option is right for me, seems to get every time PlayerEntity and WeaponEntity - inefficiently
Posted: Sun Jul 26, 2015 3:17 pm
by satoon101
Just so you know, we are working on a weapon restrict system that will handle not only bumping weapons but also stops restricted players from purchasing them.
Posted: Sun Jul 26, 2015 3:48 pm
by Mahi
satoon101 wrote:Just so you know, we are working on a weapon restrict system that will handle not only bumping weapons but also stops restricted players from purchasing them.
I hope the bolded part is going to be optional! What if you want the player to still be able to drop items for his teammates, but not use them himself?
Posted: Sun Jul 26, 2015 4:07 pm
by satoon101
That's not really how weapon restriction works. Instead of that, a better option would be to have players able to give teammates money to purchase the weapons themselves.