Raised This Month: $32 Target: $400
 8% 

[HELP] Detect Team Change (cstrike)


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-15-2016 , 11:32   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #11

Quote:
Originally Posted by Bos93 View Post
new iTeam = OrpheuMemoryGetAtAddress( params + 4 , "int" );
new iModel = OrpheuMemoryGetAtAddress( params + 8 , "int" );

Why did you add these numbers?
Because if you look at the source for the function, the parameters are passed in an array. params is the address of the array. The player id is in the first cell so no offset is needed; team is in the second cell (+ 4 bytes offset) and model is in the third cell (+8 bytes offset)

CstrikeNatives.cpp
PHP Code:
static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amxcell *params// cs_set_user_team(index, team, model = 0); = 3 params
{
    
// Set user team
    // params[1] = user index
    // params[2] = team
    // params[3] = model = 0 
__________________

Last edited by Bugsy; 10-15-2016 at 16:01.
Bugsy is online now
Bos93
Veteran Member
Join Date: Jul 2010
Old 10-15-2016 , 11:54   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #12

thx Bugsy!
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 10-15-2016 , 19:22   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #13

PHP Code:
new iPlayer OrpheuMemoryGetAtAddressparams "int" ); 
Shouldn't this get params[0]?

I think the "value" in amxmodx\configs\orpheu\memory\int should be 0, and all three offsets increased by 4.

Last edited by klippy; 10-15-2016 at 19:23.
klippy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-15-2016 , 21:26   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #14

Quote:
Originally Posted by KliPPy View Post
PHP Code:
new iPlayer OrpheuMemoryGetAtAddressparams "int" ); 
Shouldn't this get params[0]?

I think the "value" in amxmodx\configs\orpheu\memory\int should be 0, and all three offsets increased by 4.
I don't know. It's not clear to me what the numerical value represents in the memory files. It was my assumption that this is the size of the data you want to read for the type you are defining. Looking at the other files in the folder, I think I am wrong.
__________________
Bugsy is online now
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 10-15-2016 , 23:16   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #15

OrpheuMemoryGetAtAddress starts searching from a given address. What you are doing is always getting an integer that's + 4 bytes further. That's why you accidentally skipped params[0].
Unless you are aiming at a specific memory address, you should keep the value at 0 I guess. Maybe not if it was a structure member, I don't know.

Last edited by klippy; 10-15-2016 at 23:17.
klippy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-16-2016 , 11:30   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #16

It's just weirdly setup I guess. The way I assumed it worked:

OrpheuMemoryGetAtAddress( memory location , how many bytes to read at this address );
__________________
Bugsy is online now
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-16-2016 , 12:26   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #17

The "how many bytes to read" you define it already in the config file with "int".

"Identifier" is basically to define an address/offset.
With OrpheuMemoryGet(), "identifier" expects a signature/symbol.
With OrpheuMemoryGetAtAddress() "identifier" expects more an offset to apply to the address you provided. If you provide a signature/symbol, it will overwrite the address you provided.

I don't remember if the "identifiers" block can be dropped.
__________________

Last edited by Arkshine; 10-16-2016 at 12:27.
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-16-2016 , 12:42   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #18

Quote:
Originally Posted by Arkshine View Post
The "how many bytes to read" you define it already in the config file with "int".

"Identifier" is basically to define an address/offset.
With OrpheuMemoryGet(), "identifier" expects a signature/symbol.
With OrpheuMemoryGetAtAddress() "identifier" expects more an offset to apply to the address you provided. If you provide a signature/symbol, it will overwrite the address you provided.

I don't remember if the "identifiers" block can be dropped.
I tried, Orpheu complained about it. Thanks for the info.

The above code has been updated.
__________________

Last edited by Bugsy; 10-16-2016 at 14:43.
Bugsy is online now
kristi
Senior Member
Join Date: Nov 2016
Old 09-01-2017 , 01:22   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #19

How do I get the 4th parameter?
Code:
native cs_set_user_team(index, any:team, any:model = CS_DONTCHANGE, bool:send_teaminfo = true);
kristi is offline
Send a message via Skype™ to kristi
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-01-2017 , 21:41   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #20

My current build doesn't have that 4th parameter defined, but try?

PHP Code:
new iSendTeamInfo OrpheuMemoryGetAtAddressGetParamsparams ) , "int" ); 
__________________

Last edited by Bugsy; 09-01-2017 at 21:42.
Bugsy is online now
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 21:39.


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