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

Module: Ham Sandwich


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 02-24-2007 , 14:55   Module: Ham Sandwich
#1

newest version is in 1.8, if you're reading this before 1.8 is final released, then download it from here

This module allows you to call 2 private functions for entities, with some cross-mod compatibility.

There are just two natives currently; I may add more if I see some that could be useful.

hs_takedamage(idVictim,idInflictor,idAttacker , Float:damage, type);
hs_use(id,idActivator,idCaller, use_type, Float:use_value);

I have comments for the natives in the include file.

The mods supported:
  • cstrike
  • czero
  • dod
  • tfc
  • ns - 3.2 beta 2
  • ts - only tested on the ts_i386 binary (the default one) should work on the i686 one
  • sven

Note: these are all most recent version, and all are from legitimate versions eg: no steam is not and will never be supported, although it probably will still work


Note: czero support is assumed, I have not tested it.

Note: I only tested hs_takedamage, don't have time to test hs_use just yet.

Note: Most windows offsets are untested but should in theory be correct.

Note: Linux takedamages have all been tested.

Note: No 64 bit support. 64 bit can go to hell.

Read the include file for some more in depth explanations.

Attached is "test.sma", the plugin I used to test takedamage. It may help show it's usage, it may not! It's not meant for general servers, just an example.

edit: I should have a fixed release quality linux binary now; I will test more thoroughly when I get home later tonight. I also fixed it calling takedamage on NS.

Fixed sven coop directory too :o
Attached Files
File Type: inc hamsandwich.inc (3.5 KB, 9112 views)
File Type: sma Get Plugin or Get Source (test.sma - 6794 views - 299 Bytes)
File Type: zip source.zip (69.3 KB, 6869 views)
File Type: zip binaries.zip (50.2 KB, 7075 views)

Last edited by sawce the snail; 09-07-2007 at 22:19.
sawce is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-24-2007 , 15:44   Re: Module: Ham Sandwich
#2

hs_takedamage and hs_use are working fine on Windows 32-bit Sven Co-op (the only build of Sven Co-op).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS

Last edited by XxAvalanchexX; 03-02-2007 at 16:45.
XxAvalanchexX is offline
hip_hop_x
Senior Member
Join Date: Apr 2006
Old 02-24-2007 , 19:22   Re: Module: Ham Sandwich
#3

great module, I'm going to use it in some plugins.
hip_hop_x is offline
Send a message via MSN to hip_hop_x Send a message via Yahoo to hip_hop_x
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-24-2007 , 20:02   Re: Module: Ham Sandwich
#4

This should seriously be merged into core. It would be very very useful. I believe it should also retain its name.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
FormulaZero
BANNED
Join Date: Feb 2007
Location: Sector 7G
Old 02-24-2007 , 20:12   Re: Module: Ham Sandwich
#5

Ham Sandwich, classic. ;)
FormulaZero is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 02-24-2007 , 22:16   Re: Module: Ham Sandwich
#6

Quote:
Originally Posted by Hawk552 View Post
This should seriously be merged into core. It would be very very useful. I believe it should also retain its name.
Unfortunately I'm sure bail will say it's too hacky. I'd maintain it, but I'd understand him not wanting it :x

Also fixed the name of the windows binary so it loads w/o needed renamed, my bad D:

edit: he said "we'll see" but i have to make a few changes :(

Last edited by sawce the snail; 02-24-2007 at 22:40.
sawce is offline
commonbullet
Veteran Member
Join Date: Oct 2005
Old 02-24-2007 , 23:20   Re: Module: Ham Sandwich
#7

this can't be replaced
Code:
#include <hamsandwich>

Last edited by commonbullet; 02-24-2007 at 23:43.
commonbullet is offline
Send a message via ICQ to commonbullet Send a message via MSN to commonbullet
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 02-27-2007 , 01:06   Re: Module: Ham Sandwich
#8

I've gotten the OK for submitting this in the base package (for 1.77), but there's a minor change of the module loading data from a config file, and the natives will be checking bounds then to try to make it a bit more safe (but obviously blatant misuse will be unable to be stopped).

I'm going to add these natives while I'm at it, since they deal with the same sort of thing this module does (even though they may not seem like it):

get_pdata_cbase(id,offset,linuxdiff=5);
set_pdata_cbase(id,offset,newid,linuxdiff=5);

(if I got the syntax wrong they're similar to the Fakemeta equivalents)

What it does is, if an offset in the private data is pointing to another entity's private data, it will return the index of what it's pointing to or set the new data to point to the new entity's private data.

I'm also working on hooking takedamage/use, but it's very, very difficult. No promises if it makes it in.

It's also been suggested I change the name unless I heavily document everything. I hate documenting. :|

Last edited by sawce the snail; 02-27-2007 at 01:10.
sawce is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 03-01-2007 , 05:53   Re: Module: Ham Sandwich
#9

Very usefull module.

I realy hope hooking it works
__________________
Um, hi.
Ramono is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 03-02-2007 , 14:12   Re: Module: Ham Sandwich
#10

I have what I believe to be a stable working version of the hooks (although they're not entirely feature complete just yet).

Would anybody be willing to try to break it for me? With normal usage, not blatant mis-use, that is.

Source is available here

Here's the binaries.

The hamdata.ini needs to go into your amxmodx/configs directory. If the module is unable to get the offsets for your mod from the data file, it will not register the natives.

Here's the example I used to test on CS: here. It makes players who damage hostages hurt themselves instead (blood still shows around hostages, need to add another hook for that). And spams a message whenever you use a hostage.

Tested on (I threw grenades at myself with a player takedamage hook):

CS 1.6, linux and windows
NS 3.2 linux
TS 2.1 linux
TFC ?? linux
DoD 1.2 linux

edit: fixed an access violation on winders
Attached Files
File Type: zip hamsandwich.zip (69.5 KB, 1833 views)

Last edited by sawce the snail; 03-02-2007 at 23:45.
sawce is offline
Closed Thread



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 05:04.


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