AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Hamsandwich Updating (https://forums.alliedmods.net/showthread.php?t=159814)

joaquimandrade 06-21-2011 12:56

Hamsandwich Updating
 
This update is now integrated to the next 1.8.3 version.

LASTEST VERSION CAN BE DOWNLOADED FROM THERE : https://forums.alliedmods.net/showpo...9&postcount=34


Hello dear individuals. To begin, me and Arkshine are fixing the functions in hamsandwich that return a Vector (so they can be executed since the could for hooks is ok). It is fixed in Windows and I'm guessing that in linux it won't need to be fixed because it is done other way. So, we would like to ask if someone can test in Linux to execute with ExecuteHam:

at least one of these functions:

Code:

Ham_Center
Ham_EyePosition
Ham_EarPosition
Ham_Player_GetGunPosition

and this one:
Code:

Ham_BodyTarget
Thank you!

fysiks 06-21-2011 15:09

Re: Setting a client's maxspeed permanently and efficiently
 
Tested and work fine.

joaquimandrade 06-21-2011 15:20

Re: Setting a client's maxspeed permanently and efficiently
 
Quote:

Originally Posted by fysiks (Post 1493030)
Tested and work fine.

Thank you!

The "project" will be at this address:

https://github.com/joaquimandrade/Hamsandwich-Update/

If someone is experienced with this of github that is a new world for me (that's why the author is the misterious unknown (as fysiks kindly pointed to me in steam)), I kindly accept suggestions.

For now you can check the current advances at

https://github.com/joaquimandrade/Ha...pdate/commits/

joaquimandrade 06-21-2011 21:54

Re: Setting a client's maxspeed permanently and efficiently
 
1 Attachment(s)
Added so far (after the name there is the return type and arguments, please tell me if you don't understand. This is needed because documentation isn't ready yet):

Added to CS and DOD

Code:

    Ham_ChangeYaw, float (id,int)
    Ham_HasHumanGibs, int (id)
    Ham_Has_AlienGibs, int (id)
    Ham_FadeMonster, void (id)
    Ham_GibMonster, void (id)
    Ham_BecomeDead, void (id)
    Ham_IRelationship, int (id,entity)
    Ham_PainSound,  void (id)
    Ham_ReportAIState, void (id)
    Ham_MonsterInitDead, void (id)
    Ham_Look, void (id)
    Ham_BestVisibleEnemy, entity (id)

To CS:

Code:

Ham_CS_ResetMaxSpeed void(id) (the one already being used with the trick reported on this thread)
To DOD:
Code:

    Ham_DOD_Item_SpawnDeploy int (id)
    Ham_DOD_Item_SetDmgTime void (id,float)
    Ham_DOD_Item_DropGren void (id)
    Ham_DOD_Weapon_IsUseable int (id)
    Ham_DOD_Weapon_Aim, void (id,float,ent,int)
    Ham_DOD_Weapon_flAim, void (id,int,float)
    Ham_DOD_Weapon_ChangeFOV, void (id,int)
    Ham_DOD_Weapon_ZoomOut, void (id)
    Ham_DOD_Weapon_ZoomIn, void (id)
    Ham_DOD_Weapon_GetFOV, int (id)
    Ham_DOD_Weapon_IsWaterSniping, int (id)
    Ham_DOD_Weapon_UpdateZoomSpeed, void (id)

Also fixed the calling of those functions that return a vector, namely:

Code:

Ham_Center
Ham_EyePosition
Ham_EarPosition
Ham_Player_GetGunPosition
Ham_BodyTarget

Please help testing it

joaquimandrade 06-21-2011 22:51

Re: Setting a client's maxspeed permanently and efficiently
 
Here goes a stupid example. When you scream in pain it also shows gibs. Also it shows how you can write more concise and efficient code when more functions are exposed:

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <fakemeta_stocks>
#include <hamsandwich>
#include <xs>

#define PLUGIN    "New Plugin"
#define AUTHOR    "Unknown"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_PainSound,"player","painSound",0)
}

public 
painSound(id)
{
    new 
Float:eyes[3]
    
    
ExecuteHam(Ham_EyePosition,id,eyes)
    
    
// Equivalent to:
    
new Float:origin[3], Float:view_ofs[3]
    
pev(id,pev_origin,origin)
    
pev(id,pev_view_ofs,view_ofs)
    
xs_vec_add(origin,view_ofs,origin)
    
//
    
    
ExecuteHam(Ham_GibMonster,id)
    
    
client_print(0,print_chat,"These vectors should be equal [%f][%f][%f] - [%f][%f][%f]",origin[0],origin[1],origin[2],eyes[0],eyes[1],eyes[2])



joaquimandrade 06-21-2011 23:04

Re: Setting a client's maxspeed permanently and efficiently
 
Edit: (This post was made before this thread was here in "Module Coding")

As my good friend fysiks wisely pointed me, this thread is no place for this. I therefore request, if you don't mind, if you can split the posts related to the hamsandwich update to a new thread in Module Coding with a name related to "Hamsandwich Updating" or something like that. Thanks in advance.

ConnorMcLeod 06-22-2011 01:52

Re: Hamsandwich Updating
 
Thanks.

fysiks 06-22-2011 02:10

Re: Hamsandwich Updating
 
You forgot to close your comment on line 964 of ham_const.inc FYI.

EDIT:

So, I was working with Ham_DOD_Weapon_ZoomIn and Ham_DOD_Weapon_ZoomOut and the latter really screws things up just by hooking it:

PHP Code:

    RegisterHam(Ham_DOD_Weapon_ZoomOut"weapon_spring""hookSpringZoomOut")

public 
hookSpringZoomOut(wepent)
{



This will affect gameplay, it's hard to explain but it certainly makes playing with the springfield screwy.

joaquimandrade 06-22-2011 10:04

Re: Hamsandwich Updating
 
2 Attachment(s)
fysiks, the comment thing is because there are nested comments that are there so one does not forget to update the documentation. It's ok.

Now, to the bug. My guess is that that is failing because I assumed that the function doesn't return a value and it indeed returns. Im gonna attach two versions of the library. One that returns an integer and other that returns a float (by ref). When you use them remove the prefix. Unfortunately I'm not being able to test myself because my windows client isn't able to access my linux server I have to figure out why.

Also issue the following command on the console:

Code:

ham hooks
Just to confirm that it throws:

Code:

Key                      | Classname                  |        Pre |      Post
--------------------------------------------------------------------------------
dod_weapon_zoomout      | weapon_spring              |          1 |          0


joaquimandrade 06-22-2011 11:37

Re: Hamsandwich Updating
 
Dear fysiks, had the chance to test it out and is indeed the return type. It must be set to int so the int_ file I've sent you should work (please test it because I tested on Windows alone but it should be fine). It seems that if you return values higher than 0 it applies an effect on the player (like an effect because you zoomed out). Thanks for detecting that.


All times are GMT -4. The time now is 11:39.

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