Page 1 of 1

[Cs:s] Entity Remove

Posted: Mon Dec 06, 2021 4:04 pm
by cssbestrpg
Hello, after the newest update of the Source.Python Entity(index).remove() have started giving these errors:
The server is linux

Code: Select all

[2021-12-06 16:49:25]: Exception ignored in: <bound method __del__ of <entities._base.Entity object at 0xe52f7f00>>
[2021-12-06 16:49:25]: TypeError: No registered converter was able to extract a C++ pointer to type CPointer from this Python object of type Entity


Small part of the plugin that causes the error

Syntax: Select all

def loopItemCheck(i, item, color, _user=None):
try:
if Entity(i).get_property_vector('m_vecOrigin') and not Entity(i).classname.startswith('weapon_'):
x,y,z = rpglib.getEntityLocation(i)
_start = Vector(x, y, z)
_end = Vector(x, y, z + 1250)
for es in rpg.getEffectUsers():
rpglib.beam(RecipientFilter(es and rpglib.indexFromUserid(es)), _start, _end, 0.2, 30, 1, 2, color[0], color[1], color[2], 255, 'sprites/laser.vmt')
if _user and rpglib.exists(_user, target_type='userid') and rpglib.isAlive(_user):
_list = [_user]
else:
_list = filter(lambda w: rpglib.isAlive(w), rpglib.getUseridList())
for user in _list:
x1,y1,z1 = rpglib.getPlayerLocation(user)
if ((x - x1) ** 2 + (y - y1) ** 2 + (z - z1) ** 2) ** 0.5 <= 45:
Player.from_userid(user).emit_sound(sample='npc/combine_gunship/gunship_ping_search.wav', volume=1.0,attenuation=0.0)
Entity(i).remove() # This line causes the error when removes entity
name = item['name']
slot = item['slot']
type = item['type']
power = item['power']
active = 0
ownerid = rpglib.get_steamid(user)
database.addItem(name, slot, type, power, active, ownerid)
saveItems()
loadItems()
broadcast('%s picked up a %s%s item \x07FFFFFF(%s)' % (rpglib.get_name(user), Color(color[0], color[1], color[2]), getTierFromPower(power).title(), _DATA['slots'][str(slot)]['name'].title()))
break
Entity(i).delay(0.2, loopItemCheck, (i, item, color, _user))
except ValueError:
pass

Re: [Cs:s] Entity Remove

Posted: Mon Dec 06, 2021 7:32 pm
by L'In20Cible
It's safe to ignore that warning. It has nothing to do with Entity.remove but happens if Entity fails to initialize before Pointer and that output is just an informational message. I've pushed a fix to silence it into: aac2f59.