Jump to content
  • 0

Question

Posted

i have my battle grounds and recently one of my friend added this script to my bg so that all players with level 1 gm can have +2 valor badge ( level 1 gm premium account ) but im having this kind of error in SQL and also the +2 valor badge didn't work how to fix this??

1231m2s.jpg

function HandOutPrizes { //<teamArray>, <numPlayers>, <itemID>, <qty>
while(.@i < getarg(1)) {
// Edit starts here
query_sql("select account_id,level from login where account_id = "+getd(getarg(0) + "[" + .@i + "]")+"order by level limit 1",.acc_id,.acc_lvl);
if(.acc_lvl == 1)
set .qty,2;
else
set .qty,0;
getitem getarg(2), getarg(3)+.qty, getd(getarg(0) + "[" + .@i + "]");
// Edit ends here
set .@i, .@i + 1;
}
return;
}

7 answers to this question

Recommended Posts

Posted (edited)

Hm...Why not just use getgmlvl? instead of using query?

if(getgmlvl == 1){
set .qty,2;}
else {
set .qty,0;}
getitem getarg(2), getarg(3)+.qty, getd(getarg(0) + "[" + .@i + "]");

As for why the item cant be given is because in this script you've pasted; the Item ID is no where to be found so "getarg(2)" becomes 0. In terms; You must define the itemID and the quantity inorder for the "getitem" to beable to fully work

Edited by Skyrim
  • Upvote 1
Posted

function HandOutPrizes { //<teamarray>, <numplayers>, <itemid>, <qty>
while(.@i < getarg(1)) {
// Edit starts here
query_sql("select account_id,level from login where account_id = "+getd(getarg(0) + "[" + .@i + "]")+"order by level limit 1",.acc_id,.acc_lvl);
if(.acc_lvl == 1)
set .qty,2;
else
set .qty,0;
getitem getarg(2), getarg(3)+.qty, getd(getarg(0) + "[" + .@i + "]");
// Edit ends here
set .@i, .@i + 1;
}
return;
}

Problem:

space between

where account_id = "+getd(getarg(0) + "[" + .@i + "]")+"order 

Try this:

function HandOutPrizes { //<teamarray>, <numplayers>, <itemid>, <qty>
while(.@i < getarg(1)) {
// Edit starts here
query_sql("select account_id,level from login where account_id = '"+getd(getarg(0) + "[" + .@i + "]")+"' order by level limit 1",.acc_id,.acc_lvl);
if(getarraysize(.acc_lvl) == 1)
set .qty,2;
else
set .qty,0;
getitem getarg(2), getarg(3)+.qty, getd(getarg(0) + "[" + .@i + "]");
// Edit ends here
set .@i, .@i + 1;
}
return;
}

I add also getarraysize in the if, since the query_sql returns array variables

Hope it work

Posted

Is your rAthena version before or after 15572?

If it's after r15572, there's no `login`.`level` column which could be causing the error.

Also, as Skyrim mentioned, you could use the script command

  • getgmlevel() to check their level
  • getgroupid() to check their group.

Posted (edited)

Here, I dont know why it became &amp;lt;

function HandOutPrizes {
while(.@i < getarg(1)) {
// Edit starts here
query_sql("select account_id,level from login where account_id = "+getd(getarg(0) + "[" + .@i + "]")+"order by level limit 1",.acc_id,.acc_lvl);
if(.acc_lvl == 1)
set .qty,2;
else
set .qty,0;
getitem getarg(2), getarg(3)+.qty, getd(getarg(0) + "[" + .@i + "]");
// Edit ends here
set .@i, .@i + 1;
}
return;
}

try to use what Bryan posted that is more better

Is your rAthena version before or after 15572?

If it's after r15572, there's no `login`.`level` column which could be causing the error.

Also, as Skyrim mentioned, you could use the script command

  • getgmlevel() to check their level
  • getgroupid() to check their group.

Edited by JayPee
Posted

@all

Thanks a lot its working fine now the solution is

^ that error is different than the first.

while(.@i < getarg(1)) {

should be

while(.@i < getarg(1)) {

Thanks a lot

Regards

  • Upvote 1

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