Raised This Month: $ Target: $400
 0% 

the first death


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stop95
New Member
Join Date: Dec 2012
Old 10-13-2014 , 03:40   the first death
Reply With Quote #1

How to create a gravitation will remain until the first death?



Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "shop tut"
#define VERSION "1.0"
#define AUTHOR "Blizzard"

new cash[33];

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_clcmd("say /shop", "cmdShop", 0);
    
}


public cmdShop(id)
{

    new menu = menu_create("\rShop Menu:", "cmdShop_handler");
    
    menu_additem(menu, "\wGravity", "1", 0);
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

    menu_display(id, menu, 0);

}

public cmdShop_handler(id, menu, item)
{

    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }


    new data[6], szName[64];
    new access, callback;

    menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);

    cash[id] = cs_get_user_money(id);
    
    new key = str_to_num(data);

    switch(key)
    {    
        case 1:
        {
            if(cash[id] > 100)
            {
                client_print(id, print_chat, "You Have Bought Gravity");
                cs_set_user_money(id, cash[id] - 100);
                set_user_gravity(id, 0.25);
            }
            else {
                client_print(id, print_chat, "You Dont Have Enough Money");
            }            
        }
    }


    menu_destroy(menu);
    return PLUGIN_HANDLED;
}
Stop95 is offline
Decak
Senior Member
Join Date: Sep 2012
Old 10-13-2014 , 12:58   Re: the first death
Reply With Quote #2

Try this:

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

new bool:HaveGravity[33];

#define PLUGIN "shop tut"
#define VERSION "1.0"
#define AUTHOR "Blizzard"

new cash[33];

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /shop", "cmdShop", 0);
    register_event("DeathMsg", "smrtic", "a")
    register_event("CurWeapon", "kurvepn", "be","1=1")
}

public kurvepn(id) {
    if(HaveGravity[id]) {
    set_user_gravity(id, 0.25)
    return PLUGIN_HANDLED;
}
    else {
    set_user_gravity(id, 1.0)
}
    return PLUGIN_CONTINUE;
}

public client_connect(id) {
    HaveGravity[id] = false;
}

public smrtic(id) {
    HaveGravity[id] = false;
}

public cmdShop(id)
{

    new menu = menu_create("\rShop Menu:", "cmdShop_handler");
    
    menu_additem(menu, "\wGravity", "1", 0);
    
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

    menu_display(id, menu, 0);

}

public cmdShop_handler(id, menu, item)
{

    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }


    new data[6], szName[64];
    new access, callback;

    menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);

    cash[id] = cs_get_user_money(id);
    
    new key = str_to_num(data);

    switch(key)
    {    
        case 1:
        {
            if(cash[id] > 100)
            {
                client_print(id, print_chat, "You Have Bought Gravity");
                cs_set_user_money(id, cash[id] - 100);
        HaveGravity[id] = true;
            }
            else {
                client_print(id, print_chat, "You Dont Have Enough Money");
            }            
        }
    }


    menu_destroy(menu);
    return PLUGIN_HANDLED;
}
Decak is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-13-2014 , 13:13   Re: the first death
Reply With Quote #3

Set it on spawn and disable it the death event.
__________________
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-13-2014 , 16:43   Re: the first death
Reply With Quote #4

No need for variable cash[33]
unless if you are not dealing with money!

Last edited by Natsheh; 10-14-2014 at 09:20.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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:41.


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