Raised This Month: $ Target: $400
 0% 

Multi jump menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CHE4TER
Member
Join Date: Jul 2013
Location: Portugal
Old 01-18-2014 , 09:10   Multi jump menu
Reply With Quote #1

This plugin enables multi jump when you connect to the server..
What I need, is just make that function to the menu..
Like, you open the menu, you press 1, the jumps activates, you press again 1, the jumps disactivates..


PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define LEVEL_A        ADMIN_LEVEL_A

new jumpnum[33] = 0
new bool:dojump[33] = false

new isEnabled[64]
new 
status[64]

public 
plugin_init()
{
    
register_cvar("amx_maxjumps","1")
    
    
register_clcmd("say /jump""sayJump")
}

public 
client_putinserver(id)
{
    
jumpnum[id] = 0
    dojump
[id] = false
}

public 
client_disconnect(id)
{

    
jumpnum[id] = 0
    dojump
[id] = false
}

public 
sayJump(id) {
    
    
//isEnabled[32]
    
    
new menu menu_create("\rMenu""menu_handler")
    
formatex(status63"\wMulti Jump: %s^n"isEnabled[id] ? "\yON" "\dOFF")
    
menu_additem(menustatus"1")
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
}

public 
menu_handler(idmenuitem) {

    switch(
item) {
        
        case 
0: {
            
// HOW?
        
}
    }
}

public 
client_PreThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE
    
new nbut get_user_button(id)
    new 
obut get_user_oldbutton(id)
    if((
nbut IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut IN_JUMP))
    {
        if(
jumpnum[id] < get_cvar_num("amx_maxjumps"))
        {
            
dojump[id] = true
            jumpnum
[id]++
            return 
PLUGIN_CONTINUE
        
}
    }
    if((
nbut IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
    {
        
jumpnum[id] = 0
        
return PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE
}

public 
client_PostThink(id)
{
    if(!
is_user_alive(id)) return PLUGIN_CONTINUE
    
if(dojump[id] == true)
    {
        new 
Float:velocity[3]    
        
entity_get_vector(id,EV_VEC_velocity,velocity)
        
velocity[2] = random_float(265.0,285.0)
        
entity_set_vector(id,EV_VEC_velocity,velocity)
        
dojump[id] = false
        
return PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE

CHE4TER is offline
 


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 10:10.


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