nasagnilac Posted November 9, 2013 Posted November 9, 2013 (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 .... 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 November 9, 2013 by gmprestige Quote
Emistry Posted November 9, 2013 Posted November 9, 2013 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; Quote
nasagnilac Posted November 9, 2013 Author Posted November 9, 2013 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; Quote
Patskie Posted November 9, 2013 Posted November 9, 2013 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; } Quote
Capuche Posted November 9, 2013 Posted November 9, 2013 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; } Quote
Question
nasagnilac
Hi.. anyone can help me arrange this script.. I just want to make a menu just like this
.... 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 gmprestige5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.