EntityPreHook bump_weapon lags

Please post any questions about developing your plugin here. Please use the search function before posting!
MrMalina
Member
Posts: 53
Joined: Mon Apr 08, 2013 2:40 pm
Location: Russian Federation

EntityPreHook bump_weapon lags

Postby MrMalina » Sun Jul 26, 2015 9:32 am

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.
Predz
Senior Member
Posts: 158
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Postby Predz » Sun Jul 26, 2015 10:43 am

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. :confused:
MrMalina
Member
Posts: 53
Joined: Mon Apr 08, 2013 2:40 pm
Location: Russian Federation

Postby MrMalina » Sun Jul 26, 2015 12:40 pm



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
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Sun Jul 26, 2015 1:54 pm

Does that also happen if you just hook the function?

Syntax: Select all

@EntityPreHook('player', 'bump_weapon')
def pre_bump_weapon(args):
pass
MrMalina
Member
Posts: 53
Joined: Mon Apr 08, 2013 2:40 pm
Location: Russian Federation

Postby MrMalina » Sun Jul 26, 2015 2:19 pm

With this code, Ping increases by 1-2, when purchased 15+ weapons.
MrMalina
Member
Posts: 53
Joined: Mon Apr 08, 2013 2:40 pm
Location: Russian Federation

Postby MrMalina » Sun Jul 26, 2015 2:25 pm

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
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Jul 26, 2015 3:17 pm

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.
Image
User avatar
Mahi
Senior Member
Posts: 236
Joined: Wed Aug 29, 2012 8:39 pm
Location: Finland

Postby Mahi » Sun Jul 26, 2015 3:48 pm

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?
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Jul 26, 2015 4:07 pm

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.
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 91 guests