Jump to content
  • 0

I want to be able to level up by sql


Prime

Question


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  01/11/12
  • Last Seen:  

niflheim,304,71,6	script	 Woe Coin Trader	956,{
mes "[Woe Coin]";
mes "test 350";
next;
switch(select("Yes:No")) {
	case 1:
	mes "[ Woe Coin ]";	
	query_sql "UPDATE `char` SET `base_level` = '"+@lvl+"' WHERE `char_id` = '"+getcharid(0)+"' LIMIT 1";
	end;
	
	case 3:
	mes "[ Woe Coin ]";
	mes "Come back any time.";
	close;
}
OnInit:
set @lvl, 349;
}

I cant level up my char it shows a mysql error i want that it updates the char lvl to 350 by sql please help :c

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  52
  • Reputation:   7
  • Joined:  01/02/12
  • Last Seen:  

You can't use @ variable in OnInit event. Cuz it's 'temporary character integer variable'

You need this:

niflheim,304,71,6    script     Woe Coin Trader    956,{
mes "[Woe Coin]";
mes "test 350";
next;
switch(select("Yes:No")) {
    case 1:
    mes "[ Woe Coin ]";    
    query_sql("UPDATE `char` SET `base_level` = '"+.lvl+"' WHERE `char_id` = '"+getcharid(0)+"'");
    close;
    
    case 2:
    mes "[ Woe Coin ]";
    mes "Come back any time.";
    close;
}
OnInit:
set .lvl, 349;
end;
}

But why you don't use 

set BaseLevel, BaseLevel + .level;

??

Edited by ocelote
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  


query_sql( "UPDATE `char` SET `base_level` = 350 WHERE `online` = 0 AND `base_level` < 350" );

addrid(0);

if ( BaseLevel < 350 ) {

BaseLevel = 350;

mes "You level up to 350.";

}

end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  01/11/12
  • Last Seen:  

Thanks you all!

Link to comment
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.   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.

×
×
  • Create New...