Jump to content
  • 0
Sign in to follow this  
Lil Troll

Help on query sql..

Question

Hi guys can someone teach me how to properly fix these ladder. 

NPC LADDER:

prontera,159,150,4	script	Fishing Ladder	723,{	mainmenu:	menu "Rank",FRank;		FRank: 			set .@frank,query_sql("SELECT `name`, `flevel`, `fexp`, `fpoints`, `fcaught` FROM `fishing_system` ORDER BY flevel DESC LIMIT 5",.@n$,.@fl,.@fe,.@fp,.@fc);			mes "Hall Of Fame: Fishing Ladder"; 			mes "^ff0000Name^000000:^ff5500[ FL ]^000000:^005500[ FE ]^000000:^55007f[ FP ]^000000:^55ffff[ FC ]^000000";			for(set .@i,1; .@i <= .@frank; set .@i,.@i++) {			mes .@i+". ["+.@n$[0]+"] ("+.@fl[0]+") ("+.@fe[0]+") ("+.@fp[0]+") ("+.@fc[0]+")"; 			//cutin $FishingLadderRank$,3; 			}			next;			menu "^005500[ Return ]^000000",mainmenu; 			close;

QUERY SCRIPT:

function	script	Fishing_Exp	{ 	callfunc "Fishing_Points";	set .@fe,FishingNowExp;              							if(query_sql("SELECT `fexp` FROM `fishing_system` WHERE `name`='"+strcharinfo(0)+"'",.@fe )){			for (.@i = 0; .@i < getarraysize($FishingEquips); .@i++) if(isequipped($FishingEquips[.@i])) {				set FishingNowExp,FishingNowExp+$FishingEquipsExp[.@i];          			}       			query_sql("UPDATE `fishing_system` SET `fexp`='"+.@fe+"' WHERE `name`='"+strcharinfo(0)+"'");		}		else {			query_sql("INSERT INTO `fishing_system` (`account_id`,`char_id`,`name`,`itemID`,`itemcount`,`flevel`,`fexp` ) VALUES ('"+getcharid(3)+"','"+getcharid(0)+"','"+strcharinfo(0)+"','0','0','0','"+escape_sql(.@fe)+"' )");		}	if( FishingNowExp >= $FishingExpMax[ FishingLevel ] ) { 		for ( set .@i, 1 ; .@i <= $FRankUpCutins ; set .@i, .@i + 1 ) {			cutin $FRankUpPicNames$ + .@i, 1 ; 			sleep2 $FLRankPerPic;                         					set .@fl,FishingLevel;									}				if(query_sql("SELECT `flevel` FROM `fishing_system` WHERE `name`='"+strcharinfo(0)+"'",.@fl )){					set FishingLevel, FishingLevel + 1 ; set FishingNowExp, 0 ;          				dispbottom "Congratulations! Fishing Rank is promoted to ^ff0000" + $FishingLevelName$[ FishingLevel ] + "^000000" ;      				query_sql("UPDATE `fishing_system` SET `flevel`='"+.@fl+"' WHERE `name`='"+strcharinfo(0)+"'");			}		else {			query_sql("INSERT INTO `fishing_system` (`account_id`,`char_id`,`name`,`flevel` ) VALUES ('"+getcharid(3)+"','"+getcharid(0)+"','"+strcharinfo(0)+"','0','0','"+escape_sql(.@fl)+"' )");		}		for (.@i = 0; .@i < getarraysize($SpecialFXLVL); .@i++) 		specialeffect2 $SpecialFXLVL[.@i];    						} 	if( FishingLevel >= 50) set FishingNowExp,FishingNowExp + 0;return ; }function	script	Fishing_Points	{	if($FishingPointsToggle == 1) {    							set .@fp,#FishingPoints;              		if(query_sql("SELECT `fpoints` FROM `fishing_system` WHERE `name`='"+strcharinfo(0)+"'",.@fp )){			for (.@i = 0; .@i < getarraysize($FishingEquips); .@i++) if(isequipped($FishingEquips[.@i])) {  // Fishing Equip if equip bonus points.			set #FishingPoints,#FishingPoints+$FishingEquipsPts[.@i];			}			set #FishingPoints,#FishingPoints+$FishingPoints[FishingLevel]; 	        				query_sql("UPDATE `fishing_system` SET `fpoints`='"+.@fp+"' WHERE `name`='"+strcharinfo(0)+"'");		}		else {			query_sql("INSERT INTO `fishing_system` (`account_id`,`char_id`,`name`,`itemID`,`itemcount`,`flevel`,`fexp`,`fpoints` ) VALUES ('"+getcharid(3)+"','"+getcharid(0)+"','"+strcharinfo(0)+"','0','0','0','0','"+escape_sql(.@fp)+"' )");		} 	}		return; }

THE QUERY ITSELF:

DROP TABLE IF EXISTS `fishing_system`;DROP TABLE IF EXISTS `fishingbox`;CREATE TABLE IF NOT EXISTS `fishing_system` (`account_id` int(11) unsigned NOT NULL default '0',`char_id` int(11) unsigned NOT NULL default '0',`name` varchar(30) NOT NULL DEFAULT '',`itemID` INT( 11 ) NOT NULL ,`itemcount` INT( 11 ) NOT NULL DEFAULT '0',`flevel` INT( 11 ) NOT NULL DEFAULT '0',`fexp` INT( 11 ) NOT NULL DEFAULT '0',`fpoints` INT( 11 ) NOT NULL DEFAULT '0',`fcaught` INT( 11 ) NOT NULL DEFAULT '0') ENGINE = MYISAM COMMENT = 'Lil Troll World of Fishing'; 
Edited by Lil Troll

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I mange to fix the whole script and SQL thingy. 

the problem are in this lines.

if(query_sql("SELECT `fexp` FROM `fishing_system` WHERE `name`='"+strcharinfo(0)+"'",.@fe )){			for (.@i = 0; .@i < getarraysize($FishingEquips); .@i++) if(isequipped($FishingEquips[.@i])) {				set FishingNowExp,FishingNowExp+$FishingEquipsExp[.@i];  

I just move the computation(for statement) before if(query_sql) and fix some typos then poof! it worked! :)

Share this post


Link to post
Share on other sites

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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.