Raised This Month: $19 Target: $400
 4% 

Solved Hook player land on ground!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-26-2021 , 05:46   Hook player land on ground!
Reply With Quote #1

Does anyone knows how to hook when a player lands on the ground or touch the ground?
__________________
@Jailbreak Main Mod v2.6.5 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Last edited by Natsheh; 02-26-2021 at 06:47.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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
__________________
@Jailbreak Main Mod v2.6.5 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Last edited by Natsheh; 02-26-2021 at 07:42.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 21:21.


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