Jump to content
  • 0

Array Menu in Query HELP PLEASE..


Question

Posted (edited)
query_sql "SELECT `accountid`, `reward_id`, `reward_amount` FROM `rewardaccountnpc`", .@show_name$, .@show_item, .@show_amount;
		for(set @i, 0; @i < getarraysize(.@show_name$); set @i, @i+1){
                }
		getitem .@show_item[@i],.@show_amount[@i];


Hi.. anyone can help me arrange this script.. I just want to make a menu  just like this post-21795-0-42358300-1383980809_thumb.jpg.... The menu will show list of items from query and the query_sql will automaticaly delete the item on menu once it was gathered.

Edited by gmprestige

5 answers to this question

Recommended Posts

Posted


query_sql( "SELECT `accountid`, `reward_id`, `reward_amount` FROM `rewardaccountnpc` ",.@acc_id,.@reward_id,.@reward_amount );

.@size = getarraysize( .@acc_id );

for( .@i = 0; .@i < .@size; .@i++ )

set .@menu$,.@menu$ + .@acc_id[.@i] +" - " + .@reward_amount[.@i] + " x "getitemname( .@reward_id[.@i] ) + ":";

.@i = select( .@menu$ ) - 1;

mes "Pick : "+.@acc_id[.@i];

mes "Reward : "+.@reward_amount[.@i] + " x "getitemname( .@reward_id[.@i] );

close;

Posted

 thanks emistry its not working on me because of .@acc_id I just edit it and works fine... here...

query_sql( "SELECT `accountid`, `reward_id`, `reward_amount` FROM `rewardaccountnpc` ",.@acc_id$,.@reward_id,.@reward_amount );
.@size = getarraysize( .@acc_id$ );
for( .@i = 0; .@i < .@size; .@i++ )
	set .@menu$,.@menu$ +" "+getitemname( .@reward_id[.@i] ) + " x " + .@reward_amount[.@i] + ":";
.@i = select( .@menu$ ) - 1;
getitem .@reward_id[.@i],.@reward_amount[.@i];
query_sql "DELETE FROM `rewardaccountnpc` WHERE `accountid`='"+.@acc_id$+"',`reward_amount`=`"+.@reward_id[.@i]+"`,`reward_id`=`"+.@reward_amount[.@i]+"`";

my problem now is... it doesn't delete the item in the sql..

 

 

here is the sql

DROP TABLE IF EXISTS `ragnarok`.`rewardaccountnpc`;
CREATE TABLE  `ragnarok`.`rewardaccountnpc` (
  `accountid` tinytext NOT NULL,
  `reward_id` int(11) NOT NULL,
  `reward_amount` int(11) NOT NULL,
  KEY `accountid` (`accountid`(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Posted


prontera,150,150,0    script    Sample    100,{

    query_sql( "SELECT `accountid`, `reward_id`, `reward_amount` FROM `rewardaccountnpc` ",.@acc_id,.@reward_id,.@reward_amount );

    .@size = getarraysize( .@acc_id );

    for( .@i = 0; .@i < .@size; .@i++ )

        set .@menu$,.@menu$ + .@acc_id[.@i] +" - " + .@reward_amount[.@i] + " x "+getitemname( .@reward_id[.@i] ) + ":";

    .@i = select( .@menu$ ) - 1;

    mes "Pick : "+.@acc_id[.@i];

    mes "Reward : "+.@reward_amount[.@i] + " x "+getitemname( .@reward_id[.@i] );

    getitem .@reward_id[.@i], .@reward_amount[.@i];

    query_sql "DELETE FROM `rewardaccountnpc` WHERE (`accountid` = '"+getcharid(3)+"' AND `reward_id` = '"+.@reward_id[.@i]+ "') AND `reward_amount` = '"+.@reward_amount[.@i]+"'";

    close;

}

Posted

Drop your table, use this one instead :

CREATE TABLE IF NOT EXISTS `rewardaccountnpc` (
  `account_id` int(11) unsigned NOT NULL,
  `reward_id` int(11) unsigned NOT NULL,
  `reward_amount` int(11) unsigned NOT NULL,
  KEY `account_id` (`account_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
prontera,150,150,0	script	Sample	100,{
	query_sql( "SELECT `accountid`, `reward_id`, `reward_amount` FROM `rewardaccountnpc` ",.@acc_id,.@reward_id,.@reward_amount );
	.@size = getarraysize( .@acc_id );
	for( .@i = 0; .@i < .@size; .@i++ )
		set .@menu$,.@menu$ + .@acc_id[.@i] +" - " + .@reward_amount[.@i] + " x "+getitemname( .@reward_id[.@i] ) + ":";
	.@i = select( .@menu$ ) - 1;
	mes "Pick : "+.@acc_id[.@i];
	mes "Reward : "+.@reward_amount[.@i] + " x "+getitemname( .@reward_id[.@i] );
	getitem .@reward_id[.@i], .@reward_amount[.@i],  .@acc_id[.@i];
	query_sql "DELETE FROM `rewardaccountnpc` WHERE (`accountid` = '"+ .@acc_id[.@i]+"' AND `reward_id` = '"+.@reward_id[.@i]+ "') AND `reward_amount` = '"+.@reward_amount[.@i]+"' limit 1";
	close;
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...