Yea when I tried to get entity 0 I would get a crash everytime.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ronny Schedel
Sent: Sunday, December 05, 2004 1:14 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] IVEngineServer::PEntityOfEntIndex(int iEntIndex)
issue in Plugin
As far as i know, entityindex 0 is the server, normal players start
at 1. GetUserID is the unique userid. When a new player connects,
this userid will be incremented.
Greets
Ronny
> The line "if (!playerInfo) ..." is just my short hand for saying "I'm
> doing error checking here, so don't worry playerInfo is non-null past
> here". I should have made that more clear.
>
> The problem was that I was using the wrong entityindex (0) as Ronny
> pointed out.
>
> I must admin I don't quite see how it works:
> My entityindex is 1
> playerInfo->GetUserID() return 2
>
> What is in entityindex 0? as engine->PEntityOfEntIndex(0) returns
> non-null but dies in pain when you try and do stuff with it.
>
>
> Trimbo
>
> On Sun, 5 Dec 2004 12:20:03 -0500, Josh <[EMAIL PROTECTED]> wrote:
>> You need to do
>>
>> if ( playerinfo ){
>> Msg("SteamId: %s\n", playerInfo->GetNetworkIDString());
>> }
>>
>> Not if !playerinfo
>>
>>
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Ronny Schedel
>> Sent: Sunday, December 05, 2004 7:34 AM
>> To: [EMAIL PROTECTED]
>> Subject: Re: [hlcoders] IVEngineServer::PEntityOfEntIndex(int iEntIndex)
>> issue in Plugin
>>
>> I cant see any errors, maybe a wrong playerIndex?
>> Must be greater than 0.
>>
>> Greets
>> Ronny
>>
>> > Is anyone able to help with this?
>> >
>> >
>> > On Sun, 5 Dec 2004 00:47:59 +0000, Tristan Fairbairn
>> > <[EMAIL PROTECTED]> wrote:
>> >> Hi list,
>> >>
>> >> I'm messing about with a plugin and i'm getting a crash when trying to
>> >> access an edict_t* returned by PEntityOfEntIndex(int iEntIndex)
>> >>
>> >> I'm basically trying to find out info about entities based on the
>> >> client index (eventually i'd like to do it based on name and/or steam
>> >> id).
>> >>
>> >> Code goes a little like this:
>> >>
>> >> edict_t *entity = engine->PEntityOfEntIndex(playerIndex);
>> >> if (!entity) ...
>> >>
>> >> IPlayerInfo *playerInfo = playerinfomanager->GetPlayerInfo(entity);
>> >> if (!playerInfo) ...
>> >>
>> >> // This line causes a crash
>> >> Msg("SteamId: %s\n", playerInfo->GetNetworkIDString());
>> >>
>> >> I'm almost certainly doing something wrong, or perhaps my approach is
>> >> totally wrong for what i'm trying to achive. So any thoughts?
>> >>
>> >> ta,
>> >>
>> >> Trimbo
>> >>
>> >
>> > _______________________________________________
>> > To unsubscribe, edit your list preferences, or view the list archives,
>> > please visit:
>> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
>> >
>>
>> _______________________________________________
>> To unsubscribe, edit your list preferences, or view the list archives,
>> please visit:
>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>
>> _______________________________________________
>> To unsubscribe, edit your list preferences, or view the list archives,
>> please visit:
>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>
>>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders