Jump to content
  • 0

Event rewarder


Mabuhay

Question


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

This is how it will work.

Listing these players: player1, player2,player3.

Theses are the winners.

i need an NPC that will do like this:

Please enter your name: player1

1. If the named entered is not player1, the npc will not give the reward.

ex:

player4 types in player1, the npc will not give the reward.

2. if the reward has been claimed by the player, the npc wont give it to that player anymore. ~ you know that i mean hehehe

My purpose for this script is that my GM wont have to trade/give the rewards anymore.

the players themselves will claim it via npc already.

actually, i have an idea in making the script but im not sure if anymore. XD

im quite confused in using arrays and stuffs but im learning :3

please help :3

Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

//===== eAthena Script =======================================
//= Item Rewards NPC
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.8
//===== Description: =========================================
//= Useful for event rewards, when a player is not necessarily online.
//= Logging is available, if needed (holds 128 names).
//= Note: Unclaimed rewards are limited to 64 at a time.
//============================================================

zhakastia,85,51,3    script    Julie    831,{

// --------------------- Config ---------------------
// Package format is "ID1,Count1,ID2,Count2,..."
// GM Access: Level required to open the GM menu.
// GM Delete: Level required to erase entries.
// GM Logging: Level required to manage logs.

   set .GMAccess,4;
   set .GMDelete,4;
   set .GMLogging,99;
   set .PackageCount,4;
   setarray .Package1[0],607,100,12103,20,677,1;
   setarray .Package2[0],607,50,12103,10,7959,5;
   setarray .Package3[0],607,25,12103,5,7960,10;
   setarray .Package4[0],31129,1,12103,20;

// --------------------------------------------------

   if (getgroupid() >= .GMAccess) goto GM_Menu;
   mes "[item Rewards]";
   set .@i,0;
   while (.@i < getarraysize($itemreward$)) {
       if (strcharinfo(0) == $itemreward$[.@i]) goto GetReward;
       set .@i, .@i+2; }
   mes "You have no rewards pending.";
   close;

GetReward:
   if (((Weight*100)/MaxWeight) > 49) {
       mes "You are over the weight limit."; close; }
   if (!checkweight(5055,getarraysize(getd(".Package"+$itemreward$[.@i+1])))) {
       mes "Clear space in your inventory."; close; }
   set .@j,0;
   while (.@j < getarraysize(getd(".Package"+$itemreward$[.@i+1]))) {
       getitem getd(".Package"+$itemreward$[.@i+1]+"["+.@j+"]"),getd(".Package"+$itemreward$[.@i+1]+"["+(.@j+1)+"]");
       set .@j, .@j+2; }
   specialeffect2 248;
   deletearray $itemreward$[.@i],2;
   mes "Here you go!";
   close;

OnMinute00:
OnMinute30:
   if (!getarraysize($itemreward$)) end;
   set .@i,0;
   while (.@i < getarraysize($itemreward$)) {
       message $itemreward$[.@i],"[You have a reward pending.  See the Item Rewards NPC.]";
       sleep 10;
       set .@i, .@i+2; }
   end;

GM_Menu:
   mes "[item Rewards]";
   mes "What would you like to do?";
   next;
   switch(select(" ~ ^FF55FFPackage information^000000: ~ ^FF55FFList unclaimed rewards^000000: ~ ^00D900Give a reward^000000: ~ "+((getgroupid()<.GMDelete)?"^777777":"^DE0000")+"Delete a reward^000000: ~ "+((getgroupid()<.GMDelete)?"^777777":"^DE0000")+"Delete all unclaimed rewards^000000: ~ "+((getgroupid()<.GMLogging)?"^777777":"^55AAFF")+"Manage logs^000000: ~ [Close]")) {
       case 1:
           mes "[item Rewards]";
           set .@j,1;
           while (getd(".Package"+.@j)) {
               mes "^660099Package " + .@j + ":^000000";
               set .@i,0;
               while (.@i < getarraysize(getd(".Package"+.@j))) {
                   mes " ~ " + getd(".Package"+.@j+"["+(.@i+1)+"]") + "x " + getitemname(getd(".Package"+.@j+"["+(.@i)+"]"));
                   set .@i, .@i+2; }
               set .@j, .@j+1; }
           next;
           goto GM_Menu;
       case 2:
           mes "[item Rewards]";
           mes "Used space: ^F52887" + (getarraysize($itemreward$)/2) + "^000000/64";
           mes "--------------------------------";
           set .@i,0;
           while (.@i < getarraysize($itemreward$)) {
               mes "^B041FF" + $itemreward$[.@i] + "^000000: package #" + $itemreward$[.@i+1];
               set .@i, .@i+2; }
           next;
           goto GM_Menu;
       case 3:
           mes "[item Rewards]";
           if (getarraysize($itemreward$) > 127) {
               mes "No more names can be stored.";
               mes "Delete some values and try again.";
               next;
               goto GM_Menu; }
           mes "Input a name, then a package number.";
           input .@name$;
               query_sql "SELECT `char_id` FROM `char` WHERE `name` = '"+.@name$+"'",.@charid;
               if (!.@charid) { mes "The name is invalid."; next; goto GM_Menu; }
                   else set .@charid,0;
           input .@package,1,.PackageCount;
           next;
           mes "[item Rewards]";
           mes "Player: ^B041FF" + .@name$ + "^000000";
           mes "Package: ^B041FF#" + .@package + "^000000";
           mes " ";
           mes "Are you sure?";
           if (select("Yes:No") == 2) { mes "Request cancelled."; next; goto GM_Menu; }
           setarray $itemreward$[getarraysize($itemreward$)],.@name$,.@package;
           message .@name$,"[You have a reward pending.  See the Item Rewards NPC.]";
           if ($itemlog) {
               if (getarraysize($itemlog1$) > 127) {
                   deletearray $itemlog1$[0],1;
                   deletearray $itemlog2$[0],1; }
               setarray $itemlog1$[getarraysize($itemlog1$)],strcharinfo(0);
               setarray $itemlog2$[getarraysize($itemlog2$)],.@name$; }
           mes "Reward added.";
           next;
           goto GM_Menu;
       case 4:
           mes "[item Rewards]";
           if (getgroupid() < .GMDelete) {
               mes "You are not permitted to delete entries."; next; goto GM_Menu; }
           mes "Input a name to cancel a reward.";
           input .@name$;
           set .@i,0;
           while (.@i < getarraysize($itemreward$)) {
               if ($itemreward$[.@i] == .@name$) {
                   deletearray $itemreward$[.@i],2;
                   mes "Name cleared."; next; goto GM_Menu; }
               set .@i, .@i+2; }
           mes "The name is invalid.";
           next;
           goto GM_Menu;
       case 5:
           mes "[item Rewards]";
           if (getgroupid() < .GMDelete) {
               mes "You are not permitted to delete entries."; next; goto GM_Menu; }
           mes "^FF0000This action cannot be undone.^000000";
           mes "Are you sure?";
           mes " ";
           if (select("Yes:No") == 2) { mes "Request cancelled."; next; goto GM_Menu; }
           deletearray $itemreward$[0],getarraysize($itemreward$);
           mes "All entries cleared.";
           next;
           goto GM_Menu;
       case 6:
       Log_Menu:
           mes "[item Rewards]";
           if (getgroupid() < .GMLogging) {
               mes "You are not permitted to manage logs."; next; goto GM_Menu; }
           mes "Logs are currently "+(($itemlog)?"^00D900enabled^000000":"^FF0000disabled^000000")+".";
           next;
           switch(select(" ~ ^55AAFFView Logs^000000: ~ "+((!$itemlog)?"^00D900Enable":"^777777Disable")+" logging^000000: ~ ^DE0000Delete all logs^000000: ~ [Go back]")) {
               case 1:
                   mes "[item Rewards]";
                   mes "Used space: ^F52887" + (getarraysize($itemlog1$)) + "^000000/128";
                   mes "--------------------------------";
                   set .@i,0;
                   while (.@i < getarraysize($itemlog1$)) {
                       mes "^B041FF" + $itemlog1$[.@i] + "^000000: sent to ^55AAFF" + $itemlog2$[.@i] + "^000000";
                       set .@i, .@i+1; }
                   next;
                   goto Log_Menu;
               case 2:
                   set $itemlog, ((!$itemlog)?1:0);
                   goto Log_Menu;
               case 3:
                   mes "[item Rewards]";
                   mes "^FF0000This action cannot be undone.^000000";
                   mes "Are you sure?";
                   mes " ";
                   if (select("Yes:No") == 2) { mes "Request cancelled."; next; goto Log_Menu; }
                   deletearray $itemlog1$[0],getarraysize($itemlog1$);
                   deletearray $itemlog2$[0],getarraysize($itemlog2$);
                   mes "Logs cleared.";
                   next;
                   goto Log_Menu;
               case 4:
                   next;
                   goto GM_Menu;
           }
       case 7:
           close;
OnInit:
   waitingroom "Win from event? Get your reward here",0;
   end;
   }
}

