• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

A DECENT way to make powergamers script

Nostradamus

Member
Joined
Jun 2, 2007
Messages
219
Reaction score
6
Content removed, i don't want to share my knowleagement with a retarded staff.
 
Last edited:
PHP:
DROP TRIGGER IF EXISTS `onupdate_players`;
DELIMITER //

CREATE TRIGGER `onupdate_players` AFTER UPDATE ON `players`
 FOR EACH ROW BEGIN 
    DECLARE expGain BIGINT UNSIGNED; 
    SET expGain = NEW.`experience` - OLD.`experience`; 
     
    IF (expGain <> 0) THEN 
        INSERT INTO `player_experience` VALUES (OLD.`id`, NEW.`lastlogout`, (NEW.`lastlogout` - NEW.`lastlogin`), expGain); 
    END IF; 
END
//
DELIMITER ;

CREATE TABLE `player_experience` (
`player_id` INT( 10 ) NOT NULL ,
`lastlogout` INT( 10 ) NOT NULL ,
`period` INT( 10 ) NOT NULL ,
`experience` BIGINT NOT NULL,
FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) ON DELETE CASCADE
) ENGINE = InnoDB;
Working on phpMyAdmin x)
 
Back
Top