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
lucky109
Senior Member
Join Date: Jan 2005
Old 06-25-2007 , 11:08   Re: how to get back the unknown string of two public ?
Reply With Quote #1

Quote:
Originally Posted by Alka View Post
Man look carefully at my code above again! When display menu is showing random numbers for option 1. 2. 3. !

After that at function under menu display you showing the results!

g_number[id][0]
g_number[id][1] // Those are results!
g_number[id][2]
Code:
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++)
   {
   g_number[id][0] =  ("%d", number) // here save one result to [0]
    //then how to save the result to [1] [2] [3]....?? (may added new date anytime)
   dbi_nextrow(result)
   dbi_result(result,"number",number,63)
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w%d. %s",i,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, "The result number is %d",g_number[id][0])
       case 1: client_print(id, print_chat, "The result number is %d",g_number[id][1])
   } 
   return PLUGIN_HANDLED
}
fine..
there have two result in this case..

how can i use "for (new i=1;i<=dbi_num_rows(result);i++)" to make [0] = i++ to save the value??

g_number[id][0] = ("%d", number)

Last edited by lucky109; 06-25-2007 at 11:12.
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