Forever Ragnarok
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Forever Ragnarok

Forums of FRO
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log in  

 

 Prize Giver

Go down 
AuthorMessage
GM Noob Killer
Admin
GM Noob Killer


Posts : 872
Join date : 2009-05-16
Age : 29
Location : Behind you

Prize Giver Empty
PostSubject: Prize Giver   Prize Giver EmptyFri May 29, 2009 9:48 pm

//===== eAthena Script =======================================
//= Event Prize Giver
//===== By: ==================================================
//= fourxhackd
//===== Revision: ============================================
//= 1.0
//===== Features: ============================================
//= add and delete prize function
//= claim prize function
//= 3 Digit Security System ( can be disabled / enabled )
//===== Description: =========================================
//= This is an event prize giver that Admins can use when they
//= want to monitor the prizes being given by their lower
//= leveled GMs. The GMs can set the prize, then give the 3
//= digit password to the event winner so as to make it more
//= secure.
//============================================================
ra_temsky,92,88,4 script Prize Setter 117,{

// The name of the NPC. Make sure this is the same as the npc's name seen above
set .name$,"[^008800Prize Setter^000000]";

// The lowest level needed to be able to set prizes
set .gmLevel,2;

// The ID of your donation point or box (if none, set to 0)
set .donationPointID,15504;

// The ID of your GM's Personal Card (if none, set to 0)
set .gmCardID,75;

// The ID of your server's event points. (if none, set to 0)
set .eventPointID,2709;

// Max number of give-able event points.
set .eventPointMax,10;

// Max prize amount.
set .maxPrizeAmount,400;

// enables / disables the 3 digit code security
set .security,1;

if (getgmlevel() >= .gmLevel){
L_start:
mes .name$;
mes "Hello GM. What would you like to do?";
next;
menu "Set a prize",L_set,"View Prize",-,"Delete a prize",L_del,"Cancel",L_close;
set .@viewonly,1;
goto L_del;
close;
L_set:
mes .name$;
mes "What item would you like to set?";

// Getting the inventory
getinventorylist;
set .@itemselection$,getitemname(@inventorylist_id[.@i]);
for (set .@i,1;.@i < @inventorylist_count;set .@i, .@i + 1){
set .@itemselection$, .@itemselection$ + ":" + getitemname(@inventorylist_id[.@i]);
}
set .@itemselection$, .@itemselection$ + ":Cancel";
next;
// Choose an item
set .@selected,select(.@itemselection$);
// Gets the item ID
set .@selectedid,@inventorylist_id[.@selected-1];
debugmes "strcharinfo(0) attempt give .@selectedid";
L_amount:
mes .name$;
mes "How many of item ^008880"+.@selectedid+"^000000 would you like to give?";
next;
input .@amount;
mes .name$;
// Checks wether there are anything wrong with amount or type of item
if (.@amount < 1){
mes "You cannot have an amount less than or equal to 0.";
next;
goto L_amount;
}
if (.@amount > .eventPointMax && .@selectedid == .eventPointID){
mes "You cannot give more than "+.eventPointMax+" Event Points.";
next;
goto L_amount;
}
// You can delete this if you do not use TCG cards for prizes.
if (.@amount > 200 && .@selectedid == 7227){
mes "You cannot give more than 200 TCG Cards.";
next;
goto L_amount;
}
if (.@amount > .maxPrizeAmount){
mes "You cannot give more than "+.maxPrizeAmount+" as an amount.";
next;
goto L_amount;
}
if (.@selectedid == .donationPointID){
mes "You cannot give donation points.";
next;
goto L_set;
}
// You can delete this part if you do not have TCG job cards, one of my newer features in my server
if (.@selectedid >= 15501 && .@selectedid <= 15505){
mes "You cannot give TCG job cards as prizes.";
next;
goto L_set;
}

if (.@selectedid == .gmCardID){
mes "You cannot give GM Card as a prize.";
next;
goto L_set;
}
L_setrecv:
mes "To who would you like to set this prize to?";
mes "Please write his full character name.";
next;
input .@receiver$;
mes .name$;
mes "Is [^008880"+.@receiver$+"^000000] correct?";
next;
if (select("Yes:No") == 2)goto L_setrecv;
next;
L_pw:
mes .name$;
mes "Please input a 3 digit number for your event for security purposes.";
next;
input .@pw;
if (.@pw < 100 || .@pw > 999){
mes .name$;
mes "Invalid password. Please try again.";
next;
goto L_pw;
}
mes .name$;
mes "Setting the required variables...";
next;
set .@result,query_sql("INSERT INTO event_npc (`id`,`pw`,`item_id`,`item_amt`,`recv`,`gm`,`status`) VALUES ('', '"+.@pw+"', '"+.@selectedid+"', '"+.@amount+"', '"+.@receiver$+"','"+strcharinfo(0)+"', '0')");
mes .name$;
if (.@result == -1){mes "There was an error.";}
else {mes "Done!";}
close;

L_del:
set @getdata,query_sql("SELECT id, pw, item_id, item_amt, recv, gm, status FROM `event_npc` WHERE status != 2 ORDER BY id DESC", .@count_id, .@pw, .@item_id, .@item_amt, .@recv$, .@gm$, .@status);
if (getarraysize(.@count_id) <= 0){
mes .name$;
mes "There are no prize entries.";
next;
goto L_start;
}
mes .name$;
mes "Here is a list:";
for (set .@a,0; .@a <= getarraysize(.@count_id) - 1; set .@a, .@a+1){
mes "[Prize # "+getd(".@count_id["+.@a+"]")+" for ^008800"+getd(".@recv$["+.@a+"]")+"^000000]";
mes getd(".@item_amt["+.@a+"]")+"pcs of ^008880"+getitemname(getd(".@item_id["+.@a+"]"))+"^000000";
mes "Password: [^ff0000"+getd(".@pw["+.@a+"]")+"^000000]";
mes " ";
}
next;
if (.@viewonly == 1)goto L_start;
L_del_id:
mes .name$;
mes "Please enter Prize ID.";
mes "Enter 119 to cancel deletion.";
next;
input .@prize_del;
mes .name$;
if (.@prize_del > 0 && .@prize_del < getarraysize(@id)) {
mes "Please enter a valid number.";
next;
goto L_del_id;
}
if (.@prize_del == 119){
mes "Deletion cancelled.";
next;
goto L_start;
}
mes "Are you sure you want to delete ^008800Prize ID number "+.@prize_del+"^000000?";
next;
if (select("Continue:Cancel") == 2)close;
set @dodata,query_sql("UPDATE `event_npc` SET `status` = '2' WHERE `id` = "+.@prize_del+" LIMIT 1");
mes .name$;
mes "Prize entry was revoked.";
close;
}

mes .name$;
mes "Hello player.";
mes "Let me see if any GM has left any prizes for you...";
next;
set @finddata,query_sql("SELECT id, pw, item_id, item_amt, recv, status FROM `event_npc` WHERE `recv` = '"+strcharinfo(0)+"' && `status` != 2 LIMIT 1", .@id, .@pw, .@item_id, .@item_amt, .@recv$ ,.@status);
if (.@item_amt == 0)goto L_none;
mes .name$;
mes "You have ^008800"+.@item_amt+" "+getitemname(.@item_id)+"^000000 waiting for you, "+strcharinfo(0)+".";
next;
mes .name$;
mes "Would you like to claim it?";
next;
if (select("Claim:Cancel") == 2) close;
if (.security == 0)goto L_prize;
L_pass:
mes .name$;
mes "What was the password the GM gave you?";
next;
input .@pass;
mes .name$;
if (.@pass != .@pw){
mes "Wrong password.";
next;
goto L_pass;
}
L_prize:
mes "Here you go.";
getitem .@item_id,.@item_amt;
set @dodata,query_sql("UPDATE `event_npc` SET `status` = '2' WHERE `id` = "+.@id+" LIMIT 1");
close;
L_none:
mes .name$;
mes "There are no items waiting for you to retrieve.";
close;

L_close:
mes .name$;
mes "As you wish.";
close;
}
Back to top Go down
 
Prize Giver
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Forever Ragnarok :: Scripts-
Jump to: