Jump to content
  • 0

Help me with this newbie package script


Question

Posted (edited)

1.] This scipt is account based and i want to make it as ip based.

new_zone01,53,112,3	script	Newbie	90,{

 // Reward Array <Item Id>, <Qty>, <Refine>
 // Set refine option to 0 if non-refinable.
 setarray .@rwd[0],1705,1,7,1505,1,7,1602,1,7,2424,1,7,2528,1,7,2365,1,7,2102,1,7,2320,1,7,2104,1,7,4004,4,0,4097,1,0,4102,1,0,4058,1,0,14232,2,0,673,5,0;

 query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + getcharid(3) + "", .@lip$);

 if ( getd("$" + .@lip$ + "_NG") > 0 || #NewbieGift > 0)
 {
	mes "";
	mes "I'm sorry, the rewards are exclusively for new players.";
close;	
 }

 mes "";
 mes "Welcome! Here are some free gifts";
 mes "for newcomers:";

 // List all the items.
 for ( set .@i, 0; .@i < getarraysize(.@rwd); set .@i, .@i + 3 )
	// Check if refined option is not 0.
	if(.@rwd[.@i+2] != 0) {
	   mes .@rwd[.@i+1] + " x +" + .@rwd[.@i+2] + " " + getitemname(.@rwd[.@i]);
	}else{
	   mes .@rwd[.@i+1] + " x " + getitemname(.@rwd[.@i]);
 }

 close2;

 // Get Items
 for ( set .@i, 0; .@i < getarraysize(.@rwd); set .@i, .@i + 3 )
	// Check if refined option is not 0.
	if(.@rwd[.@i+2] != 0) {
	  // getitem2 <id>, <qty>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>
	  getitem2 .@rwd[.@i], .@rwd[.@i+1], 1, .@rwd[.@i+2], 0, 0, 0, 0, 0;
	}else{
	   getitem .@rwd[.@i], .@rwd[.@i+1];
	}

 // Set variable to make sure player can't get items again.
 set #NewbieGift, 1;
 setd "$" + .@lip$ + "_NG", getd("$" + .@lip$ + "_NG") + 1;

 end;

 OnInit:
	waitingroom "Newbie Gift!",0;
	end;
}

2.] And i want add (mix) this script to the above script.

/*

CREATE TABLE IF NOT EXISTS itemperIP (
last_ip varchar(20) primary key
) engine = innodb;

*/

prontera,155,180,5	script	ljdshfksjd	100,{
if ( query_sql( "SELECT 1 FROM itemperip WHERE last_ip = '"+ getcharip() +"'", .@dummy ) )
	dispbottom "you already claimed the reward...wait another 6 hours of delay....";
else {
	query_sql "INSERT INTO itemperip VALUES ( '"+ getcharip() +"' )";
	dispbottom "here is your item";

Edited by patr3k

1 answer to this question

Recommended Posts

Posted

    query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`=" + getcharid(3) + "", .@lip$);

   if ( getd("$" + .@lip$ + "_NG") > 0 || #NewbieGift > 0)
   {
       mes "";
       mes "I'm sorry, the rewards are exclusively for new players.";
       close;    
   }
.......
   // Set variable to make sure player can't get items again.
   set #NewbieGift, 1;
   setd "$" + .@lip$ + "_NG", getd("$" + .@lip$ + "_NG") + 1;

take a closer look ... the original script already did it

'$127.0.0.1_NG' appeared in my `mapreg` table

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...