You could use getcharip() for that, then use some structure like this inside of a NPC:
// NPC Variables used:// .blockedips$ for storing the blocked IPs;// .ipunblocktime for storing the unblock time at the same index as .blockedips$// WARNING!! Up to 128 IP blocks at a time!//Little config you'll need:set .@blocktime, 60; // Block time (in seconds)set .@ip$, getcharip();if ( .@ip$ != "" ) { set .@array_size, getarraysize(.blockedips$); // Getting the array size for the calculations for ( set .@i, 0; .@i < .@array_size; set .@i, .@i + 1 ) { // Checking and removing timed out blocks and if the player is still blocked while ( .ipunblocktime[.@i] < gettimetick(2) && .@i < .@array_size ) { // Bulk removing timed out blocks if more than one in a row, caring not to go outside of the array deletearray .blockedips$[.@i],1; deletearray .ipunblocktime[.@i],1; set .@array_size, .@array_size - 1; // Correction for the array size } if ( .blockedips$[.@i] == .@ip$ ) { // No need to check if outside the array since these values will be "" and forcefully .@i <= 127. Also no need to check if outdated since it should have been removed before set .@blockedtime, gettimetick(2) - .ipunblocktime[.@i]; // Remaining time in seconds of the block // break; // Uncomment if you don't want the loop to finish checking for timed out blocks after finding the player if it's on the list } } if ( .@blockedtime ) { mes "Oh, your IP is still blocked."; mes "You still can't use me for the next " + .@blockedtime + " seconds."; close; } mes "OK, I'll give you an apple and block you for " + .@blocktime + " seconds."; close2; getitem 512,1; set .blockedips$[.@array_size],.@ip$; set .ipunblocktime[.@array_size], gettimetick(2) + .@blocktime; end;}
You can modify it the way you want to accomplish your needs.