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

how to execute a function if player is in air?


Post New Thread Reply   
 
Thread Tools Display Modes
thEsp
BANNED
Join Date: Aug 2017
Old 06-01-2020 , 14:39   Re: how to execute a function if player is in air?
Reply With Quote #21

Quote:
Originally Posted by supertrio17 View Post
PHP Code:
#include <amxmodx>
#include <engine>
#include <ColorChat>

new Air

public plugin_init()
{
    
register_plugin("Player in Air""3.7""Mr. Boopsy");
}

public 
client_PreThink(id)
{
    if(!(
get_entity_flags(id) & (FL_ONGROUND FL_PARTIALGROUND FL_INWATER FL_CONVEYOR FL_FLOAT FL_FLY)))
    {
        if(
Air == 1)
        {
            
ColorChat(idGREEN"You are in air");
            
Air 0;
        }
    }
    else
    {
        
Air 1;
    }

This is as far as I got, only issue in this code is that it detects ladders as air. I think that it could be excluded with "pev(id, pev_movetype)", but I can't do this right now.

I just now figured that client_authorized was not needed at all, sorry for that stupid mistake.

Hope I helped
One can assure that does not work.
thEsp is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-01-2020 , 17:53   Re: how to execute a function if player is in air?
Reply With Quote #22

Quote:
Originally Posted by thEsp View Post
One can assure that does not work.
It works for me, and man who posted said it works for him in pm
supertrio17 is offline
thEsp
BANNED
Join Date: Aug 2017
Old 06-01-2020 , 19:05   Re: how to execute a function if player is in air?
Reply With Quote #23

For you? Oh yeah it does. For other players? Oh heck no.
thEsp is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-01-2020 , 21:10   Re: how to execute a function if player is in air?
Reply With Quote #24

Can you explain it a bit, why is that, or why doesn't it work for other players. I'm new at coding, but it works for him,
supertrio17 is offline
thEsp
BANNED
Join Date: Aug 2017
Old 06-02-2020 , 04:30   Re: how to execute a function if player is in air?
Reply With Quote #25

Quote:
Originally Posted by supertrio17 View Post
Can you explain it a bit, why is that, or why doesn't it work for other players. I'm new at coding, but it works for him,
In coding world "it works for me" isn't a good excuse. Remember that Pawn is handled server-side not client-side. It will not take care of your code itself, instead you have to make the way out yourself.

Anyway, make a 33 slots boolean array and respectively store "Air" value in it (per player).

Last edited by thEsp; 06-02-2020 at 04:31.
thEsp is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-02-2020 , 08:59   Re: how to execute a function if player is in air?
Reply With Quote #26

Quote:
Originally Posted by thEsp View Post
In coding world "it works for me" isn't a good excuse. Remember that Pawn is handled server-side not client-side. It will not take care of your code itself, instead you have to make the way out yourself.

Anyway, make a 33 slots boolean array and respectively store "Air" value in it (per player).
Well, I figured that how (id) on client_putinserver works is that it graps "id" from player on server join and replaces it in functions. Is it just my mistake, I tried with more players and it worked.

How I see it is that I don't need 33 slot array, because he doesnt want that command to happen for everyone when player jumps?

Please tell me if I'm wrong.
supertrio17 is offline
thEsp
BANNED
Join Date: Aug 2017
Old 06-02-2020 , 10:12   Re: how to execute a function if player is in air?
Reply With Quote #27

I already told that you are wrong and why. Try having multiple players jump at different intervals and see what happens.
thEsp is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-02-2020 , 10:47   Re: how to execute a function if player is in air?
Reply With Quote #28

I can't say much without know what you're trying to do, but I guess you can do it by hooking Ham_Player_Jump.
__________________








CrazY. is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-02-2020 , 10:48   Re: how to execute a function if player is in air?
Reply With Quote #29

Quote:
Originally Posted by CrazY. View Post
I can't say much without know what you're trying to do, but I guess you can do it by hooking Ham_Player_Jump.
He is trying to execute command every time player is in air.
supertrio17 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-02-2020 , 10:51   Re: how to execute a function if player is in air?
Reply With Quote #30

In this case, client_PreThink or set_task.
__________________








CrazY. 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