Raised This Month: $ Target: $400
 0% 

shopmenu help :- /


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dixo1
Junior Member
Join Date: Jun 2008
Old 09-29-2009 , 10:39   shopmenu help :- /
Reply With Quote #1

This is the code i come up with so far:

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

#define PLUGIN "SuperLiga-Shopmenu"
#define VERSION "1.1"
#define AUTHOR "KoGeRbArNeT"

 public plugin_init()
 {
    register_plugin(PLUGIN, VERSION, AUTHOR)

    register_clcmd("say /shopmenu","shopmenu")
    register_clcmd("say shopmenu","shopmenu")
 }
 public shopmenu(id)
 {
    new menu = menu_create("\rShopmenu:", "menu_handler");

    menu_additem(menu, "\w+25 hp - 2000", "1", 0);
    menu_additem(menu, "\wSpeed up - 2000", "2", 0);
    menu_additem(menu, "\wGravity - 2000", "5", 0);
    menu_additem(menu, "\wRevive - 8500", "3", 0);
    menu_additem(menu, "\w16 xp - 16000", "4", 0);

    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

    menu_display(id, menu, 0);
 }
 public menu_handler(id, menu, item)
 {
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);


    new key = str_to_num(data);

    switch(key)
    {
        case 1:
        {
        new money = cs_get_user_money(id)
            if(money>=1999){
                    cs_set_user_money(id, money -2000);
                    
                    client_print(id, print_chat, "You bought hp!");
            
                    new hp = get_user_health(id);
                    set_user_health(id , hp +25); 
                        }
            menu_destroy(menu);
            return PLUGIN_HANDLED;
        }
        case 2:
        {
        new money = cs_get_user_money(id)
            if(money>=1999){
                    cs_set_user_money(id, money -2000);
                    
                    client_print(id, print_chat, "You bought speed!");
            
                    new Float:speed = get_user_maxspeed(id);
                    set_user_maxspeed(id , speed +100);
                           }
        }
        case 3:
        {
          new money = cs_get_user_money(id)
            if(money>=8499){
                    cs_set_user_money(id, money -8500);
                    
                    client_print(id, print_chat, "You bought retrive!");
                    
                    //Make the engine think he is spawning
                    set_pev(id,pev_deadflag,DEAD_RESPAWNABLE);
                    set_pev(id, pev_iuser1, 0);
                    dllfunc(DLLFunc_Think,id)

                    //Move his body so if corpse is created it is not in map
                    engfunc(EngFunc_SetOrigin,id,Float:{-4800.0,-4800.0,-4800.0})

                    //Actual Spawn
                    set_task(0.5,"respawn",id)
                           }
        }
        case 4:
        {
           new money = cs_get_user_money(id)
            if(money>=8499){
                    cs_set_user_money(id, money -8500);
                    client_print(id, print_chat, "You bought 16 xp!");
                           }
        }
        case 5:
        {
           new money = cs_get_user_money(id)
            if(money>=8499){
                    cs_set_user_money(id, money -8500);
                    client_print(id, print_chat, "You bought gravity!");
                           }
        }
    }

    menu_destroy(menu);
    return PLUGIN_HANDLED;
 }
 public respawn(id)
{
        spawn(id)
        dllfunc(DLLFunc_Spawn,id)
}


I would like to ask how i get the respawn thing towork.
And if anyone could help me make the gravity thing and so speed dosnt go away after chaning weapon or getting shooted at then it would be great!
dixo1 is offline
dixo1
Junior Member
Join Date: Jun 2008
Old 09-29-2009 , 10:43   Re: shopmenu help :- /
Reply With Quote #2

I try'ed both web compiler and own 1.81 compiler.

Each time i get error:

