Jump to content
  • 0

The prize is not given to players.


madtoyz

Question


  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  142
  • Reputation:   10
  • Joined:  01/21/12
  • Last Seen:  

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;
}
Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  410
  • Reputation:   29
  • Joined:  04/04/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  142
  • Reputation:   10
  • Joined:  01/21/12
  • Last Seen:  

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/

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  410
  • Reputation:   29
  • Joined:  04/04/12
  • Last Seen:  

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;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  142
  • Reputation:   10
  • Joined:  01/21/12
  • Last Seen:  

getitem @prize,@amount;

its will detect random right ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  142
  • Reputation:   10
  • Joined:  01/21/12
  • Last Seen:  

Yep, it'll work properly with random prizes.

thanks allot...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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 ...
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   4
  • Joined:  09/28/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

how the **** can you get npc_checknear error from a floating npc ????

unless you are using some other emulator like eamod or other eathena ?

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   4
  • Joined:  09/28/12
  • Last Seen:  

Problem Solved.

Thanks Annie Rura.

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