Jump to content
  • 0

Rewards Script


Fahhad

Question


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  107
  • Reputation:   5
  • Joined:  07/01/14
  • Last Seen:  

Hello  rTeam , i want to edit Euphy's script : http://pastebin.com/raw/wTG07rbs

 

to make it give all the players , instead of a single player

so it'll be like this : post a package then all the players will get the items if they click the npc  :wub:

Edited by Sweetie Pie
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

//Script by Normynator v1.1
//Modified by Panda 
prontera,146,163,4	script	Event Representative	113,{

function EndEvent;

    if(getgmlevel() >= 99){
        .@s = select("Start:Stop:Set Reward:Cancel");
        if(.@s == 1){
			mes "[ ^83cfe9Representative^000000 ]";
				if(.config_done < 1){ mes "Please set your rewards and number of winners first."; close; }
			mes "Event has been started.";
			close2;
			set $giveaway, 0;
			set .start, 1;
			announce "[Event Representative]: [GM] "+strcharinfo(0)+" has started a Give Away Event!",0;
			sleep2 10000;
			announce "[Event Representative]: Number of Winners - "+.winner+" - ",0;
			end;
        }
		else if(.@s == 2){
			if(.start < 1){ mes "No event to stop."; close; }
			mes "[ ^83cfe9Representative^000000 ]";
            mes "You have cancelled the event.";
            set $giveaway, 1000;
            EndEvent;
            close;
        }
		else if(.@s == 3){
            mes "[ ^83cfe9Representative^000000 ]";
			mes "What reward do you want to give to the players?";
			input .Rew_Item;
			set .item,.Rew_Item;
			if ( getiteminfo( .item, 0 ) == -1 ) {
					next;
					mes "[ ^83cfe9Representative^000000 ]";
					mes "Invalid Item ID";
					close;
			}
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "Do you want to reward them "+getitemname(.Rew_Item)+"?";
			menu "Yes",-;
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "How many items will the player get?";
			input .Rew_Amt;
			set .amount,.Rew_Amt;
				if(.amount < 1){
					next;
					mes "[ ^83cfe9Representative^000000 ]";
					mes "Quantity can not be lesser than 1.";
					close;
				}
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "Are you sure with "+.Rew_Amt+" items?";
			menu "Yes",-;
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "Quantity has been set.";
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "How many players do you want to win?";
			input .Rew_Win;
			set .winner,.Rew_Win;
				if(.winner < 1){
					next;
					mes "[ ^83cfe9Representative^000000 ]";
					mes "Winners can not be lesser than 1.";
					close;
				}
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes .winner+" winners will be able to win.";
			set .config_done,1;
			close;
        }else{
			end;
		}
		
    }
	if(.start < 1){ mes "[Representative]"; mes "No events are running."; close; }
	if (#AlreadyGot){
			mes "[ ^83cfe9Representative^000000 ]";
			mes "I have ^FF0000"+.@left + "^000000 items left.";
            mes "You already got your item.";
            close;
        }
    if($giveaway >= .winner){
	mes "[ ^83cfe9Representative^000000 ]";
        mes "I'm sorry, all items have been claimed.";
        close;
    }
	else{
		mes "[ ^83cfe9Representative^000000 ]";
		set .@left, .winner - $giveaway;
        mes "Hi";
        mes "I have ^FF0000"+.@left + "^000000 items left.";
		next;
        set #AlreadyGot, 1;
		mes "[ ^83cfe9Representative^000000 ]";
        mes "Congratulations for making it.";

		getitem .Rew_Item, .Rew_Amt;
		announce strcharinfo(0)+" redeemed one of the "+.@left+" Event Items!",0;

        set $giveaway, $giveaway + 1;
        if($giveaway == .winner){
            EndEvent;
        }
        close;
    }
OnInit:
	waitingroom "Event Representative",0;
	set .start, 0;
	end;

EndEvent:
        announce "All Event Items have been redeemed.",0;
        query_sql "DELETE FROM `main`.`acc_reg_num` WHERE `key`='#AlreadyGot'"; //update this line
	set .start,0;
    end;
}

Just change the query line if you have a different database structure. Let me know if something doesn't work.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  107
  • Reputation:   5
  • Joined:  07/01/14
  • Last Seen:  