/home/groups/amxmodx/tmp3/phpig1noH.sma(16) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpig1noH.sma(52) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpig1noH.sma(60) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpig1noH.sma(66) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpig1noH.sma(7 : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpig1noH.sma(84) : error 017: undefined symbol "set_pev"
/home/groups/amxmodx/tmp3/phpig1noH.sma(84) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/phpig1noH.sma(84) : error 001: expected token: ";", but found ")"
/home/groups/amxmodx/tmp3/phpig1noH.sma(84) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpig1noH.sma(84) : fatal error 107: too many error messages on one line

Last edited by dixo1; 09-29-2009 at 10:46.
dixo1 is offline
Hx7r
Member
Join Date: Mar 2009
Old 09-29-2009 , 11:26   Re: shopmenu help :- /
Reply With Quote #3

#include <fakemeta>
Hx7r is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-29-2009 , 11:43   Re: shopmenu help :- /
Reply With Quote #4

Just fastly changed some things, don't know if it works :

Code:
        #include <amxmodx>     #include <amxmisc>     #include <cstrike>     #include <hamsandwich>     #include <fun>     #define PLUGIN "SuperLiga-Shopmenu"     #define VERSION "1.1"     #define AUTHOR "KoGeRbArNeT"     new gMenuLabel[][] = { "+25 hp", "Speed up", "Revive", "16 xp", "Gravity" };     new gMenuMoney[]   = {  2000    , 2000     ,  8500   ,  16000  , 2000 };     new gMenu;         public plugin_init()     {         register_plugin( PLUGIN, VERSION, AUTHOR );         register_clcmd( "say /shopmenu", "ClientCommand_ShopMenu" );         register_clcmd( "say shopmenu" , "ClientCommand_ShopMenu" );     }     public plugin_cfg ()     {         gMenu = menu_create( "\rShopmenu:", "MenuHandler" );         new Item[ 64 ];         new Key [ 2 ];                 for ( new i = 0; i < sizeof gMenuLabel; i++ )         {             num_to_str( i + 1, Key, charsmax( Key ) );             formatex( Item, charsmax( Item ), "\w %s - %i", gMenuLabel[ i ], gMenuMoney[ i ] );             menu_additem( gMenu, Item, Key );         }         menu_setprop( gMenu, MPROP_EXIT, MEXIT_ALL );     }         public ClientCommand_ShopMenu ( const Player )     {         menu_display( Player, gMenu );     }         public MenuHandler ( const Player, const Menu, const Item )     {         if( Item == MENU_EXIT )         {             menu_destroy( Menu );             return PLUGIN_HANDLED;         }         new Data[ 6 ];         new Name[ 64 ];         new Access;         new Callback;                 menu_item_getinfo( Menu, Item, Access, Data, charsmax( Data ), Name, charsmax( Name ), Callback );         new Key = str_to_num( Data );         new MoneyToRetrieve = cs_get_user_money( Player ) - gMenuMoney[ Key - 1 ];         if ( MoneyToRetrieve < 0 )         {             client_print( Player, print_chat, "You don't have enough money (Needed $%d)", MoneyToRetrieve );                         menu_destroy( Menu );             return PLUGIN_HANDLED;         }                 cs_set_user_money( Player, MoneyToRetrieve );         switch ( Key )         {             case 1:             {                 set_user_health( Player, get_user_health( Player ) + 25 );                 client_print( Player, print_chat, "You bought hp!" );             }             case 2:             {                 set_user_maxspeed( Player, get_user_maxspeed( Player ) + 100 );                 client_print( Player, print_chat, "You bought speed!" );             }             case 3:             {                 ExecuteHamB( Ham_CS_RoundRespawn, Player );                 client_print( Player, print_chat, "You bought retrive!");                             }             case 4:             {                 // ...                 client_print( Player, print_chat, "You bought 16 xp!");             }             case 5:             {                 // ...                 client_print( Player, print_chat, "You bought gravity!");             }         }         menu_destroy( Menu );         return PLUGIN_HANDLED;     }
__________________
Arkshine is offline
dixo1
Junior Member
Join Date: Jun 2008
Old 09-29-2009 , 14:55   Re: shopmenu help :- /
Reply With Quote #5

Works perfectly. You know how to do so speed dosnt get off when you change weapon or get shooted on. And is it possible to do so the 16 xp + adds 16 xp to the pokemon (pokemon mod) that the player haves on?
dixo1 is offline
dixo1
Junior Member
Join Date: Jun 2008
Old 09-29-2009 , 14:57   Re: shopmenu help :- /
Reply With Quote #6

By the way. At some how hte menu only works once. First time when you connect ot the server the menu works.
After closing ir ot buy'ing something it dosnt.


(example, you join the server. Write shopmenu and buy and item or close the menu. When done that and you write shopmenu agian it dosnt show up)

Last edited by dixo1; 09-30-2009 at 11:59.
dixo1 is offline
Old 09-30-2009, 08:08
dixo1
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
dixo1
Junior Member
Join Date: Jun 2008
Old 10-17-2009 , 10:59   Re: shopmenu help :- /
Reply With Quote #7

bump
dixo1 is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 10-17-2009 , 16:23   Re: shopmenu help :- /
Reply With Quote #8

The menu doesn't work anymore because of the
Code:
menu_destroy( Menu );
        return PLUGIN_HANDLED;
I think you should do PLUGIN_CONTINUE or maybe an event wich contains the menu...I am not sure...
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
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 14:02.


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