Jump to content
  • 0

Item per IP


Panny

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

Hey guys, im wanting to make an NPC where it gives you an item once per IP.

I know you can do this per char or per account but is it possible to make it so only 1 item per IP?

Link to comment
Share on other sites

17 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Yes, but we can only go by the ip they last used to log in. So, they could basically just hot spot them selves with their phone and get nearly an unlimited amount. Since from my experience my phone kept feeding me different WAN IPs. But we can make a custom sql table to store the used IPs and then search from. There.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

How would i do this?

Help would be greatly appreciated.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

/*
create table 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";
else {
	query_sql "insert into itemperip values ( '"+ getcharip() +"' )";
	dispbottom "here is your item";
	getitem 501,1;
}
end;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

Thank you but i want to intergrate it into a script i have, with a goto function.

Would this work?

if ( query_sql( "select 1 from itemperip where last_ip = '"+ getcharip() +"'", .@dummy ) ) goto nothanks;

nothanks:

mes "you already have your reward";

close;

My NPC only appeirs once every 6 hours so when click the npc i want it to also clear there IP so they can collect a reward again.

Im using this so they can not login to mutiple account on same IP to collect free items.

Edited by Panny
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

prontera,155,180,5	script	ljdshfksjd	100,{
if ( query_sql( "select 1 from itemperip where last_ip = '"+ getcharip() +"'", .@dummy ) )
	goto L_nothx;
else
	goto L_reward;

L_nothx:
mes "you already claimed the reward";
close;
L_reward:
query_sql "insert into itemperip values ( '"+ getcharip() +"' )";
mes "here is your item";
getitem 501,1;
close;
}

btw this script kinda feel out of place :ani_swt3:

utilizing SQL table to store information, but using newbie scripting style...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

thank you for that, now after getitem 501,1; i want it to clear there IP from the database how can i do this?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

http://www.w3schools.../sql_delete.asp

EDIT for below ...

/...

ok you should go learn some SQL before you ask this question again ...

suddenly I feels like teaching someone about addition/subtraction, but he don't even know how to count the numbers

go read some SQL guide on the internet

EDIT2:

exactly like what emistry said

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

so it would be??

query_sql "DELETE FROM itemperip WHERE last_ip=( '"+ getcharip() +"' )";

Im new to this sorry if it looks so bad haha

query_sql "insert into itemperip values ( '"+ getcharip() +"' )";

dispbottom "here is your item";

getitem 501,1;

query_sql "DELETE FROM itemperip WHERE last_ip= ( '"+ getcharip() +"' )";

EDIT for above ...

/...

Im only asking a question and for a little help, why be so bitchy about it?

Edited by Panny
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

@Panny

1 question ......

why are you want to delete the stored data right after they get the items ?? /hmm

save data into SQL table...
getitem .....
then delete query inside SQL table...

LOL ??

do you really know the reason behind it ? adding a data into SQL ? /hmm ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

Because the NPC loads every 6 hours and players tend to login 2/3/4 accounts, there is a 10 second timer on the NPC to collect items, so adding the IP will stop them from using the NPC on more than 1 account then once collected it clears it ready for the NPC again 6 hours later.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

like this ?

http://pastebin.com/raw.php?i=vS1y140c

just some minor edit from Annie's script in previous post

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

perfect, thank you ever so much.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

btw let me remind something, for you and everyone else

in this request section, we expecting your request is made based on your first post

if you want to request for different feature, edit your first post, or open a new topic

don't do something like this or this

you are making other member's head spin

your request on post#5 and post#11 is totally different than your post#1

EDIT:

I almost feel like want to split topic just now ...

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

I am sorry for posting again here but im having a problem with the script when starting the server via putty.

parse_callfunc: expected ')' to close argument list
46 : {
47 :
48 : //--------------------------------------------------
49 :
50 :		if(BaseLevel < 50) goto L_DENIED;
*	51 :		if ( query_sql( "SELECT 1 FROM itemperIP WHERE last_ip = '"+ getcharip'(') +"'", .@dummy ) ) goto error;

Any ideas where i need to put the missing )

Regards,

Edited by Panny
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

@panny

update your svn to latest ~

Getcharip is added since r16957 and fixed in r16958

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  19
  • Reputation:   0
  • Joined:  11/21/12
  • Last Seen:  

Im using eAthena :/ any ways to do this on that system?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

/*
create table itemperIP (
last_ip varchar(20) primary key
) engine = innodb;
*/
prontera,155,180,5    script    asdf    100,{
   query_sql "select last_ip from login where account_id = "+ getcharid(3), .@ip$;
   if ( query_sql( "select 1 from itemperip where last_ip = '"+ .@ip$ +"'", .@dummy ) )
       dispbottom "you already claimed the reward";
   else {
       query_sql "insert into itemperip values ( '"+ .@ip$ +"' )";
       dispbottom "here is your item";
       getitem 501,1;
   }
   end;
OnClock0000:
OnClock0600:
OnClock1200:
OnClock1800:
   query_sql "truncate itemperip";
   end;
}

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