Raised This Month: $ Target: $400
 0% 

Some newbie problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 03-15-2009 , 04:03   Some newbie problems
Reply With Quote #1

Hello everyone, i'm trying to make this plugin http://forums.alliedmods.net/showthread.php?t=87586

And so far, i encounted some problems:
The idea of plugin is in one cfg file user sets amount of pistols, shotguns, rifles, e.t.c., sold in sub-buymenu, then, in another cfg file he sets their names, price and command to execute when item is bought (so this menu can support other plugins, like bazooka), plugin reads it all and build menu up.
So the first problem is CVAR...

Code:
public plugin_init()
{
              cvar_zp_cs_buymenu_pistol_count = register_cvar("zp_cs_buymenu_pistol_count", "5");
      register_plugin(PLUGIN,VERSION,AUTHOR);
      register_clcmd("amx_buy", "clcmd_zp_cs_buymenu");
            
            
            
      new cfgdir[64];
      get_configsdir(cfgdir, sizeof cfgdir - 1);
      server_print("[zp_cs_buymenu] Executing: %s/zp_cs_buymenu.cfg",cfgdir);
      server_cmd("exec %s/zp_cs_buymenu.cfg", cfgdir);
      server_print("[zp_cs_buymenu] Pistols found: %d",get_pcvar_num(cvar_zp_cs_buymenu_pistol_count));
}
Config file has:
Code:
zp_cs_buymenu_pistol_count 3213
Config file is being executed (checked it), but server always says "Pistols found: 5", well, or if i'll make
Code:
register_cvar("zp_cs_buymenu_pistol_count", "1");
the server will say "Pistols found: 1" - can anyone tell me, why does variable value wasn't read from cfg?

The second problem - zp_cs_buymenu_pistol_count determines array size for zp_cs_buymenu_pistol_name[], zp_cs_buymenu_pistol_cost[], and zp_cs_buymenu_pistol_id[]. I tried:
Code:
new zp_cs_buymenu_pistol_name[cvar_zp_cs_buymenu_pistol_count];
and got:
Quote:
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 35
Error: Invalid array size (negative or zero) on line 35
Error: Empty statement on line 35
Error: Too many error messages on one line on line 35

Compilation aborted.
4 Errors.
Could not locate output file D:\Temp\2\cstrike\addons\amxmodx\plugins\zp_o riginal_cs_buymenu.amx (compile failed).
How can i make a dynamic array in amxx?

And the last thing - how can i make white, not red, numbers left to menu items? I tried puttin \w in menu item string, but it didn't help.

Last edited by SonicSonedit; 03-15-2009 at 04:08.
SonicSonedit is offline
Old 03-15-2009, 04:04
SonicSonedit
This message has been deleted by SonicSonedit. Reason: doublepost
Zombie Lurker
Senior Member
Join Date: Mar 2009
Old 03-15-2009 , 05:22   Re: Some newbie problems
Reply With Quote #2

Quote:
And the last thing - how can i make white, not red, numbers left to menu items? I tried puttin \w in menu item string, but it didn't help.
How did your words even happen to turn red?? Its supposed to be white at default isnt it? There must be some script which is wrongly done somewhere.
__________________
Zombie Lurker is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 03-15-2009 , 16:51   Re: Some newbie problems
Reply With Quote #3

Not words, numbers left to the words.

Left is what i want, Right is what i got
SonicSonedit is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-15-2009 , 17:40   Re: Some newbie problems
Reply With Quote #4

Dynamic Arrays: I started by looking at mapchooser.sma Follow "g_mapName" for a string example.

Menu: What menu system are you using? Maybe the "new" menu system does it automatically.
__________________

Last edited by fysiks; 03-15-2009 at 17:42.
fysiks is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 03-15-2009 , 18:23   Re: Some newbie problems
Reply With Quote #5

\r makes the string after it go red
\w makes the string after it go white
\d makes the string after it go grey
\R alligns the menu to the right
__________________
minimiller is offline
Send a message via MSN to minimiller
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-15-2009 , 18:54   Re: Some newbie problems
Reply With Quote #6

Quote:
Originally Posted by minimiller View Post
\r makes the string after it go red
\w makes the string after it go white
\d makes the string after it go grey
\R alligns the menu string after it to the right
__________________
fysiks is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 03-15-2009 , 19:08   Re: Some newbie problems
Reply With Quote #7

Quote:
\r makes the string after it go red
\w makes the string after it go white
\d makes the string after it go grey
\R alligns the menu to the right
Quote:
I tried putting \w in menu item strings, but it didn't help.

fysiks
Yes, new menu system.
Is there any way to change it?

Thank you for dynamic arrays hint!

Last edited by SonicSonedit; 03-15-2009 at 20:15.
SonicSonedit is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 03-15-2009 , 21:01   Re: Some newbie problems
Reply With Quote #8

Quote:
Is there any way to change it?
Ok, i found the solution)
PHP Code:
menu_setprop(zp_cs_buymenuMPROP_NUMBER_COLOR"\w"); 
The new question - how can i make indentation like this?

Last edited by SonicSonedit; 03-15-2009 at 21:14.
SonicSonedit is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-16-2009 , 00:10   Re: Some newbie problems
Reply With Quote #9

"1. 9X19mm Sidearm\R400"
__________________
fysiks is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 03-16-2009 , 00:56   Re: Some newbie problems
Reply With Quote #10

Oh, thank you!)

New question - how to block default buymenu?

My buymenu called by player's "buy" command, so for a moment you can see old buymenu...and how to create buyzone entity for the whole map?
SonicSonedit 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 09:03.


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