Create a table in your logs schema with this query:
CREATE TABLE IF NOT EXISTS `freebielog` (
`id` int(11) unsigned NOT NULL auto_increment,
`account` int(11) NOT NULL,
`ip_address` varchar(100) NOT NULL,
`timestamp` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
After giving freebies, add this code before that section of your script ends:
// Log IP address
query_logsql "INSERT INTO `freebielog` VALUES(NULL, '"+ getcharid(3) +"', '"+ getcharip(strcharinfo(0)) +"', NOW())";
To check if someone's already received freebies, add this code beforehand:
// Search for IP address
query_logsql "SELECT `ip_address` FROM `freebielog` WHERE `ip_address` = '"+ getcharip(strcharinfo(0)) +"'", .@char_ip$;
// Check if IP address matches search query
if (getcharip(strcharinfo(0)) == .@char_ip$) {
// Error message or script
mes "Sorry, you've already received freebies.";
close;
}
You can replace the error message with your own, if you'd like.