Thread: IClient
View Single Post
Author Message
Contf
Junior Member
Join Date: Jun 2013
Old 10-03-2019 , 08:58   IClient
Reply With Quote #1

Hi,

So, i was trying to kick a client after connecting if they were not able to join the server, but the server keeps crashing when i am trying to cast the msg to the IClient interface.
I already read the sourcemod source code, and i am pretty sure that's how it is doing the job, but i am missing something that i cant figure it out.
I import the class CPlayer from the source code, and i am calling the method Initialize on the event OnClientConnected , thats where is crashing the server.

Code:
INetChannel *pNetChan = static_cast<INetChannel *>(engine->GetPlayerNetInfo(playerid));
IPlayerInfo *playerinfo = playerinfomanager->GetPlayerInfo(pEdict);

if (pNetChan != NULL && playerinfo->IsConnected())
{
    IClient *pClient  = static_cast<IClient *>(pNetChan->GetMsgHandler());
}

Last edited by Contf; 10-03-2019 at 09:04.
Contf is offline