Jump to content
  • 0

Implementing SQL into this script.


Gelo

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  56
  • Reputation:   1
  • Joined:  05/10/12
  • Last Seen:  

So i already know how to call sql database from script.

but how to update it?

if player kill barricade then point = +1

if player trade the points to bronze coin = -Amount

Thanks alot, I am really a noob :D

prontera,164,172,2 script Points Room 757,{
query_sql ("SELECT `point` FROM `points_room` WHERE `account_id` = '"+getcharid(3)+"'", #Points);
waitingroom "Collect Points and Get Bronze Coins!",0;
switch( select( "Enter Greedy Points Room",
    "Exchange Points to "+getitemname(.CoinID),
    "Check Points",
    "Exit" ) ){
Case 1:
atcommand "@die";
atcommand "@die";
atcommand "@alive";
set .@A,rand(50);
set .@B,rand(50);
mes "[insert the right answer to enter]";
mes "If A = "+.@A+"   B = "+.@B;
switch( rand(1) ){
Case 0:
set .@Answer,.@A + .@B;
mes "How many is A + B ?";
break;
//Case 1:
set .@Answer,.@A - .@B;
mes "How many is A - B ?";
break;
//Case 2:
set .@Answer,.@A * .@B;
mes "How many is A * B ?";
break;
//Case 3:
set .@Answer,.@A / .@B;
mes "How many is A / B ?";
break;
}
input .@Input;
if( .@Input != .@Answer ){
mes "Incorrect Code Please Try Again";
Close;
}
else if( .@Input == .@Answer ){
warp .Map$,0,0; end;
}
Case 2:
 mes "[Points Room]";
 mes "You got "+#Points+" Points.";
 mes "How many will be used to change into "+getitemname(.CoinID)+" ?";
 mes "Each "+getitemname(.CoinID)+" = "+.Rate+" Points.";
 if( #Points >= .Rate ){
  input .@Amount,0,#Points;
  set .@Calculation,( .@Amount / .Rate );
  if( .@Calculation ){
    set #Points,#Points - ( .@Calculation * .Rate );
    getitem 673,.@Calculation;
    mes "Gained "+.@Calculation+" x "+getitemname(.CoinID);
  }
 }
 close;
Case 3:
mes "[Points Room]";
mes "You got "+#Points+" Greedy Points.";
default: break;
}
close;
OnInit:
set .Map$,"ordeal_1-1";
set .CoinID,673;
set .Rate,10;
monster .Map$,0,0,1906,100,strnpcinfo(0)+"::OnNPCKillEvent";
end;
OnNPCKillEvent:
if (strcharinfo(3) != "ordeal_1-1") end;
if (killedrid != 1906) end;
set #Points,#Points + 1;
monster .Map$,0,0,1906,1,strnpcinfo(0)+"::OnNPCKillEvent";
dispbottom "You Currently Have " +#Points +" Greedy Points";
end;
}
ordeal_1-1,150,150,2 script Exit 757,{
mes "[Exit Points Room]";
mes "Do you want to leave this room now?";
next;
menu "Yes",exit,"No",-; close;
exit:
warp "prontera",155,197;
close;
end;
}
ordeal_1-1,0,0,0,0 monster Greedy Barricade 1906,15,0,0,0
ordeal_1-1,0,0,0,0 monster Greedy Barricade 1906,10,0,0,0
ordeal_1-1,0,0,0,0 monster Greedy Barricade 1906,10,0,0,0
//Points Room
//Mapflags
ordeal_1-1 mapflag noskill
ordeal_1-1 mapflag nosave
ordeal_1-1 mapflag nobranch
ordeal_1-1 mapflag nomemo
ordeal_1-1 mapflag nowarp
ordeal_1-1 mapflag nowarpto
ordeal_1-1 mapflag nopenalty
ordeal_1-1 mapflag pvp_noparty
ordeal_1-1 mapflag noteleport

Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Why do you need an update query in the script? set directly changes variables while SQL update requires a relog (for character/account variables). But you use it the same way as any other SQL execution.

http://www.w3schools.com/sql/sql_update.asp

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