Jump to content
  • 0

@request IP based Freebies


Yoona

Question


  • Group:  Members
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  567
  • Reputation:   18
  • Joined:  04/15/13
  • Last Seen:  

A IP based Freebies.. 

 

that they can use 1 IP at the same time

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

set .NPC$, "[ " strnpcinfo(1)+ " ]";
 

 

Should be : 

set .NPC$, "[ " +strnpcinfo(1)+ " ]";
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Execute this on your database

CREATE TABLE IF NOT EXISTS `freebies` (
  `id` int(11) NOT NULL auto_increment,
  `account_id` int(11) NOT NULL default '0',
  `name` varchar(23) NOT NULL default '',
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY (`account_id`),
  KEY (`id`)
) ENGINE=MyISAM;

 

Then try this code : 

 

 

prontera,150,150,0    script    Freebies    100,{
    mes .NPC$;
    mes "Wanna get the freebies " +strcharinfo(0)+ "?";
    if (select("Yes:No") - 1) close;
    mes .NPC$;
    mes "Let me check if you are really a new member";
    next;
    query_sql("SELECT last_ip FROM `login` WHERE account_id = "+getcharid(3)+"", .@lastip$);
    query_sql("SELECT last_ip FROM `freebies`", .@freebiesip$);
    if (.@lastip$ == .@freebiesip$) {
            mes .NPC$;
            mes "You already got the freebies " +strcharinfo(0);
            close;
    }
    query_sql("INSERT INTO `freebies` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@lastip$ + "')");
    for ( set .@x,0; .@x < getarraysize(.freebie_item); set .@x,.@x + 1 ) {
            getitem .freebie_item[.@x], ..quantity[.@x];
    }
    
    close;
    
    OnInit:
        set .NPC$, "[ " strnpcinfo(1)+ " ]";
        setarray .freebie_item[0],607,608;
        setarray .quantity[0],1,1;
}

Did not test though. Post if an error occured.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  30
  • Reputation:   1
  • Joined:  12/13/11
  • Last Seen:  

On 4/26/2013 at 10:16 AM, Patskie said:

Execute this on your database


CREATE TABLE IF NOT EXISTS `freebies` (
  `id` int(11) NOT NULL auto_increment,
  `account_id` int(11) NOT NULL default '0',
  `name` varchar(23) NOT NULL default '',
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY (`account_id`),
  KEY (`id`)
) ENGINE=MyISAM;

 

Then try this code : 

 

 


prontera,150,150,0    script    Freebies    100,{
    mes .NPC$;
    mes "Wanna get the freebies " +strcharinfo(0)+ "?";
    if (select("Yes:No") - 1) close;
    mes .NPC$;
    mes "Let me check if you are really a new member";
    next;
    query_sql("SELECT last_ip FROM `login` WHERE account_id = "+getcharid(3)+"", .@lastip$);
    query_sql("SELECT last_ip FROM `freebies`", .@freebiesip$);
    if (.@lastip$ == .@freebiesip$) {
            mes .NPC$;
            mes "You already got the freebies " +strcharinfo(0);
            close;
    }
    query_sql("INSERT INTO `freebies` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@lastip$ + "')");
    for ( set .@x,0; .@x < getarraysize(.freebie_item); set .@x,.@x + 1 ) {
            getitem .freebie_item[.@x], ..quantity[.@x];
    }
    
    close;
    
    OnInit:
        set .NPC$, "[ " strnpcinfo(1)+ " ]";
        setarray .freebie_item[0],607,608;
        setarray .quantity[0],1,1;
}

Did not test though. Post if an error occured.

error occurred, if same user logged from another IP
Please help

image.png.cccb39e3a224af96c291168760abbd67.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  567
  • Reputation:   18
  • Joined:  04/15/13
  • Last Seen:  

Execute this on your database

CREATE TABLE IF NOT EXISTS `freebies` (
  `id` int(11) NOT NULL auto_increment,
  `account_id` int(11) NOT NULL default '0',
  `name` varchar(23) NOT NULL default '',
  `last_ip` varchar(100) NOT NULL default '',
  PRIMARY KEY (`account_id`),
  KEY (`id`)
) ENGINE=MyISAM;

 

Then try this code : 

 

 

prontera,150,150,0    script    Freebies    100,{
    mes .NPC$;
    mes "Wanna get the freebies " +strcharinfo(0)+ "?";
    if (select("Yes:No") - 1) close;
    mes .NPC$;
    mes "Let me check if you are really a new member";
    next;
    query_sql("SELECT last_ip FROM `login` WHERE account_id = "+getcharid(3)+"", .@lastip$);
    query_sql("SELECT last_ip FROM `freebies`", .@freebiesip$);
    if (.@lastip$ == .@freebiesip$) {
            mes .NPC$;
            mes "You already got the freebies " +strcharinfo(0);
            close;
    }
    query_sql("INSERT INTO `freebies` VALUES (NULL," + getcharid(3) + ",'" + escape_sql(strcharinfo(0)) + "','" + .@lastip$ + "')");
    for ( set .@x,0; .@x < getarraysize(.freebie_item); set .@x,.@x + 1 ) {
            getitem .freebie_item[.@x], ..quantity[.@x];
    }
    
    close;
    
    OnInit:
        set .NPC$, "[ " strnpcinfo(1)+ " ]";
        setarray .freebie_item[0],607,608;
        setarray .quantity[0],1,1;
}

Did not test though. Post if an error occured.

there's an Error at line 17, what should i do ????

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

getitem .freebie_item[.@x], ..quantity[.@x];

Should be : 

getitem .freebie_item[.@x], .quantity[.@x];
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  567
  • Reputation:   18
  • Joined:  04/15/13
  • Last Seen:  

getitem .freebie_item[.@x], ..quantity[.@x];

Should be : 

getitem .freebie_item[.@x], .quantity[.@x];

now there's a problem in line 23, i check the problem it says parse_line need ";"

 

but i check the script its not missing ";"

 

line 23

set .NPC$, "[ " strnpcinfo(1)+ " ]";

 

what should i do?

Edited by Yoona
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  567
  • Reputation:   18
  • Joined:  04/15/13
  • Last Seen:  

set .NPC$, "[ " strnpcinfo(1)+ " ]";
 

 

Should be : 

set .NPC$, "[ " +strnpcinfo(1)+ " ]";

Wow! thanks Patskie =) 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  2
  • Reputation:   0
  • Joined:  05/15/14
  • Last Seen:  

did not work for my server. :(

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