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

Help / Support Human Leap: assigning leap from +DUCK and +JUMP to tripple +forward


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jigore
Junior Member
Join Date: Jul 2018
Old 07-27-2018 , 12:39   Human Leap: assigning leap from +DUCK and +JUMP to tripple +forward
Reply With Quote #1

So I got the idea of leap for humans, but they will not have it like zombies by pressing duck and jumping, but pressing +forward 3 times.
I need some help with this, cuz im bad at scripting.
pls ^^
Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

#define PLUGIN "[ZP] WWWLeap"
#define VERSION "0.1"
#define AUTHOR "gore"

/*based on zp_leap*/

#define TASK_ID 1337

new www_leap
new www_time
new bool:g_hasLeap[33]
new Float:g_lastLeaptime[33]
new g_Leap_force
new g_Leap_height
new g_Leap_cooldown

public plugin_init() 
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   g_Leap_force = register_cvar("www_force", "550")
   g_Leap_height = register_cvar("www_height", "255")
   g_Leap_cooldown = register_cvar("www_cooldown", "5.0")
   www_leap = register_cvar("www_leap","1")
   www_time = register_cvar("www_leap_time","15.0")
   
   register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
   
   register_event("DeathMsg", "death", "a")
   register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
}

public client_disconnect(id)
{
    g_hasLeap[id] = false;
    if ( task_exists(TASK_ID+id) )
        remove_task(TASK_ID+id)
}

public death()
{
   g_hasLeap[read_data(2)] = false
}

public zp_user_humanized_pre(id)
{
   if (is_user_alive(id) && zp_get_user_zombie(id))
   {
   if (get_pcvar_num(www_leap))
   {
      set_task(1.00, "CountDown", id + 1337, "", 0, "", 0);
      new Float:leap_float = get_pcvar_float(www_time);
      set_task(leap_float, "leap_begin", id, "", 0, "", 0);
      }
   }
   return PLUGIN_HANDLED
}    

public event_round_start()
{
   for (new i = 1; i <= 32; i++)
      g_hasLeap[i] = true
}

public zp_user_infected_post(id, infector)
{
      g_hasLeap[id] = false
}

public leap_begin(id)
{
   if (!is_user_alive(id))
      return PLUGIN_HANDLED
   
   if (zp_get_user_zombie(id))
   {
      g_hasLeap[id] = true
      remove_task(TASK_ID+id)
   }
   return PLUGIN_HANDLED
}

public fw_PlayerPreThink(id)
{
   if (!is_user_alive(id))
      return FMRES_IGNORED
   
   if (leap_longjump(id))
   {
      static Float:velocity[3]
      velocity_by_aim(id, get_pcvar_num(g_Leap_force), velocity)
      
      velocity[2] = get_pcvar_float(g_Leap_height)
      
      set_pev(id, pev_velocity, velocity)
      
      g_lastLeaptime[id] = get_gametime()
   }
   
   return FMRES_IGNORED
}

leap_longjump(id)
{
   if (!g_hasLeap[id])
      return false
   
   if (!(pev(id, pev_flags) & FL_ONGROUND) || fm_get_speed(id) < 80)
      return false
   
   static buttons
   buttons = pev(id, pev_button)
   
   if (!is_user_bot(id) && (!(buttons & IN_JUMP) || !(buttons & IN_DUCK)))
      return false
   
   if (get_gametime() - g_lastLeaptime[id] < get_pcvar_float(g_Leap_cooldown))
      return false
   
   return true
}

stock fm_get_speed(entity)
{
   static Float:velocity[3]
   pev(entity, pev_velocity, velocity)
   
   return floatround(vector_length(velocity))
}
__________________
pawn plugin maker.
actually new
jigore 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 06:05.


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