Shindu Posted December 27, 2013 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 28 Reputation: 0 Joined: 12/09/13 Last Seen: May 2, 2014 Share Posted December 27, 2013 Hey guys. I want to give an item out to new players when they connect to the server however i only want it to be given out once per IP. Obviously this will need to save there IP in the SQL database and check if the IP has already been added and deny the player getting the item. Any suggestions on the best way to do this? Quote Link to comment Share on other sites More sharing options...
Capuche Posted December 27, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted December 27, 2013 Any suggestions on the best way to do this? I suggest you to use the search toolbar in script section (title with freebie or newbie), there is a lot of topics about the same request Quote Link to comment Share on other sites More sharing options...
Wolf Posted December 29, 2013 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 96 Reputation: 42 Joined: 11/15/11 Last Seen: May 19, 2023 Share Posted December 29, 2013 The problem of doing something by IP, is whose reset / change calling pro provider or even by proxy, or by unplugging the modem. If you want to give something pro player, and he does not want to earn more, I suggest you do with a normal variable (set variable, 1); and so when you want to remove his condition, only to set back to 0. It's just a suggestion. Quote Link to comment Share on other sites More sharing options...
HelloKekette Posted January 2, 2014 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 36 Reputation: 0 Joined: 09/09/13 Last Seen: April 11, 2014 Share Posted January 2, 2014 You can use a chek ip with a variable on the account to prevent abuse by reset/change Quote Link to comment Share on other sites More sharing options...
Wolf Posted January 2, 2014 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 96 Reputation: 42 Joined: 11/15/11 Last Seen: May 19, 2023 Share Posted January 2, 2014 You can use a chek ip with a variable on the account to prevent abuse by reset/change Indeed, it could set the IP in a permanent variable on the account, then the IP it was different (IP_VARIABLE != IP_ACC) from the IP of the account, he would be forced to leave the server, it makes sense. Quote Link to comment Share on other sites More sharing options...
Kido Posted January 3, 2014 Group: Members Topic Count: 127 Topics Per Day: 0.03 Content Count: 1445 Reputation: 164 Joined: 08/17/13 Last Seen: July 11, 2019 Share Posted January 3, 2014 You can use mine well not totally mine, i didn't made it, dunno who is the author so, you can modify it as you need, i use this one, i hope it helps prontera,153,177,5 script Freebies 123,{ query_sql ("SELECT `last_ip` FROM `login` WHERE `account_id`= '" + getcharid(3) + "'", .@lip$); mes "Hello and welcome to the server."; mes "I will give you a Freebie depending on your class."; mes "Enjoy the server!."; if(!#Freebie && ( getd("$" + .@lip$ + "_ASD") == 0 )) { mes "Select a Freebie:"; next; switch(select("Swordsman:Magician:Archer:Acolyte:Merchant:Thief:Super Novice:Taekwon:Ninja")) { case 1: getitem 2229,1; //helm getitem 1117,1; //weapon getitem 2104,1; //shield getitem 2506,1; //manteau getitem 2406,1; //shoes getitem 2680,1; //acces 2 //Item for Swordsman break; case 2: getitem 5027,1; //helm getitem 2322,1; //armor getitem 1619,1; //weapon getitem 2121,1; //shield getitem 2504,1; //manteau getitem 2404,1; //shoes //Item for Magician break; case 3: getitem 2285,1; //helm getitem 1705,1; //weapon getitem 2506,1; //manteau getitem 2406,1; //shoes //Item for Archer break; case 4: getitem 2249,1; //helm getitem 1520,1; //weapon getitem 2104,1; //shield getitem 2504,1; //manteau getitem 2404,1; //shoes //Item for Acolyte break; case 5: getitem 1309,1; //weapon getitem 2104,1; //shield getitem 2506,1; //manteau getitem 2406,1; //shoes //Item for Merchant break; case 6: getitem 1208,2; //weapon getitem 2104,1; //shield getitem 2506,1; //manteau getitem 2406,1; //shoes //Item for Thief break; case 7: getitem 5125,1; //helm getitem 2355,1; //armor getitem 1108,1; //weapon getitem 1602,1; //weapon getitem 2116,1; //shield getitem 2521,1; //manteau getitem 2420,1; //shoes getitem 2628,1; //acces 2 //Item for Super Novice break; case 8: getitem 5122,1; //helm getitem 1564,1; //weapon getitem 1602,1; //weapon getitem 2104,1; //shield getitem 2536,1; //manteau getitem 2406,1; //shoes //Item for Taekwon break; case 9: getitem 2285,1; //helm getitem 2353,1; //shield getitem 13011,1; //weapon getitem 13302,1; //weapon getitem 2120,1; //shield getitem 2517,1; //manteau getitem 2418,1; //shoes getitem 2627,1; //acces //Item for Ninja break; } set #Freebie, 1; setd "$" + .@lip$ + "_ASD", getd("$" + .@lip$ + "_ASD") + 1; close; } OnInit: waitingroom "Freebies",0; end; } Quote Link to comment Share on other sites More sharing options...
Wolf Posted January 3, 2014 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 96 Reputation: 42 Joined: 11/15/11 Last Seen: May 19, 2023 Share Posted January 3, 2014 @Kido Could make an array for items, so would make a loop for getitem, and will optimize the script enough. Example: //Array OnInit: setarray .@swordsman_itens, 2229, 1117, 2104, 2506, 2406, 2680; setarray .@swordsman_qtd, 0, 0, 0, 0, 0, 0; // Should you require. end; //Looping for ( set .@i, 0; .@i < getarraysize(.@swordsman_itens); set .@i, .@i + 1) getitem .@swordsman_itens[.@i], .@swordsman_qtd[.@i]; break; Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted January 3, 2014 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted January 3, 2014 imo ... script optimization actually means make the emulator process at the least time as possible http://userscripts.org/guides/8 in this terms, kido's script actually already optimized what you actually did is making the script engine runs more script commands, thus process slower there are a few stuffs you'll learn that, for example getarraysize script command actually loops all the values in that array ... for-loop runs 3 goto count ... ugliest loop in rathena script engine ... if you can read source ... try imagine if your script convert into source language ... I think you mean, making the script more user friendly =D so people can just adjust the value from the setarray 1 Quote Link to comment Share on other sites More sharing options...
Wolf Posted January 4, 2014 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 96 Reputation: 42 Joined: 11/15/11 Last Seen: May 19, 2023 Share Posted January 4, 2014 Thanks for the tips, served me well, I like that -> http://userscripts.org/guides/8 Quote Link to comment Share on other sites More sharing options...
Kido Posted January 4, 2014 Group: Members Topic Count: 127 Topics Per Day: 0.03 Content Count: 1445 Reputation: 164 Joined: 08/17/13 Last Seen: July 11, 2019 Share Posted January 4, 2014 Hey guys. I want to give an item out to new players when they connect to the server however i only want it to be given out once per IP. Obviously this will need to save there IP in the SQL database and check if the IP has already been added and deny the player getting the item. Any suggestions on the best way to do this? hey pal did my script helped you? o: if you tell me ids i can do it for you, while teaching you how to lol pm me for this scriot support only cya Quote Link to comment Share on other sites More sharing options...
CursorX Posted February 3, 2014 Group: Members Topic Count: 66 Topics Per Day: 0.02 Content Count: 168 Reputation: 0 Joined: 11/20/13 Last Seen: November 23, 2021 Share Posted February 3, 2014 @all where i can find this in my sql database? setd "$" + .@lip$ + "_ASD", getd("$" + .@lip$ + "_ASD") + 1; i min how to enable theyr ip again to be able to use this npc? and about computer shop... if 1 player use this NPC.. other player on that computer shop can not use anymore this npc? Quote Link to comment Share on other sites More sharing options...
Question
Shindu
Hey guys.
I want to give an item out to new players when they connect to the server however i only want it to be given out once per IP.
Obviously this will need to save there IP in the SQL database and check if the IP has already been added and deny the player getting the item.
Any suggestions on the best way to do this?
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.