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

Orpheu: Engine PM Functions


Post New Thread Reply   
 
Thread Tools Display Modes
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 05-11-2010 , 15:57   Re: Orpheu: Engine PM Functions
Reply With Quote #21

It would be nice to pass arguments as memory addresses at own risk

Direct memory access too
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Lt.RAT
Member
Join Date: Sep 2008
Location: Russia Yekaterinburg
Old 05-11-2010 , 16:20   Re: Orpheu: Engine PM Functions
Reply With Quote #22

Quote:
Originally Posted by joropito View Post
It would be nice to pass arguments as memory addresses at own risk
And not only arguments. For structs better to have fakemeta style (like in pev)
while getting struct member we provide string
Code:
maxspeed = Float:OrpheuGetParamStructMember( 1, "clientmaxspeed");
better to provide some predefined value (faster to lookup struct offset for it)
Code:
maxspeed = Float:OrpheuGetParamStructMember( 1, pmove_clientmaxspeed);
it speed-up module a bit, and i don`t see any problems coz all structs hardcoded atm.

I think that fakemeta should be faster than Orpheu in:
Code:
   set_uc(_:cmd, UC_ForwardMove, 0);
   OrpheuSetStructMember(cmd, "forwardmove", 0);
In some other cases, for example:
Code:
		maxspeed = Float:OrpheuGetParamStructMember( 1, "clientmaxspeed");
		if (maxspeed != 1.0)
		{
			fMaxSpeed[id] = maxspeed;
			OrpheuSetParamStructMember( 1, "clientmaxspeed", 1.0);
		}
better to load "maxspeed" as memory addresses, and then using it we can access several times with good speed (with compare to other methods). But it`s additional work, that could be used only in 2% of moments
Lt.RAT is offline
Send a message via ICQ to Lt.RAT
lazarev
Veteran Member
Join Date: Sep 2008
Old 05-16-2010 , 02:19   Re: Orpheu: Engine PM Functions
Reply With Quote #23

Can you call PM_Jump function? I tried, but it didn't work for me. :/
lazarev is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 05-16-2010 , 10:05   Re: Orpheu: Engine PM Functions
Reply With Quote #24

Quote:
Originally Posted by lazarev View Post
Can you call PM_Jump function? I tried, but it didn't work for me. :/
I guess you can call it but you can't set some environments needed (like p_move structure).
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Lt.RAT
Member
Join Date: Sep 2008
Location: Russia Yekaterinburg
Old 05-16-2010 , 14:50   Re: Orpheu: Engine PM Functions
Reply With Quote #25

Quote:
Originally Posted by joropito View Post
I guess you can call it but you can't set some environments needed (like p_move structure).
yes, All PM_ functions related to engine should be called while we in "PM_Move" and all player specific structure was set.
As i understand pmove - structure - for all players, but before "pm_move" some player parameters copied to it, and after "pm_move" copied it back.

I want to warn of using pev_ things while "PM_Move", because that information copy, all pev_ like "broken" atm.
Lt.RAT is offline
Send a message via ICQ to Lt.RAT
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 05-20-2010 , 08:40   Re: Orpheu: Engine PM Functions
Reply With Quote #26

Quote:
Originally Posted by joaquimandrade View Post
PM_Move receives ppmove as argument and it's a DLL function so it's safer to use it as such.

PHP Code:
#include < amxmodx >
#include < orpheu >
#include < orpheu_stocks >

public plugin_init( )
{
    
OrpheuRegisterHookOrpheuGetDLLFunction"pfnPM_Move","PM_Move" ), "PM_Move" );
}

public 
OrpheuHookReturn:PM_Move(OrpheuStruct:ppmove,server)
{    
    new 
iPlayer OrpheuGetStructMemberppmove"player_index" ) + 1;
    
    if( 
is_user_aliveiPlayer ) )
    {
        new 
OrpheuStruct:cmd OrpheuStruct:OrpheuGetStructMemberppmove"cmd" );
        
        
// change 0.0 to your value
        
OrpheuSetStructMembercmd"sidemove"0.0 );
    }
    
    return 
OrpheuIgnored;

Put this in a file called PM_Move in configs/orpheu/functions

HTML Code:
{
    "name" : "PM_Move",
    "library" : "mod",
    "arguments" :
    [
        {
            "type" : "playermove_s *"
        },
        {
            "type" : "qboolean"
        }
    ]
}
By the way. Getting ppmove like that (for other functions) is not that safe (i have to change that in the tutorial). The best thing probably is hooking always PM_Move like this + storing ppmove in a global var.

Edit: by safe I mean "update proof" but in this case, doing like I said in my last sentence, is also mod independent so I recommend it.
I'll leave this here.
Seta00 is offline
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 07-02-2010 , 17:51   Re: Orpheu: Engine PM Functions
Reply With Quote #27

@joaquim: About the "blocking duck" code there is one thing I don't understand: you say it's for non bot players, but in the code you added an is_user_bot( ) check.
__________________
"There is no knowledge, that is not power"
fezh is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-02-2010 , 18:45   Re: Orpheu: Engine PM Functions
Reply With Quote #28

Quote:
Originally Posted by fezh View Post
@joaquim: About the "blocking duck" code there is one thing I don't understand: you say it's for non bot players, but in the code you added an is_user_bot( ) check.
So? Everything's ok, he blocks duck for players, and allows it for bots
__________________
xPaw is offline
Old 08-28-2010, 05:19
lazarev
This message has been deleted by lazarev. Reason: nvm
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 03-29-2014 , 05:37   Re: Orpheu: Engine PM Functions
Reply With Quote #29

Can someone tell me , why this is not work ? :

PHP Code:
#include <amxmodx>
#include <fun>
#include <orpheu>
#include <orpheu_advanced>
#include <orpheu_memory>
    
public plugin_init()
{
    
register_plugin("Water KILL","1.0.0","swapped");        
    
OrpheuRegisterHook(OrpheuGetFunction("PM_CheckWater"),"OnPM_CheckWater")
}

public 
OrpheuHookReturn:OnPM_CheckWater()
{
    new 
OrpheuStruct:ppmove get_ppmove()
    
    new 
id OrpheuGetStructMember(ppmove,"player_index") + 1
    
    
if(is_user_alive(id))
    {
        
user_kill(id);
    }
    
}

OrpheuStruct:get_ppmove()
{        
    return 
OrpheuGetStructFromAddress(OrpheuStructPlayerMove,OrpheuMemoryGet("ppmove"))

swapped is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 04-27-2014 , 09:12   Re: Orpheu: Engine PM Functions
Reply With Quote #30

https://forums.alliedmods.net/showpo...6&postcount=13
Can anyone check if these are still working? Although I don't think they are. Tried hooking PM_Move(it works when hooking pfnPM_Move from DLL_FUNCTIONS) and PM_Duck, but none of them are working. They are probably outdated cause there were few CS updates throughout last 4 years. If they are not working, updated signatures would be really great!

Last edited by klippy; 04-27-2014 at 09:14.
klippy is offline
Reply


Thread Tools
Display Modes

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:40.


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