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

Get player pointer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 08-25-2011 , 17:31   Get player pointer
Reply With Quote #1

Hi, I want to get the player´s player pointer specified in the first param of my native. I´ve tried with:
PHP Code:
GET_PLAYER_POINTER(params[1]) 
but I can´t make it work
I´ll appreciate some help with this stuff

What I'm trying to do: take the player current weapon (like get_user_weapon)
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.

Last edited by S34Qu4K3; 08-25-2011 at 17:44.
S34Qu4K3 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-25-2011 , 17:43   Re: Get player pointer
Reply With Quote #2

Show your function header.

EDIT:

Use GET_PLAYER_POINTER_I() and see if it helps.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 08-25-2011 , 17:51   Re: Get player pointer
Reply With Quote #3

With GET_PLAYER_POINTER_I() or GET_PLAYER_POINTER() I get the same error:
Identifier not found

PHP Code:
static cell AMX_NATIVE_CALL native_test(AMX *amxcell *params)
{
    
    
edict_t *pPlayer =    MF_GetPlayerEdict(params[1]);
    
pPlayer GET_PLAYER_POINTER_I(params[1]);
    
int wpn pPlayer->current//This line also gets an error: error C2039: 'current' : is not a member of 'edict_s'


__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-25-2011 , 17:56   Re: Get player pointer
Reply With Quote #4

Code:
CPlayer* pPlayer = GET_PLAYER_POINTER_I(params[1]);
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 08-25-2011 , 18:07   Re: Get player pointer
Reply With Quote #5

Same error: Identifier not found for CPlayer and GET_PLAYER_POINTER_I
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Old 08-25-2011, 18:11
Arkshine
This message has been deleted by Arkshine. Reason: nvm
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-25-2011 , 18:30   Re: Get player pointer
Reply With Quote #6

Does it not know what CPlayer and GET_PLAYER_POINTER_I() are?
If not, then you might not have everything included properly.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 08-25-2011 , 18:33   Re: Get player pointer
Reply With Quote #7

Arkshine´s support solved Identifier not found for CPlayer if I remove:
PHP Code:
 edict_t *pPlayer =    MF_GetPlayerEdict(params[1]); 
GET_PLAYER_POINTER_I() is defined in amxmodx.h, but if I add this header I get a high ammount of errors in the header ( I think that stdint.h (required by amx.h) causes the errors)
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.

Last edited by S34Qu4K3; 08-25-2011 at 18:37.
S34Qu4K3 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-25-2011 , 18:37   Re: Get player pointer
Reply With Quote #8

Should work :

edict_t *pPlayer = MF_GetPlayerEdict( params[ 1 ] );
int index = (*g_engfuncs.pfnIndexOfEdict)( pPlayer );

int currentWeapon = MF_GetPlayerCurweapon( index );
__________________
Arkshine is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 08-25-2011 , 18:40   Re: Get player pointer
Reply With Quote #9

Works ^^
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-25-2011 , 18:41   Re: Get player pointer
Reply With Quote #10

Actually you can use directly the existing inline (which does the same thing) : ENTINDEX

int index = ENTINDEX( pPlayer );
__________________
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 01:10.


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