Raised This Month: $ Target: $400
 0% 

Help me!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nur56
Member
Join Date: Apr 2007
Old 08-11-2008 , 05:47   Help me!
Reply With Quote #1

So I have 3 cases, and I'm making a money check, see if he has the money to buy something, but I'm having an epic problem!(yes I did include cstrike)

PHP Code:
            new money cs_get_user_money(id) - 16000
            str_to_num
(money)
            if(
money 16000){
                
client_print(id,print_chat,"You Don't have enough money to buy godmode")
                
menu_destroy(menu)
                return 
PLUGIN_HANDLED
            

Compile errors:

Code:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Must be a constant expression; assumed zero on line 65
Warning: Loose indentation on line 67
Error: Array must be indexed (variable "money") on line 67
Warning: Loose indentation on line 73
Error: Argument type mismatch (argument 2) on line 81
Error: Must be a constant expression; assumed zero on line 90
Error: Array must be indexed (variable "money") on line 92
Warning: Tag mismatch on line 101
Error: Argument type mismatch (argument 2) on line 103
Error: Must be a constant expression; assumed zero on line 109
Error: Array must be indexed (variable "money") on line 112

8 Errors.
Could not locate output file E:\Steam\steamapps\chrissnafu\counter-strike\cstrike\addons\amxmodx\plugins\WMenu.amx (compile failed).
Halp me doctor Phill! +karma!
Nur56 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-11-2008 , 05:49   Re: Help me!
Reply With Quote #2

Since you don't provide the full code I would say just that.

'money' should be a string and the return value the num. money = str_to_num(mystring);
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-11-2008 , 05:53   Re: Help me!
Reply With Quote #3

Or just remove :

str_to_num(money)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-11-2008 , 05:55   Re: Help me!
Reply With Quote #4

Quote:
new money = cs_get_user_money(id) - 16000
This line was not provided when I answered. -_-'

So, obviously, like connor said, str_to_num() is not need.
__________________
Arkshine is offline
Nur56
Member
Join Date: Apr 2007
Old 08-11-2008 , 06:38   Re: Help me!
Reply With Quote #5

Thanks for the help guys!+karma for ark & connorr

edit: it compiled fine but for some reason menu isnt showing up

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#define PLUGIN "Woot Menu"
#define VERSION "1.0"
#define AUTHOR "T-Bag"



public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /wmenu","cmd_wmenu")
}



public 
cmd_wmenu(id) {
    new 
menu menu_create("\rWoot Menu:","menu_handler")
    
    
menu_additem(menu,"\wHigh Jump $2000","1",0)
    
menu_additem(menu,"\wFlash Boots   $5000","2",0)
    
menu_additem(menu,"\wHealth Surgery  $10000","1",0)
    
menu_additem(menu,"\wGODMODE!!!1   $16000","1",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) - 2000
                
if(money 2000) {
                
client_print(id,print_chat,"You Don't have enough money to buy godmode")
                
menu_destroy(menu)
                return 
PLUGIN_HANDLED
            
}
            
            if(!
is_user_alive(id))
            
client_print(id,print_chat,"You can't buy, your dead!!!")
            
menu_destroy(menu);
            
            
            
            
client_print(id,print_chat,"You Now have High Jump, YO!")
            
set_user_gravity(1,0.5)
            
cs_set_user_money(id,money)
            
menu_destroy(menu)
            return 
PLUGIN_HANDLED
            

        
}
        
        case 
2:{
            
            new 
money cs_get_user_money(id) - 5000
            
if(money 5000) {
                
client_print(id,print_chat,"You Don't have enough money to buy godmode")
                
menu_destroy(menu)
                return 
PLUGIN_HANDLED
            
}
            if(!
is_user_alive(id))
            
client_print(id,print_chat,"You can't buy, your dead!!!");
            
            
client_print(id,print_chat,"You Now have Flash Boots, YO!")
            
set_user_maxspeed(id,-5)
            
menu_destroy(menu)
            
cs_set_user_money(id,money)
            

        }
        
        case 
3:{
            new 
money cs_get_user_money(id) - 16000
            
            
if(money 16000){
                
client_print(id,print_chat,"You Don't have enough money to buy godmode")
                
menu_destroy(menu)
                return 
PLUGIN_HANDLED
            
}
            
            
            if(!
is_user_alive(id))
            
client_print(id,print_chat,"You can't buy, your dead!!!");
            
            
            
client_print(id,print_chat,"You Now have GODMODE OMG")
            
set_user_godmode(id,1)
            
menu_destroy(menu)
        }
    }
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


Last edited by Nur56; 08-11-2008 at 06:46.
Nur56 is offline
zwfgdlc
Senior Member
Join Date: May 2006
Old 08-11-2008 , 08:52   Re: Help me!
Reply With Quote #6

Code:
public cmd_wmenu(id) {     new menu = menu_create("\rWoot Menu:","menu_handler")         menu_additem(menu,"\wHigh Jump $2000","1",0)     menu_additem(menu,"\wFlash Boots   $5000","2",0)     menu_additem(menu,"\wHealth Surgery  $10000","1",0)     menu_additem(menu,"\wGODMODE!!!1   $16000","1",0)         menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)         menu_display(id,menu,0) }
change to
Code:
public cmd_wmenu(id) {     new menu = menu_create("\rWoot Menu:","menu_handler")         menu_additem(menu,"\wHigh Jump $2000","1",0)     menu_additem(menu,"\wFlash Boots   $5000","2",0)     menu_additem(menu,"\wHealth Surgery  $10000","3",0)     menu_additem(menu,"\wGODMODE!!!1   $16000","4",0)         menu_setprop(menu,MPROP_EXIT,MEXIT_ALL)         menu_display(id,menu,0) }
zwfgdlc is offline
Nur56
Member
Join Date: Apr 2007
Old 08-11-2008 , 09:07   Re: Help me!
Reply With Quote #7

IT WORKED! even after changing the code to what zwfgdlc said, it still didn't show up, I saw an event register and was like wtf is that doign there.

so i removed it and it worked! thanks for all the help guys!
Nur56 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-11-2008 , 21:54   Re: Help me!
Reply With Quote #8

As per the Global Forum Rules, you need to have a descriptive topic. If you wish for this topic to stay open, please correct the topic title before you post again.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Nur56
Member
Join Date: Apr 2007
Old 08-12-2008 , 02:41   Re: Help me!
Reply With Quote #9

I do not need help anymore, you may close this topic, next time I will put a descriptive title, thanks.
Nur56 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:51.


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