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

number detect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tepegoz
Senior Member
Join Date: Apr 2019
Old 07-04-2020 , 05:46   number detect
Reply With Quote #1

I have a plugin. I want to make if(g_ePlayerInfo[id][m_Velocity] > 250){ but it doesn't working. g_ePlayerInfo[id][m_Velocity] number showing as 250 = 1136197631. How to set if(g_ePlayerInfo[id][m_Velocity] > 250){
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <fun>
#include <hamsandwich>


enum _:PLAYER_DATA
{
    
m_JumpPressCount,
    
m_Velocity
}
new 
g_ePlayerInfo[33][PLAYER_DATA]
public 
plugin_init() {
    
    
register_forward(FM_PlayerPreThink"FM_PlayerPreThink_Pre"false);    
}



public 
FM_PlayerPreThink_Pre(id)
{
    if(!
is_user_alive(id)) return FMRES_IGNORED;
    
    new 
buttons pev(idpev_button);
    new 
oldbuttons pev(idpev_oldbuttons);
    
    if(
buttons IN_JUMP && ~oldbuttons IN_JUMP)
    {
        
g_ePlayerInfo[id][m_JumpPressCount]++;
    }
    if(~
buttons IN_JUMP && oldbuttons IN_JUMP)
    {    
    }
    new 
on_ground bool:(pev(idpev_flags) & FL_ONGROUND);
    
    if(
on_ground)
    {
    if(
g_ePlayerInfo[id][m_JumpPressCount] > 0)
        {    
    new 
Float:velocity[3]; pev(idpev_velocityvelocity); velocity[2] = 0.0;
    
g_ePlayerInfo[id][m_Velocity] = _:vector_length(velocity);
        if(
g_ePlayerInfo[id][m_Velocity] > 250){
    
console_print(id"velocity [%.3f]"g_ePlayerInfo[id][m_Velocity]);

    }
}
}
g_ePlayerInfo[id][m_JumpPressCount] = 0;
return 
FMRES_IGNORED;

tepegoz is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-04-2020 , 08:44   Re: number detect
Reply With Quote #2

m_Velocity should be declared as a float.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 05:26.


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