Jump to content
  • 0

Reward NPC - Random ayer


Cyrix

Question


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  150
  • Reputation:   13
  • Joined:  02/16/12
  • Last Seen:  

Reward NPC - Random Player

I'm using this script to reward players online in a given period, eg every 1 hour online a player receives an item x. I configured and tested for 1 minute, NPC delivery just right, but when I'm with more than one account logged deliver it to them and announces the name of the two. I wish it were random and with 1 character only.

Sorry my bad english.

prontera,200,200,0 script teste_premiador 105,{

OnPCLoginEvent:
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;

OnTimer60000:
set @minute, @minute + 1;
// testando com 1 minuto
if(@minute == 1){
set @minute,0;
while(1){
query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
attachrid .@aid;
getitem 607,10;
announce strcharinfo(0) +"Recebeu 10 frutos de Ygg no sorteio por estar 1 hora online", 0;
dispbottom "Você recebeu 10 frutos de ygg por jogar 1 hora.";
set @consecutive_hour, @consecutive_hour + 1;
break;

}


}
//aqui verifica se o jogador esta a 12 horas online e dá um premio melhor.
if(@consecutive_hour == 12) {
set @consecutive_hour,0;
while(1){
query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
attachrid .@aid;
getitem 607,100;
announce strcharinfo(0) +"Recebeu 100 frutos de Ygg no sorteio por estar 1 hora online", 0;
dispbottom "Você recebeu 100 frutos de ygg por jogar 1 hora.";
set @consecutive_hour, @consecutive_hour + 1;
break;

}
stopnpctimer;
initnpctimer;
end;
}
//terminou

Thx.

Edited by Cyrix
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


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

why there is 2 part of this in the script ?

while(1){
query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
attachrid .@aid;
getitem 607,10;
announce strcharinfo(0) +"Recebeu 10 frutos de Ygg no sorteio por estar 1 hora online", 0;
dispbottom "Você recebeu 10 frutos de ygg por jogar 1 hora.";
set @consecutive_hour, @consecutive_hour + 1;
break;
}

btw...

if you want it to give every hour...and using this

http://rathena.org/board/topic/53877-lucky-pick-event/

you can just simple change

OnClock2030:

to

OnMinute00:

the script will run every hour at 0th Minutes.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  150
  • Reputation:   13
  • Joined:  02/16/12
  • Last Seen:  

why there is 2 part of this in the script ?

while(1){
query_sql "select account_id from `char` where online = 1 order by rand() limit 1", .@aid;
attachrid .@aid;
getitem 607,10;
announce strcharinfo(0) +"Recebeu 10 frutos de Ygg no sorteio por estar 1 hora online", 0;
dispbottom "Você recebeu 10 frutos de ygg por jogar 1 hora.";
set @consecutive_hour, @consecutive_hour + 1;
break;
}

btw...

if you want it to give every hour...and using this

http://rathena.org/b...cky-pick-event/

you can just simple change

OnClock2030:

to

OnMinute00:

the script will run every hour at 0th Minutes.

thx

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