[H] IClientEntity -> CBaseEntity (CBasePlayer)
Posted: Tue Apr 28, 2020 10:15 pm
[syntax=py]from plugins.info import PluginInfo
from cvars import ConVar
from listeners import OnConVarChanged
from cvars.flags import ConVarFlags
from entities.hooks import EntityPreHook, EntityCondition
from entities.helpers import baseentity_from_pointer
from memory import find_binary, Convention, DataType, make_object
from players.entity import Player
from entities.constants import MoveType
from players.constants import PlayerStates, PlayerButtons
from mathlib import Vector, QAngle
from players import UserCmd
from random import randint
from engines.server import queue_command_string
from core import console_message
from filters.recipients import RecipientFilter
CreateInterface_engine = find_binary('engine')['CreateInterface'].make_function(
Convention.CDECL, # __cdecl
[
DataType.STRING, # const char *
DataType.POINTER, # int *
],
DataType.POINTER # void *
)
CreateInterface_client = find_binary('client')['CreateInterface'].make_function(
Convention.CDECL, # __cdecl
[
DataType.STRING, # const char *
DataType.POINTER, # int *
],
DataType.POINTER # void *
)
p_gEngineClient = CreateInterface_engine('VEngineClient013', None)
p_gClientEntityList = CreateInterface_client('VClientEntityList003', None)
# int IVEngineClient013::GetLocalPlayer(void);
GetLocalPlayer = p_gEngineClient.make_virtual_function(
12, # int GetLocalPlayer();
Convention.THISCALL, # __thiscall
[
DataType.POINTER, # IVEngineClient013*
],
DataType.INT # int
)
# void IClientEntityList::GetClientEntity(int entnum);
GetClientEntity = p_gClientEntityList.make_virtual_function(
3, # void GetClientEntity();
Convention.THISCALL, # __thiscall
[
DataType.POINTER, # p_gClientEntityList*
DataType.INT, # int
],
DataType.POINTER # void
)
index = GetLocalPlayer(p_gEngineClient) # = 1
IClientEntity = GetClientEntity(p_gClientEntityList, index)[/syntax]
How can I convert or get `CBaseEntity` from` IClientEntity`?
from cvars import ConVar
from listeners import OnConVarChanged
from cvars.flags import ConVarFlags
from entities.hooks import EntityPreHook, EntityCondition
from entities.helpers import baseentity_from_pointer
from memory import find_binary, Convention, DataType, make_object
from players.entity import Player
from entities.constants import MoveType
from players.constants import PlayerStates, PlayerButtons
from mathlib import Vector, QAngle
from players import UserCmd
from random import randint
from engines.server import queue_command_string
from core import console_message
from filters.recipients import RecipientFilter
CreateInterface_engine = find_binary('engine')['CreateInterface'].make_function(
Convention.CDECL, # __cdecl
[
DataType.STRING, # const char *
DataType.POINTER, # int *
],
DataType.POINTER # void *
)
CreateInterface_client = find_binary('client')['CreateInterface'].make_function(
Convention.CDECL, # __cdecl
[
DataType.STRING, # const char *
DataType.POINTER, # int *
],
DataType.POINTER # void *
)
p_gEngineClient = CreateInterface_engine('VEngineClient013', None)
p_gClientEntityList = CreateInterface_client('VClientEntityList003', None)
# int IVEngineClient013::GetLocalPlayer(void);
GetLocalPlayer = p_gEngineClient.make_virtual_function(
12, # int GetLocalPlayer();
Convention.THISCALL, # __thiscall
[
DataType.POINTER, # IVEngineClient013*
],
DataType.INT # int
)
# void IClientEntityList::GetClientEntity(int entnum);
GetClientEntity = p_gClientEntityList.make_virtual_function(
3, # void GetClientEntity();
Convention.THISCALL, # __thiscall
[
DataType.POINTER, # p_gClientEntityList*
DataType.INT, # int
],
DataType.POINTER # void
)
index = GetLocalPlayer(p_gEngineClient) # = 1
IClientEntity = GetClientEntity(p_gClientEntityList, index)[/syntax]
How can I convert or get `CBaseEntity` from` IClientEntity`?