Raised This Month: $51 Target: $400
 12% 

playerinfo->IsPlayer() crash server on ClientActive


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sn4k3
Senior Member
Join Date: Nov 2005
Old 08-09-2010 , 16:21   playerinfo->IsPlayer() crash server on ClientActive
Reply With Quote #1

Plugin is crashing server on ClientActive Callback
when try check for playerinfo->IsPlayer(); i also tried playerinfo->GetName(); and crash too, playerinfo should be invalid but the variable its not null

Console Logs:

Code:
Client "sn4k3" connected (192.168.1.70:27005).
"sn4k3<2><STEAM_0:1:7174016><>" STEAM USERID validated
Compressing fragments (5591 -> 5130 bytes)
PASS 3
What bad 1
What bad 2
What bad 3
Test 1
Test 2
Test 3
My Code:

Code:
IPlayerInfo *LIB_ENTITY_CLASS::GetPlayerinfoFromEntity(edict_t *pEntity)
{
	if (!IsEntitySafe(pEntity)) return NULL;

	Msg("Test 1\n");
    IPlayerInfo *playerinfo = VAR_IFACE_PLAYERINFOMANAGER->GetPlayerInfo(pEntity);
	Msg("Test 2\n");
	if(!playerinfo)
		return NULL;
	Msg("Test 3\n");
	if(!playerinfo->IsPlayer())
	{
		Msg("Test 3.1\n");
		return NULL;
	}
	Msg("Test 4\n");
	if(!playerinfo->IsConnected())
		return NULL;
	Msg("Test 5\n");
	return playerinfo;
}
how could i solve?
thanks
sn4k3 is offline
Send a message via MSN to sn4k3
Keeper
Senior Member
Join Date: Nov 2006
Old 08-09-2010 , 18:13   Re: playerinfo->IsPlayer() crash server on ClientActive
Reply With Quote #2

What SDK are you using? I believe the IPlayerInfo class has changed. If you are using the stock SDK from VALVe, that might explain it.
Keeper is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 08-09-2010 , 18:38   Re: playerinfo->IsPlayer() crash server on ClientActive
Reply With Quote #3

Quote:
Originally Posted by Keeper View Post
What SDK are you using? I believe the IPlayerInfo class has changed. If you are using the stock SDK from VALVe, that might explain it.
im using hl2sdk-ob-valve: http://hg.alliedmods.net/hl2sdks/hl2sdk-ob-valve/

it work in all others cases, like UserMessages get name, get steamid, etc (Out of ClientActive)

its strange
sn4k3 is offline
Send a message via MSN to sn4k3
BAILOPAN
Join Date: Jan 2004
Old 08-10-2010 , 03:28   Re: playerinfo->IsPlayer() crash server on ClientActive
Reply With Quote #4

If you read the SDK, you'll see that PlayerInfo is instantiated with the entity, and player entities are not created until PutInServer.
__________________
egg
BAILOPAN is offline
sn4k3
Senior Member
Join Date: Nov 2005
Old 08-10-2010 , 09:58   Re: playerinfo->IsPlayer() crash server on ClientActive
Reply With Quote #5

Quote:
Originally Posted by BAILOPAN View Post
If you read the SDK, you'll see that PlayerInfo is instantiated with the entity, and player entities are not created until PutInServer.
oh ok, i always think it should work on ClientActive because they say: Purpose: called when a client spawns into a server (i.e as they begin to play)

thanks
sn4k3 is offline
Send a message via MSN to sn4k3
sn4k3
Senior Member
Join Date: Nov 2005
Old 08-10-2010 , 12:45   Re: playerinfo->IsPlayer() crash server on ClientActive
Reply With Quote #6

Problem solved, my fault


i was inputing index (int from my class, after set to 0), when argument its playerindex

so i used argument playerindex to all lines less on the GetPlayerInfo, so all checks say playerindex is valid, but when i use index to getplayerinfo it crash because its 0

so ClientActive is fine and work well with IPlayerInfo
sn4k3 is offline
Send a message via MSN to sn4k3
BAILOPAN
Join Date: Jan 2004
Old 08-13-2010 , 00:48   Re: playerinfo->IsPlayer() crash server on ClientActive
Reply With Quote #7

Yes, ClientActive occurs after PutInServer.
__________________
egg
BAILOPAN is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode