Jump to content
  • 0

The prize is not given to players.


Question

Posted

The prize is not given to players.

- script AutoFunEvent -1,{
OnClock0100:
OnClock0300:
OnClock0500:
OnClock0700:
OnClock0900:
OnClock1100:
OnClock1300:
OnClock1500:
OnClock1700:
OnClock1900:
OnClock2100:
OnClock2300:
while(1)
{
 query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
 attachrid .@aid;
 if(CheckVending())
 {
  DetachRID();
  continue;
 }
 announce strcharinfo(0) +" won in Lucky Pick Event.", 0;
 set $@ran2, rand(1,8);
if ($@ran2 == 8) set @prize,4399;
if ($@ran2 == 7) set @prize,579;//Fresh Fish
if ($@ran2 == 6) set @prize,13710;
if ($@ran2 == 5) set @prize,674;
if ($@ran2 == 4) set @prize,969;
if ($@ran2 == 3) set @prize,671;
if ($@ran2 == 2) set @prize,14524;
if ($@ran2 == 1) set @prize,7773;
set $@ran3, rand(1,3);
if ($@ran3 == 3) set @amount,50;
if ($@ran3 == 2) set @amount,10;
if ($@ran3 == 1) set @amount,100;
 break;
}
end;
}

10 answers to this question

Recommended Posts

Posted (edited)
query_sql "select 'account_id' from `char` where online = 1 ORDER BY rand() LIMIT 1", .@aid;

Also, I'm not sure if you can do where online = 1? Unless you've edited your SQL database as such.

If you want, I have a non SQL script that can give everyone a prize, and you can limit it to a map if you'd like.

Edited by michaelsoftman
Posted
query_sql "select 'account_id' from `char` where online = 1 ORDER BY rand() LIMIT 1", .@aid;

Also, I'm not sure if you can do where online = 1? Unless you've edited your SQL database as such.

If you want, I have a non SQL script that can give everyone a prize, and you can limit it to a map if you'd like.

can support this script ?

because i take it from here : http://rathena.org/board/topic/53877-lucky-pick-event/

Posted

Actually, I just realized the problem.

Add this to your script, before the last break;

getitem @prize,@amount;

So like this.

set $@ran2, rand(1,8);
if ($@ran2 == 8) set @prize,4399;
if ($@ran2 == 7) set @prize,579;//Fresh Fish
if ($@ran2 == 6) set @prize,13710;
if ($@ran2 == 5) set @prize,674;
if ($@ran2 == 4) set @prize,969;
if ($@ran2 == 3) set @prize,671;
if ($@ran2 == 2) set @prize,14524;
if ($@ran2 == 1) set @prize,7773;
set $@ran3, rand(1,3);
if ($@ran3 == 3) set @amount,50;
if ($@ran3 == 2) set @amount,10;
if ($@ran3 == 1) set @amount,100;
getitem @prize, @amount;
 break;
}
end;
}

Posted

http://www.eathena.ws/board/index.php?showtopic=275732

lol ... my script is really everywhere

rand(<some number>) will always return a fixed table order, unlike rand() return randomize order

@madtoyz

better use the script on post#13

the solution provide by Kenpachi doesn't work

well ... kenpachi always gave wrong info ...

I'm more surprised that topic has 3 pages and yet nobody said anything about it being bug x.x


- script AutoFunEvent -1,{
OnStartLuck:
do
{
query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
attachrid .@aid;
if (CheckVending()) detachrid;
}
while (CheckVending())
announce strcharinfo(0) +" won in Lucky Pick Event.", 0;
getitem 671,1;
end;
}

hmm ... reloop the query_sql is a big no-no ...
Posted (edited)

Hi Annie Ruru

i already test this script but got this error " [Warning]: npc_scriptcont: failed npc_checknear test."

- script AutoFunEvent -1,{
OnWhisperGlobal:
OnClock2030:
set .@rand, rand(2000000000);
while ( getusers(1) > .@count ) {
 set .@nb, query_sql("select account_id from `char` where online = 1 order by rand("+ .@rand +") limit 128 offset "+ .@count, .@aid );
 set .@i, 0;
 while ( .@i < .@nb ) {
  if ( attachrid(.@aid[.@i]) ) {
if ( getgmlevel() < 60 && !checkvending() ) { // false condition
 announce strcharinfo(0) +" won", 0;
 getitem 501,1;
 end;
}
  }
  set .@i, .@i +1 ;
 }
 set .@count, .@count + 128;
 sleep ( getusers(1) > .@count );
}
end;
}

Edited by Boy

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