Raised This Month: $ Target: $400
 0% 

how to get back the unknown string of two public ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 06-25-2007 , 11:22   Re: how to get back the unknown string of two public ?
Reply With Quote #1

Man you don't understand something! g_number[id][0] saves the number already! You must use it somewhere ;like in print_chat!

Code:
g_number       [id]            [3]
array          player id   maxim values
so if you want to have more values add [10] so you will have
g_number[id][0]
g_number[id][1] //2D arrays
g_number[id][2]
....................
g_number[id][9]

Or you can do like this:
Code:
new x;
x = g_number[id][0]
and "x" is the value(number)!
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 06-25-2007 at 11:25.
Alka is offline
lucky109
Senior Member
Join Date: Jan 2005
Old 06-25-2007 , 13:22   Re: how to get back the unknown string of two public ?
Reply With Quote #2

Code:
new g_number[33][10]

public plugin_init() {
	register_clcmd("test","ShowMenu", -1, "show est menu")
	register_menucmd(register_menuid("\yTest Menu"), 1023, "MenuCommand")


public ShowMenu(id)
{
   new CSName[32];
   get_user_name(id, CSName, 31);
   result = dbi_query(dbc,"SELECT * FROM `test` WHERE `name` = '%s'", CSName)

   new szMenuBody[256]
   new keys

   new nLen = format( szMenuBody, 255, "\wTest Menu:^n" )

   new number[64];
   for (new i=1;i<=dbi_num_rows(result);i++)
   {
   dbi_nextrow(result)
   dbi_result(result,"number",number,63)
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w%d. %s",i,number)
   g_number[id][i] = str_to_num(number)
   }

   keys = (1<<0|1<<1)

   show_menu( id, keys, szMenuBody, -1 )
   return PLUGIN_CONTINUE
}

public MenuCommand( id, key )
{
   switch( key )
   {
       case 0: client_print(id, print_chat, "%d",g_number[id][1])
       case 1: client_print(id, print_chat, "%d",g_number[id][2])
   } 
   return PLUGIN_HANDLED
}
see my code...right...it's work fine!!

i want to ask one more question about "keys = (1<<0|1<<1)"
how can i make it's two keys if result = 2?

example:
dbi_num_rows(result) = 2 , that mean here have two result case..
two result case = two keys --> "keys = (1<<0|1<<1)"

example2:
dbi_num_rows(result) = 5 , that mean here have five result case..
five result case = five keys --> "keys = (1<<0|1<<1|1<<2|1<<3|1<<5)"

example3:
dbi_num_rows(result) = 9 , that mean here have nine result case..
nine result case = nine keys --> "keys = (1<<0|1<<1|1<<2|1<<3|1<<5|1<<6|1<<7|1<<8|1<<9 )"


sorry again..my bad english...thanks
lucky109 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 21:30.


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