bWolfie 138 Posted April 19, 2017 Hello! I'm guessing this has been done time and time again, but my search skills are newbie at best. I have this particular NPC which I only want to be allowed to use once per IP, and then restricted from then on. E.g. Player A buys Jellopy from NPC on Account 1. Player A logs out, logs into Account 2. Player A is denied buying Jellopy from NPC on Account 2. It would be as if the NPC took a record of the IP, and then once that IP was in the system, anyone carrying the IP could not buy the jellopy again. Quote Share this post Link to post Share on other sites
0 bWolfie 138 Posted April 20, 2017 (edited) Yes i understand all that. I want to make it so the NPC takes a record of their IP and block usage of that npc afterwards. I did some searching and found a guild pack script to use in what I'm after. From this thread: https://rathena.org/board/topic/94294-guild-pack-npc-giver-help-please/ 1. First script needs label to call in callsub: S_Check_IP: return query_sql("SELECT 1 FROM `guildpack` join login on login.`last_ip` = `guildpack`.`last_ip` where login.account_id = "+ getcharid(CHAR_ID_ACCOUNT), .@tmp); 2. Then define IP: .@myip$ = getcharip(); 3. Return true through callsub if IP exists in table: if (callsub(S_Check_IP)) { mes .@name$; mes("^616D7EIt seems I have already recorded your IP Address: ^ff0000" + .@myip$ + "^000000."); close; } 4. If does not exist, enter new entry to previously created table: query_sql("INSERT INTO `guildpack` VALUES (NULL," + getcharid(CHAR_ID_ACCOUNT) + ",'" + escape_sql(strcharinfo(PC_NAME)) + "','" + .@myip$ + "')"); All in all it looks something like this: https://pastebin.com/Lk8MHMBg This can be used for get_unique_id() too if you have gepard shield. My intention was to use this in a Lottery script, so people could only purchase one ticket per week. After each lottery draw, the table would be truncated so everybody can buy tickets again. Edited April 20, 2017 by True Zeal 2 PB&JJ and Quazi reacted to this Quote Share this post Link to post Share on other sites
0 Habilis 119 Posted April 19, 2017 (edited) It is not that complicated to change IP, just sayin... So, don't do serious stuff depending upon that logic... Edited April 19, 2017 by Habilis Quote Share this post Link to post Share on other sites
0 Ridley 295 Posted April 19, 2017 *getcharip({"<character name>"|<account id>|<char id>}) This function will return the IP address of the invoking character, or, if a player is specified, of that character. A blank string is returned if no player is attached. Examples: // Outputs IP address of attached player. mes("Your IP: " + getcharip()); // Outputs IP address of character "Silver". mes("Silver's IP: " + getcharip("Silver")); 1 Habilis reacted to this Quote Share this post Link to post Share on other sites
0 Like it~* 15 Posted April 22, 2017 Yes i understand all that. I want to make it so the NPC takes a record of their IP and block usage of that npc afterwards. I did some searching and found a guild pack script to use in what I'm after. From this thread: https://rathena.org/board/topic/94294-guild-pack-npc-giver-help-please/ 1. First script needs label to call in callsub: S_Check_IP: return query_sql("SELECT 1 FROM `guildpack` join login on login.`last_ip` = `guildpack`.`last_ip` where login.account_id = "+ getcharid(CHAR_ID_ACCOUNT), .@tmp); 2. Then define IP: .@myip$ = getcharip(); 3. Return true through callsub if IP exists in table: if (callsub(S_Check_IP)) { mes .@name$; mes("^616D7EIt seems I have already recorded your IP Address: ^ff0000" + .@myip$ + "^000000."); close; } 4. If does not exist, enter new entry to previously created table: query_sql("INSERT INTO `guildpack` VALUES (NULL," + getcharid(CHAR_ID_ACCOUNT) + ",'" + escape_sql(strcharinfo(PC_NAME)) + "','" + .@myip$ + "')"); All in all it looks something like this: https://pastebin.com/Lk8MHMBg This can be used for get_unique_id() too if you have gepard shield. My intention was to use this in a Lottery script, so people could only purchase one ticket per week. After each lottery draw, the table would be truncated so everybody can buy tickets again. To put in any script, would I just need to change the storage table, 'guildpack'? Give me an example, please. Quote Share this post Link to post Share on other sites
0 bWolfie 138 Posted April 22, 2017 Yes i understand all that. I want to make it so the NPC takes a record of their IP and block usage of that npc afterwards. I did some searching and found a guild pack script to use in what I'm after. From this thread: https://rathena.org/board/topic/94294-guild-pack-npc-giver-help-please/ 1. First script needs label to call in callsub: S_Check_IP: return query_sql("SELECT 1 FROM `guildpack` join login on login.`last_ip` = `guildpack`.`last_ip` where login.account_id = "+ getcharid(CHAR_ID_ACCOUNT), .@tmp); 2. Then define IP: .@myip$ = getcharip(); 3. Return true through callsub if IP exists in table: if (callsub(S_Check_IP)) { mes .@name$; mes("^616D7EIt seems I have already recorded your IP Address: ^ff0000" + .@myip$ + "^000000."); close; } 4. If does not exist, enter new entry to previously created table: query_sql("INSERT INTO `guildpack` VALUES (NULL," + getcharid(CHAR_ID_ACCOUNT) + ",'" + escape_sql(strcharinfo(PC_NAME)) + "','" + .@myip$ + "')"); All in all it looks something like this: https://pastebin.com/Lk8MHMBg This can be used for get_unique_id() too if you have gepard shield. My intention was to use this in a Lottery script, so people could only purchase one ticket per week. After each lottery draw, the table would be truncated so everybody can buy tickets again. To put in any script, would I just need to change the storage table, 'guildpack'? Give me an example, please. Yeah. In mine, I changed guildpack to lottery 1 Like it~* reacted to this Quote Share this post Link to post Share on other sites
Hello!
I'm guessing this has been done time and time again, but my search skills are newbie at best.
I have this particular NPC which I only want to be allowed to use once per IP, and then restricted from then on.
E.g.
Player A buys Jellopy from NPC on Account 1.
Player A logs out, logs into Account 2.
Player A is denied buying Jellopy from NPC on Account 2.
It would be as if the NPC took a record of the IP, and then once that IP was in the system, anyone carrying the IP could not buy the jellopy again.
Share this post
Link to post
Share on other sites