Raised This Month: $ Target: $400
 0% 

[ZP] Extra Item MultiJump + MultiJumps at the Beginning


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bombey
Member
Join Date: Jul 2006
Old 04-18-2009 , 08:09   [ZP] Extra Item MultiJump + MultiJumps at the Beginning
Reply With Quote #1

Code:
/*================================================================================
    
    -------------------------------------------
    -*- [ZP] Extra Item: Multijump 1.0 -*-
    -------------------------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    This item/upgrade allows humans to jump multiple times, even being in mid air.
    Each upgrade adds one jump.
    
    By default there is no maximum of jumps in mid air.
    
    Credits to:
    twistedeuphoria
    Dabbi
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague.inc>

/*================================================================================
 [Plugin Customization]
=================================================================================*/

new const g_item_name[] = { "Multijump (+1)" };
const g_item_cost = 50;
new g_maxJumps = 0; // maximum amount of jumps in mid air. If set to 0 then it is infinitely

/*============================================================================*/

new jumpnum[33] = 0;
new bool:dojump[33] = false;
new g_itemid_multijump;
new g_multijumps[33] = 0;

public plugin_init()
{
    register_plugin("[ZP] Extra Item: Multijump", "1.0", "pharse");
    
    g_itemid_multijump = zp_register_extra_item(g_item_name, g_item_cost, ZP_TEAM_HUMAN);
    
    register_forward(FM_PlayerPreThink, "FW_PlayerPreThink");
    register_forward(FM_PlayerPostThink, "FW_PlayerPostThink");
    
    register_event("HLTV", "EVENT_round_start", "a", "1=0", "2=0");
    register_cvar("amx_start_multijumps","2");
}

public FW_PlayerPreThink(id)
{
    if(!is_user_alive(id) || zp_get_user_zombie(id) || !get_cvar_num("amx_start_multijumps")+g_multijumps[id]) return PLUGIN_CONTINUE
    new nbut = pev(id,pev_button);
    new obut = pev(id,pev_oldbuttons);
    if((nbut & IN_JUMP) && !(pev(id,pev_flags) & FL_ONGROUND) && !(obut & IN_JUMP))
    {
        if(jumpnum[id] < get_cvar_num("amx_start_multijumps")+g_multijumps[id])
        {
            dojump[id] = true;
            jumpnum[id]++;
            return PLUGIN_CONTINUE
        }
    }
    if((nbut & IN_JUMP) && (pev(id,pev_flags) & FL_ONGROUND))
    {
        jumpnum[id] = 0;
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}

public FW_PlayerPostThink(id)
{
    if(!is_user_alive(id) || zp_get_user_zombie(id) || !get_cvar_num("amx_start_multijumps")+g_multijumps[id]) return PLUGIN_CONTINUE
    if(dojump[id] == true)
    {
        new Float:velocity[3];
        pev(id,pev_velocity,velocity);
        velocity[2] = random_float(265.0,285.0);
        set_pev(id,pev_velocity,velocity)
        dojump[id] = false
        return PLUGIN_CONTINUE
    }
    return PLUGIN_CONTINUE
}    

// Player buys our upgrade, add one multijump
public zp_extra_item_selected(player, itemid)
{
    if (itemid == g_itemid_multijump){
        if (g_multijumps[player] < g_maxJumps || !g_maxJumps){
            g_multijumps[player]++;
            if (g_maxJumps)
                client_print(player, print_center, "Now you can jump %d / %d times in mid air.", g_multijumps[player], g_maxJumps);
            else
                client_print(player, print_center, "Now you can jump %d times in mid air.", g_multijumps[player]);
        }
        else
            client_print(player, print_center, "You can't jump more than %d times in mid air!", g_maxJumps);
    }
}

// Reset multijump for all players on newround
public EVENT_round_start()
{
    for (new id; id <= 32; id++) g_multijumps[id] = false;
}
I can't code but I tried to change (red marked) the code logically but when I wanna compile the code, it shows me the error "warning 213: tag mismatch"?

As I said before in the title, I want to set on every player 2 multijumps which can't be reduced, just increased by buying a multijump.

I hope you understand what Im looking for and you can help me.

In return I'll give you karma.
__________________
I'm the creator of:
-zm_lila_panic_cs
, zm_office


bombey is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-18-2009 , 08:12   Re: [ZP] Extra Item MultiJump + MultiJumps at the Beginning
Reply With Quote #2

It dont need to be ".inc" in
PHP Code:
#include [<zombieplague.inc> 
And please post in [php | /php]
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Anggara_nothing
Veteran Member
Join Date: Jan 2009
Location: Indonesia
Old 04-18-2009 , 08:18   Re: [ZP] Extra Item MultiJump + MultiJumps at the Beginning
Reply With Quote #3

i think the problem is
Quote:
!get_cvar_num("amx_start_multijumps")+g_multi jumps[id])
Anggara_nothing is offline
bombey
Member
Join Date: Jul 2006
Old 04-20-2009 , 10:14   Re: [ZP] Extra Item MultiJump + MultiJumps at the Beginning
Reply With Quote #4

Quote:
Originally Posted by Anggara_nothing View Post
i think the problem is
Yes that's right but does anyone know a solution?
__________________
I'm the creator of:
-zm_lila_panic_cs
, zm_office


bombey is offline
Anggara_nothing
Veteran Member
Join Date: Jan 2009
Location: Indonesia
Old 04-20-2009 , 10:19   Re: [ZP] Extra Item MultiJump + MultiJumps at the Beginning
Reply With Quote #5

Quote:
Originally Posted by bombey View Post
Yes that's right but does anyone know a solution?
hmm..........
Quote:
!get_cvar_num("amx_start_multijumps")+g_multijumps[id]
change to :
Quote:
!get_cvar_num("amx_start_multijumps") && g_multijumps[id]
Anggara_nothing is offline
bombey
Member
Join Date: Jul 2006
Old 04-20-2009 , 12:24   Re: [ZP] Extra Item MultiJump + MultiJumps at the Beginning
Reply With Quote #6

Thanks ! It works and I gave you +karma...

But another question what do I have to change so that they always come the message when you buy a multijump:

Now you can jump 2 + %d / %d times in mid air.
__________________
I'm the creator of:
-zm_lila_panic_cs
, zm_office


bombey is offline
Old 04-20-2009, 12:28
Anggara_nothing
This message has been deleted by Anggara_nothing. Reason: lol
Anggara_nothing
Veteran Member
Join Date: Jan 2009
Location: Indonesia
Old 04-20-2009 , 12:36   Re: [ZP] Extra Item MultiJump + MultiJumps at the Beginning
Reply With Quote #7

Quote:
Originally Posted by bombey View Post
Thanks ! It works and I gave you +karma...

But another question what do I have to change so that they always come the message when you buy a multijump:

Now you can jump 2 + %d / %d times in mid air.
what is mean "%d" ?
Anggara_nothing is offline
bombey
Member
Join Date: Jul 2006
Old 04-21-2009 , 15:59   Re: [ZP] Extra Item MultiJump + MultiJumps at the Beginning
Reply With Quote #8

Quote:
Originally Posted by Anggara_nothing View Post
what is mean "%d" ?
%d is the number of multijumps that you've bought.

so when you buy 1 multijump then there should be shown the message: Now you can jump 3 times in mid air.

3 times because at the beginning you have 2 multijumps that you can use and when you buy an additional mutlijump then you are able to jump 3 times
__________________
I'm the creator of:
-zm_lila_panic_cs
, zm_office



Last edited by bombey; 04-21-2009 at 16:02.
bombey 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 17:44.


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