Jump to content
  • 0

Item per IP


Question

Posted

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?

17 answers to this question

Recommended Posts

Posted

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.

Posted
/*
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;
}

Posted (edited)

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
Posted

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

Posted (edited)

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
Posted (edited)

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
Posted

@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 ?

Posted

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.

Posted (edited)

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
Posted (edited)

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
Posted
/*
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;
}

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