Raised This Month: $ Target: $400
 0% 

Need help compiling this


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PvtSmithFSSF
Senior Member
Join Date: Jul 2008
Old 07-25-2008 , 21:41   Need help compiling this
Reply With Quote #1

This won't compile I'm a new scripter and this is my first attempt at making MENUs. Can you help tell me what's wrong? Thanks!
Attached Files
File Type: sma Get Plugin or Get Source (Buygravity.sma - 503 views - 3.2 KB)
PvtSmithFSSF is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 07-25-2008 , 22:17   Re: Need help compiling this
Reply With Quote #2

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

#define PLUGIN "Buy Gravity"
#define VERSION "2.0"
#define AUTHOR "PvtSmithFSSF"

new Pcvars[4]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd"/grav","GravMenu");
    
register_clcmd".grav","GravMenu");
    
    
Pcvars[0] = register_cvar("200_price""8000");
    
Pcvars[1] = register_cvar("300_price""7000");
    
Pcvars[2] = register_cvar("400_price""5000");
    
Pcvars[3] = register_cvar("500_price""3000");
}

public 
GravMenu(id)
{
    new 
menu menu_create("\rGravMenu:""menu_handler");
    
menu_additem(menu"\w200 Gravity""1"0);
    
menu_additem(menu"\w300 Gravity""2"0);
    
menu_additem(menu"\w400 Gravity""3"0);
    
menu_additem(menu"\w500 Gravity""4"0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0)
}

public 
menu_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accescallback
    menu_item_getinfo
(menuitemaccesdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            new 
Pcvar get_pcvar_num(Pcvars[0])
            new 
Money cs_get_user_money(id)
            
            if (
Money Pcvar)
            {
                
client_print(id,print_chat,"[Gravity] You don't have enough money!");
            } else {
                 
client_print(idprint_chat"You have successfully bought low gravity [200]");
                
cs_set_user_money(idMoney-Pcvar);
            }    
        }
    
        case 
2:
        {  
            new 
Pcvar get_pcvar_num(Pcvars[1])
            new 
Money cs_get_user_money(id)
            
            if (
Money Pcvar)
            {
                
client_print(id,print_chat,"[Gravity] You don't have enough money!");
            } else {
                 
client_print(idprint_chat"You have successfully bought low gravity [300]");
                
cs_set_user_money(idMoney-Pcvar);
            }
        }
    
        case 
3:
        { 
            new 
Pcvar get_pcvar_num(Pcvars[2])
            new 
Money cs_get_user_money(id)
            
            if (
Money Pcvar)
            {
                
client_print(id,print_chat,"[Gravity] You don't have enough money!");
            } else {
                 
client_print(idprint_chat"You have successfully bought low gravity [400]");
                
cs_set_user_money(idMoney-Pcvar);
            }
        }

        case 
4:
        { 
            new 
Pcvar get_pcvar_num(Pcvars[3])
            new 
Money cs_get_user_money(id)
            
            if (
Money Pcvar)
            {
                
client_print(id,print_chat,"[Gravity] You don't have enough money!");
            } 
            else 
            {
                 
client_print(idprint_chat"You have successfully bought low gravity [500]");
                
cs_set_user_money(idMoney-Pcvar);
            }
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED

Well, i remove this variables:

PHP Code:
    money cs_get_user_money(id);
    
g200price get_pcvar_num(200price);
    
g300price get_pcvar_num(300price);
    
g400price get_pcvar_num(400price);
    
g500price get_pcvar_num(500price); 
I create 1 variable which hold 4 slots for the pcvars

PHP Code:
    new Pcvars[4]; 
I create new variables on each switch statement for get user money and get pcvar num, to see if player have the money to buy the gravity.

PHP Code:
            new Pcvar get_pcvar_num(Pcvars[0])
            new 
Money cs_get_user_money(id)
            
            if (
Money Pcvar)
            {
                
client_print(id,print_chat,"[Gravity] You don't have enough money!");
            } else {
                 
client_print(idprint_chat"You have successfully bought low gravity [200]");
                
cs_set_user_money(idMoney-Pcvar);
            } 
I didn't agree the set_user_gravity() function because i don't know very well how it is.
I indent the code because you miss many "{ }".

The menu destroys when you select one case from the switch statement, so, isn't necessary the menu_destroy(menu) on each case...
__________________
IneedHelp is offline
PvtSmithFSSF
Senior Member
Join Date: Jul 2008
Old 07-25-2008 , 22:21   Re: Need help compiling this
Reply With Quote #3

Thanks, I'll upload that and see if it works


edit: it compiles!

Too bad I don't have a server to test, if anybody does, I'd love for you to.
Attached Files
File Type: sma Get Plugin or Get Source (buygravity-test.sma - 482 views - 3.4 KB)
PvtSmithFSSF is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 07-25-2008 , 22:26   Re: Need help compiling this
Reply With Quote #4

Well, im going to download the amxx 1.8 to test it, if you wait some minutes
__________________
IneedHelp is offline
PvtSmithFSSF
Senior Member
Join Date: Jul 2008
Old 07-25-2008 , 22:27   Re: Need help compiling this
Reply With Quote #5

I would greatly appreciate it
I am trying to get a little temporary job somewhere around the neighborhood, should have 100 or so bucks (already 15 on first day) in around a week.. To buy a little server to enjoy.

Wow that was off-topic Anyways, thanks again.
PvtSmithFSSF is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 07-25-2008 , 22:49   Re: Need help compiling this
Reply With Quote #6

You can always test in a listen server,or on the steam dedicated server,as i do. It's recommended to have a development setup at home, with the same software as the main server, configure everything there,then transfer your work to the external one to avoid down-times,player complaints,etc.
danielkza is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 07-25-2008 , 22:51   Re: Need help compiling this
Reply With Quote #7

I think this plugin is going to work good, i test it and works good for the money, i don't know very well the function of set_user_gravity(), so didn't add me the gravity .

I tested with amxx 1.76d because i have it before and amxx1.8 installer give me some error: 'Haven't found any files on the cstrike directory' bla bla...
__________________
IneedHelp is offline
PvtSmithFSSF
Senior Member
Join Date: Jul 2008
Old 07-25-2008 , 23:06   Re: Need help compiling this
Reply With Quote #8

um. so the gravity doesn't change? it should last for the whole round after you buy it.
PvtSmithFSSF is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 07-25-2008 , 23:38   Re: Need help compiling this
Reply With Quote #9

I didn't add the function of set_user_gravity() to the plugin, because i don't know how to add it very well.
__________________
IneedHelp is offline
PvtSmithFSSF
Senior Member
Join Date: Jul 2008
Old 07-25-2008 , 23:45   Re: Need help compiling this
Reply With Quote #10

I did though. Check my version. in the 3rd post of this topic.
Please tell me if it works
PvtSmithFSSF 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 05:35.


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