Raised This Month: $ Target: $400
 0% 

[Orpheu] Disabling some movements


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 04-23-2011 , 05:23   [Orpheu] Disabling some movements
Reply With Quote #1

How can I simple block some movements like jump and duck efficiently with orpheu?
bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-23-2011 , 09:05   Re: [Orpheu] Disabling some movements
Reply With Quote #2

Have to tried to simply supercede PM_Jump and PM_Duck ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-23-2011 , 09:50   Re: [Orpheu] Disabling some movements
Reply With Quote #3

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?
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-23-2011 , 10:11   Re: [Orpheu] Disabling some movements
Reply With Quote #4

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.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-23-2011 , 11:50   Re: [Orpheu] Disabling some movements
Reply With Quote #5

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.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-23-2011 , 16:38   Re: [Orpheu] Disabling some movements
Reply With Quote #6

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.
bibu is offline
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 04-24-2011 , 04:15   Re: [Orpheu] Disabling some movements
Reply With Quote #7

Quote:
Originally Posted by bibu View Post
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.
__________________

Working on:
nothing
schmurgel1983 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-24-2011 , 04:20   Re: [Orpheu] Disabling some movements
Reply With Quote #8

Quote:
Originally Posted by bibu View Post
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...
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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:09.


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