Thread: [Solved] Hook player land on ground!
View Single Post
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-26-2021 , 06:46   Re: Hook player land on ground!
Reply With Quote #2

Here's the code, i hoped for more efficient way but oh well :S

PHP Code:

#include <amxmodx>
#include <orpheu>
#include <orpheu_advanced>
#include <orpheu_memory>
#include <orpheu_stocks>

#define set_flag(%1,%2)            %1 |= (1<<(%2&31))
#define remove_flag(%1,%2)        %1 &= ~(1<<(%2&31))
#define check_flag(%1,%2)        (%1 & (1<<(%2&31)))

new OrpheuStruct:g_ppmove;

public 
plugin_init()
{
    
OrpheuRegisterHookOrpheuGetDLLFunction"pfnPM_Move""PM_Move" ), "OnPM_Move" );
    
OrpheuRegisterHookOrpheuGetFunction("PM_PlayerMove"), "OnPM_PlayerMove");
}

public 
OnPM_MoveOrpheuStruct:ppmoveserver )
{
    
g_ppmove ppmove;
}

public 
OnPM_PlayerMove()
{
    static 
idonground 0;
    
    
id OrpheuGetStructMember(g_ppmove,"player_index") + 1;
    
    
// player on ground.
    
if(OrpheuGetStructMember(g_ppmove,"onground") != -1)
    {
        if(!
check_flag(onground,id))
        {
            
set_flag(onground,id);
            
client_print(idprint_center"you're on ground!");
            
player_on_ground(id);
        }
    }
    else if(
check_flag(onground,id))
    {
        
client_print(idprint_center"you're not on ground!");
        
remove_flag(onground,id);
    }
}

// player landed on the ground, do something.
public player_on_ground(id)
{
    
// blah blah
    
client_print(idprint_chat"You've landed on the ground!");

TESTED and works

here're the signatures for the following functions...

PM_Move


PM_PlayerMove


Edit: Works only for 1 player check out the signatures might need to be updated.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 05-17-2021 at 09:31.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh