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

Solved Dereference inside plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 11-23-2019 , 20:46   Dereference inside plugin
Reply With Quote #1

I know it's possible to do dereference inside gamedata with "read" "0", but how to do dereference in a plugin?


I need to do something like this (SomeAddress is the player's address)

PHP Code:
*(SomeAddress 666) = -1
I've tried
PHP Code:
Address ? = (GetEntityAddress(?)) + 0
but I don't think it changed anything
__________________
cry

Last edited by BHaType; 11-24-2019 at 05:44.
BHaType is offline
Send a message via AIM to BHaType
ampreeT
Junior Member
Join Date: Oct 2019
Old 11-23-2019 , 21:16   Re: Dereference inside plugin
Reply With Quote #2

Code:
Address pAddressToRead = view_as<Address>(view_as<int>(GetEntityAddress(iEntityIndex)) + iYourOffset);
int iValue = LoadFromAddress(pAddressToRead, NumberType_Int32);
https://sm.alliedmods.net/new-api/so...oadFromAddress

Not sure about writing, but you could probably use StoreToAddress.

https://sm.alliedmods.net/new-api/so...StoreToAddress

Last edited by ampreeT; 11-23-2019 at 21:19. Reason: forgot write
ampreeT is offline
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 11-24-2019 , 05:44   Re: Dereference inside plugin
Reply With Quote #3

Quote:
Originally Posted by ampreeT View Post
Code:
Address pAddressToRead = view_as<Address>(view_as<int>(GetEntityAddress(iEntityIndex)) + iYourOffset);
int iValue = LoadFromAddress(pAddressToRead, NumberType_Int32);
https://sm.alliedmods.net/new-api/so...oadFromAddress

Not sure about writing, but you could probably use StoreToAddress.

https://sm.alliedmods.net/new-api/so...StoreToAddress
Thanks for the help, but dereferencing didn't solve the problem, but I got the answer to my question, so thanks anyway
__________________
cry
BHaType is offline
Send a message via AIM to BHaType
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 11-24-2019 , 06:20   Re: Dereference inside plugin
Reply With Quote #4

Quote:
Originally Posted by Silvers View Post
Thanks for the information. How about helping others by explaining the solution. This is like those who edit their post and write "solved". Why should anyone help if you don't want to help us in return.
The topic title is about how to make dereference in a plugin without using gamedata, not about what I need dereference for.

Quote:
Originally Posted by Silvers View Post
How about helping others by explaining the solution.
Also I said earlier that the idea failed then what solution are you talking about?
Spoiler


The whole idea was to change the target for the tank using StoreToAddress but apparently it's all hardcoded

Linux


Windows



On Windows it is perfectly visible that some function is executed while on Linux it is not present.
Apparently my way will only work on Linux, but that's just guesswork

P.S I know how to get a TankAttack class from a regular tank.
__________________
cry
BHaType is offline
Send a message via AIM to BHaType
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-24-2019 , 09:01   Re: Dereference inside plugin
Reply With Quote #5

Quote:
Originally Posted by Silvers View Post
Because this sounded like you had a solution:
Yes, ampreeT's post is the answer to the question in the OP.
__________________
asherkin is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 11-24-2019 , 10:29   Re: Dereference inside plugin
Reply With Quote #6

if you want to change the target of the tank in L4D2 you can use l4downtown2 (you need to look around the last pages for a more updated version) where there is a callback available OnChooseVictim or someting similar like that. where you can change the target. This works for all special infected apart from the witch because missing of the function.

Not sure how much would need to be changed in the extension to make it work in l4d1

Last edited by xerox8521; 11-24-2019 at 10:31. Reason: Added info about the specific game.
xerox8521 is offline
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 11-24-2019 , 17:17   Re: Dereference inside plugin
Reply With Quote #7

Quote:
Originally Posted by Silvers View Post
Good for you, great knowledge sharing.
How many times do I have to repeat that this topic is about how to do dereference and not about how to get TankAttack and even more so I already said that the idea failed

I said earlier that windows is running some function, so even if I say about how to get TankAttack it does not help to solve the problem but maybe for Linux it makes sense, but I do not know how to get TankAttack on Linux

Quote:
Originally Posted by xerox8521 View Post
if you want to change the target of the tank in L4D2 you can use l4downtown2 (you need to look around the last pages for a more updated version) where there is a callback available OnChooseVictim or someting similar like that. where you can change the target. This works for all special infected apart from the witch because missing of the function.

Not sure how much would need to be changed in the extension to make it work in l4d1
I know about downtown but I have no desire to install a large extension in which I will only use 1 forward, so I thought to find another solution.
__________________
cry

Last edited by BHaType; 11-24-2019 at 17:28.
BHaType is offline
Send a message via AIM to BHaType
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 12-16-2019 , 06:45   Re: Dereference inside plugin
Reply With Quote #8

off.
Interesting experiments. Good luck!
Please, share when you finally found a way to change victim.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas 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 20:04.


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