ValueError: Index '1525' is not a valid player.

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
Senior Member
Posts: 722
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany

ValueError: Index '1525' is not a valid player.

Postby Painkiller » Tue Feb 15, 2022 6:52 am

Hello People,
I found a new error in the questionnaire

Code: Select all

2022-02-15 00:15:42 - sp   -   EXCEPTION   
[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/listeners/", line 79, in _tick
  File "../addons/source-python/packages/source-python/listeners/", line 160, in execute
    return self.callback(*self.args, **self.kwargs)
  File "../addons/source-python/plugins/supermod/modules/", line 56, in changeTrail
    player = Player(index_from_inthandle(entity.owner_handle))
  File "../addons/source-python/packages/source-python/entities/", line 133, in __call__
    obj = super().__call__(index)
  File "../addons/source-python/packages/source-python/players/", line 96, in __init__
    PlayerMixin.__init__(self, index)

ValueError: Index '1525' is not a valid player.

Syntax: Select all

# ../addons/source-python/plugins/supermod/modules/

# ============================================================================
# ============================================================================
from colors import Color
from entities.entity import Entity
from listeners import OnEntityCreated
from listeners import OnEntityDeleted
from listeners import OnLevelInit
from entities.helpers import baseentity_from_pointer
import core
from effects.base import TempEntity
from players.entity import Player
import random
from engines.precache import Model
from engines.server import engine_server
from listeners.tick import Delay
from messages import SayText2
from entities.helpers import index_from_inthandle
core.console_message("\n[Supermod] Fragtrail loaded!\n\n")

global map_start
map_start = 1

def level_init(map_name):
global map_start
map_start = 1
Delay(2.0, set_start, (0,))

def set_start(value):
global map_start
map_start = value

Delay(2.0, set_start, (0,))

def on_entity_created(base_entity):
global map_start
if map_start == 0:
entity = Entity(base_entity.index)
except ValueError:
if entity.classname == "npc_grenade_frag":
Delay(0.1,changeTrail, (entity,))

def changeTrail(entity):
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
a = 255
color = r + (g << 8) + (b << 16) + (a << 24)
if color >= 2**31: color -= 2**32
player = Player(index_from_inthandle(entity.owner_handle))
ent = entity.main_glow
glow = Entity(index_from_inthandle(ent))
glow.model = Model("sprites/glow01.spr")
glow.set_property_int("m_clrRender", color)
ent = entity.glow_trail
glow_trail = Entity(index_from_inthandle(ent))
glow_trail.set_property_int("m_clrRender", color)

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 3 guests