Raised This Month: $ Target: $400
 0% 

Get PlayerIndex from entity ID?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hayer
Junior Member
Join Date: Aug 2006
Old 07-24-2009 , 08:43   Get PlayerIndex from entity ID?
Reply With Quote #1

Hi!

Just found out that register_touch feeds the callfunc with two entities..
So how do I get the PlayerIndex based on the entity ID?
Hayer is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 07-24-2009 , 08:53   Re: Get PlayerIndex from entity ID?
Reply With Quote #2

The first is Touched and the an other is Toucher?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Hayer
Junior Member
Join Date: Aug 2006
Old 07-24-2009 , 08:53   Re: Get PlayerIndex from entity ID?
Reply With Quote #3

Ye, but the Toucher/Touched is not a playerindex.
Hayer is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 07-24-2009 , 08:54   Re: Get PlayerIndex from entity ID?
Reply With Quote #4

A player index can be a number from 0 - 32 (0 is all, 1 is a player, 2 is a player and so..)
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Hayer
Junior Member
Join Date: Aug 2006
Old 07-24-2009 , 09:07   Re: Get PlayerIndex from entity ID?
Reply With Quote #5

Nevermind, I was using pToucher insted of pTouched!
Sorry TitANious - Your right, I'm wrong
Hayer is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-24-2009 , 10:01   Re: Get PlayerIndex from entity ID?
Reply With Quote #6

Generally, and if you need to block the touch, do :

register_touch("entity_class", "player", "function")

Then :

public function(iEntity, iPlayer)
{
}

wiki about register_touch says that you have to register twice but this is false.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-24-2009 , 11:06   Re: Get PlayerIndex from entity ID?
Reply With Quote #7

As note, to block you have to return PLUGIN_HANDLED;
__________________
Arkshine 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 18:23.


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