edit it to your needs

  • Like 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   33
  • Joined:  11/15/12
  • Last Seen:  

i need more info to create the script.

are you the one to put the list of their names in npc and they can get it anytime or the winners will be warp to a map which the npc is there and they will get their reward according to your rule(names identification).

Reward Item ID? or you want it to be dynamic?

Edited by Anubis
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

i will take care of the reward. just make 607 has example :D thank you :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   33
  • Joined:  11/15/12
  • Last Seen:  

Here try this. - I am not a PRO scripter I am still studying. So if you find any bugs/glitches on the script kindly pm me immediately.

http://pastebin.com/zW6T24dt

Edited by Anubis
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

I think you lack to set the names of the players. Perhaps something like this:

setarray .name$[0],player1,player2,player3;

look for this:

.name$

and add these lines?:

.name$(getarraysize(.name$))

One more thing, what if i want to give 3 or more items? How could this be?

Just correct me if im wrong :D

As I Said, i myself is trying to learn too :)

Thanks for the reply Anubis, help really appreciated :D

btw. haven't tried it yet but i just cant find the list of players XD

Actually, we can use the one Mootie posted. Package one and stuff codes! :D Thanks mootie D:

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

Thats euphy script so thank him o.o suites also to your needs

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

Oww yeah, thanks Euphy! :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   33
  • Joined:  11/15/12
  • Last Seen:  

I think you lack to set the names of the players. Perhaps something like this:

setarray .name$[0],player1,player2,player3;

look for this:

.name$

and add these lines?:

.name$(getarraysize(.name$))

One more thing, what if i want to give 3 or more items? How could this be?

Just correct me if im wrong :D

As I Said, i myself is trying to learn too :)

Thanks for the reply Anubis, help really appreciated :D

btw. haven't tried it yet but i just cant find the list of players XD

Actually, we can use the one Mootie posted. Package one and stuff codes! :D Thanks mootie D:

well I asked you the situation I made the script as ;

Players on the map can get prizes by the rules you set.

and the array you are saying cant be done on input for you want to edit them time by time so instead of making permanent array it will need something to store the input arrays. anyways let me make the script again.

Edited by Anubis
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

woooah thanks anubis. lol i gotta thank evet1 now 0_0

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   33
  • Joined:  11/15/12
  • Last Seen:  

O.O

Edited by Anubis
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...