anyone willing to help me out?  :(

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

Hmm, I'll try to have a look at it, but won't promise anything alright.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  107
  • Reputation:   5
  • Joined:  07/01/14
  • Last Seen:  

Hmm, I'll try to have a look at it, but won't promise anything alright.

 

that'll be great , thanks for trying  /lv

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  107
  • Reputation:   5
  • Joined:  07/01/14
  • Last Seen:  

//Script by Normynator v1.1
//Modified by Panda 
prontera,146,163,4	script	Event Representative	113,{

function EndEvent;

    if(getgmlevel() >= 99){
        .@s = select("Start:Stop:Set Reward:Cancel");
        if(.@s == 1){
			mes "[ ^83cfe9Representative^000000 ]";
				if(.config_done < 1){ mes "Please set your rewards and number of winners first."; close; }
			mes "Event has been started.";
			close2;
			set $giveaway, 0;
			set .start, 1;
			announce "[Event Representative]: [GM] "+strcharinfo(0)+" has started a Give Away Event!",0;
			sleep2 10000;
			announce "[Event Representative]: Number of Winners - "+.winner+" - ",0;
			end;
        }
		else if(.@s == 2){
			if(.start < 1){ mes "No event to stop."; close; }
			mes "[ ^83cfe9Representative^000000 ]";
            mes "You have cancelled the event.";
            set $giveaway, 1000;
            EndEvent;
            close;
        }
		else if(.@s == 3){
            mes "[ ^83cfe9Representative^000000 ]";
			mes "What reward do you want to give to the players?";
			input .Rew_Item;
			set .item,.Rew_Item;
			if ( getiteminfo( .item, 0 ) == -1 ) {
					next;
					mes "[ ^83cfe9Representative^000000 ]";
					mes "Invalid Item ID";
					close;
			}
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "Do you want to reward them "+getitemname(.Rew_Item)+"?";
			menu "Yes",-;
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "How many items will the player get?";
			input .Rew_Amt;
			set .amount,.Rew_Amt;
				if(.amount < 1){
					next;
					mes "[ ^83cfe9Representative^000000 ]";
					mes "Quantity can not be lesser than 1.";
					close;
				}
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "Are you sure with "+.Rew_Amt+" items?";
			menu "Yes",-;
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "Quantity has been set.";
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "How many players do you want to win?";
			input .Rew_Win;
			set .winner,.Rew_Win;
				if(.winner < 1){
					next;
					mes "[ ^83cfe9Representative^000000 ]";
					mes "Winners can not be lesser than 1.";
					close;
				}
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes .winner+" winners will be able to win.";
			set .config_done,1;
			close;
        }else{
			end;
		}
		
    }
	if(.start < 1){ mes "[Representative]"; mes "No events are running."; close; }
	if (#AlreadyGot){
			mes "[ ^83cfe9Representative^000000 ]";
			mes "I have ^FF0000"+.@left + "^000000 items left.";
            mes "You already got your item.";
            close;
        }
    if($giveaway >= .winner){
	mes "[ ^83cfe9Representative^000000 ]";
        mes "I'm sorry, all items have been claimed.";
        close;
    }
	else{
		mes "[ ^83cfe9Representative^000000 ]";
		set .@left, .winner - $giveaway;
        mes "Hi";
        mes "I have ^FF0000"+.@left + "^000000 items left.";
		next;
        set #AlreadyGot, 1;
		mes "[ ^83cfe9Representative^000000 ]";
        mes "Congratulations for making it.";

		getitem .Rew_Item, .Rew_Amt;
		announce strcharinfo(0)+" redeemed one of the "+.@left+" Event Items!",0;

        set $giveaway, $giveaway + 1;
        if($giveaway == .winner){
            EndEvent;
        }
        close;
    }
OnInit:
	waitingroom "Event Representative",0;
	set .start, 0;
	end;

EndEvent:
        announce "All Event Items have been redeemed.",0;
        query_sql "DELETE FROM `main`.`acc_reg_num` WHERE `key`='#AlreadyGot'"; //update this line
	set .start,0;
    end;
}

Just change the query line if you have a different database structure. Let me know if something doesn't work.

 

 

Thank you Panda <3 , this is more then what i wanted , works like a charm .

Edited by Sweetie Pie
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  235
  • Reputation:   55
  • Joined:  12/02/11
  • Last Seen:  

//Script by Normynator v1.1
//Modified by Panda 
prontera,146,163,4	script	Event Representative	113,{

function EndEvent;

    if(getgmlevel() >= 99){
        .@s = select("Start:Stop:Set Reward:Cancel");
        if(.@s == 1){
			mes "[ ^83cfe9Representative^000000 ]";
				if(.config_done < 1){ mes "Please set your rewards and number of winners first."; close; }
			mes "Event has been started.";
			close2;
			set $giveaway, 0;
			set .start, 1;
			announce "[Event Representative]: [GM] "+strcharinfo(0)+" has started a Give Away Event!",0;
			sleep2 10000;
			announce "[Event Representative]: Number of Winners - "+.winner+" - ",0;
			end;
        }
		else if(.@s == 2){
			if(.start < 1){ mes "No event to stop."; close; }
			mes "[ ^83cfe9Representative^000000 ]";
            mes "You have cancelled the event.";
            set $giveaway, 1000;
            EndEvent;
            close;
        }
		else if(.@s == 3){
            mes "[ ^83cfe9Representative^000000 ]";
			mes "What reward do you want to give to the players?";
			input .Rew_Item;
			set .item,.Rew_Item;
			if ( getiteminfo( .item, 0 ) == -1 ) {
					next;
					mes "[ ^83cfe9Representative^000000 ]";
					mes "Invalid Item ID";
					close;
			}
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "Do you want to reward them "+getitemname(.Rew_Item)+"?";
			menu "Yes",-;
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "How many items will the player get?";
			input .Rew_Amt;
			set .amount,.Rew_Amt;
				if(.amount < 1){
					next;
					mes "[ ^83cfe9Representative^000000 ]";
					mes "Quantity can not be lesser than 1.";
					close;
				}
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "Are you sure with "+.Rew_Amt+" items?";
			menu "Yes",-;
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "Quantity has been set.";
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes "How many players do you want to win?";
			input .Rew_Win;
			set .winner,.Rew_Win;
				if(.winner < 1){
					next;
					mes "[ ^83cfe9Representative^000000 ]";
					mes "Winners can not be lesser than 1.";
					close;
				}
			next;
			mes "[ ^83cfe9Representative^000000 ]";
			mes .winner+" winners will be able to win.";
			set .config_done,1;
			close;
        }else{
			end;
		}
		
    }
	if(.start < 1){ mes "[Representative]"; mes "No events are running."; close; }
	if (#AlreadyGot){
			mes "[ ^83cfe9Representative^000000 ]";
			mes "I have ^FF0000"+.@left + "^000000 items left.";
            mes "You already got your item.";
            close;
        }
    if($giveaway >= .winner){
	mes "[ ^83cfe9Representative^000000 ]";
        mes "I'm sorry, all items have been claimed.";
        close;
    }
	else{
		mes "[ ^83cfe9Representative^000000 ]";
		set .@left, .winner - $giveaway;
        mes "Hi";
        mes "I have ^FF0000"+.@left + "^000000 items left.";
		next;
        set #AlreadyGot, 1;
		mes "[ ^83cfe9Representative^000000 ]";
        mes "Congratulations for making it.";

		getitem .Rew_Item, .Rew_Amt;
		announce strcharinfo(0)+" redeemed one of the "+.@left+" Event Items!",0;

        set $giveaway, $giveaway + 1;
        if($giveaway == .winner){
            EndEvent;
        }
        close;
    }
OnInit:
	waitingroom "Event Representative",0;
	set .start, 0;
	end;

EndEvent:
        announce "All Event Items have been redeemed.",0;
        query_sql "DELETE FROM `main`.`acc_reg_num` WHERE `key`='#AlreadyGot'"; //update this line
	set .start,0;
    end;
}

Just change the query line if you have a different database structure. Let me know if something doesn't work.

 

 

 

This script is quite very useful, any chances to make it detect IP?

And also can you add also in save log?

e.g account id,login id,character,level,job,claim item,quantity,last ip

something like that :D

Edited by Kaze
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

I could, but I'm not that good with SQL yet so might take some time. Also, busy with something in real life, I'll get to it as soon as I can.

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