AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   the first death (https://forums.alliedmods.net/showthread.php?t=249828)

Stop95 10-13-2014 03:40

the first death
 
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;
}


Decak 10-13-2014 12:58

Re: the first death
 
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;
}


HamletEagle 10-13-2014 13:13

Re: the first death
 
Set it on spawn and disable it the death event.

Natsheh 10-13-2014 16:43

Re: the first death
 
No need for variable cash[33]
unless if you are not dealing with money!


All times are GMT -4. The time now is 17:41.

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