AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Orpheu] Disabling some movements (https://forums.alliedmods.net/showthread.php?t=155509)

bibu 04-23-2011 05:23

[Orpheu] Disabling some movements
 
How can I simple block some movements like jump and duck efficiently with orpheu?

ConnorMcLeod 04-23-2011 09:05

Re: [Orpheu] Disabling some movements
 
Have to tried to simply supercede PM_Jump and PM_Duck ?

bibu 04-23-2011 09:50

Re: [Orpheu] Disabling some movements
 
I really don't know how to start, so I did something like this:

PHP Code:

    OrpheuRegisterHook(OrpheuGetFunctionFromClass("player""Jump""CBasePlayer"), "orpheu_player_jump")
    
OrpheuRegisterHook(OrpheuGetFunctionFromClass("player""Duck""CBasePlayer"), "orpheu_player_duck"

Both get well called:

PHP Code:

public orpheu_player_jump(id)
{
    if(
is_user_alive(id))
    {
        return 
OrpheuSupercede
    
}
    return 
OrpheuIgnored


But here, I get a mismatch error. Is this code fine at all?:oops:

Arkshine 04-23-2011 10:11

Re: [Orpheu] Disabling some movements
 
Far to be fine. You do things without thinking.

You need to hook PM_Jump, PM_Duck. You need a signature file. There is pack somewhere in a tutorial containing all the PM_. Also, you can find severals plugins in scripting or request section where such functions were used.

ConnorMcLeod 04-23-2011 11:50

Re: [Orpheu] Disabling some movements
 
Take care that player id won't be called in PM_ callbacks.
If you need player id you have to store pmove when PM_Move is passed and than when any function is executed you can retrieve strcture member player_index and add 1 because player indexes are stored based on 0.

bibu 04-23-2011 16:38

Re: [Orpheu] Disabling some movements
 
Ok, with the same way it works for duck, but not for jump:

PHP Code:

new const PM_EF_List[][] =
{
    
"PM_Jump"
}

//in init:

    
for(new 1sizeof(PM_EF_List); i++)
    {
        
OrpheuRegisterHook(OrpheuGetFunction(PM_EF_List[i]), PM_EF_List[i])
    }

//function:

public OrpheuHookReturn:PM_Jump()
{
    if(
IsUserAlive(id) && IsUserCt(id))
    {
        return 
OrpheuSupercede
    
}    
    return 
OrpheuIgnored


The check is 100% valid since the same with duck works + with connors player_index method. No idea why jump doesn't work.

schmurgel1983 04-24-2011 04:15

Re: [Orpheu] Disabling some movements
 
Quote:

Originally Posted by bibu (Post 1456267)
Ok, with the same way it works for duck, but not for jump:

PHP Code:

new const PM_EF_List[][] = // have a size of 1
{
    
"PM_Jump" // = 0
}

//in init:

    
for(new 1sizeof(PM_EF_List); i++) // not executed 
    
{
        
// if 1 < 1 then hook ? not possible ( new i = 0 )
        
OrpheuRegisterHook(OrpheuGetFunction(PM_EF_List[i]), PM_EF_List[i])
    }

//function:

public OrpheuHookReturn:PM_Jump()
{
    if(
IsUserAlive(id) && IsUserCt(id))
    {
        return 
OrpheuSupercede
    
}    
    return 
OrpheuIgnored


The check is 100% valid since the same with duck works + with connors player_index method. No idea why jump doesn't work.


ConnorMcLeod 04-24-2011 04:20

Re: [Orpheu] Disabling some movements
 
Quote:

Originally Posted by bibu (Post 1456267)
The check is 100% valid since the same with duck works + with connors player_index method. No idea why jump doesn't work.

Method was given by someone else, may be joaquim.
Anyway, please show more code, where you retrieve player index, when you assign alive and ct values, etc...


All times are GMT -4. The time now is 20:09.

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