• 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!

Problem saving skills

clone

New Member
Joined
Jun 16, 2007
Messages
412
Reaction score
1
My server isnt saving skills and elf says to use triggers what does he mean? i imported teh database but what does he mean triggers? and im using mysql
 
Triggers is events you program into the database, and connects to a table, so that it executes a certain query upon certain events, for example that whenever you delete anything from your players table, it will delete all the items, skills, depotitems, spells and storage-variables connected to the character(s) being deleted

more info:

Triggers in MySQL 5.0
 
As suggested in another topic, run this query, and your database will start automatically create rows in the player_skills database whenever someone makes a new character, and thus the skills will be properly saved.

Code:
DELIMITER |

CREATE TRIGGER `oncreate_players`
AFTER INSERT
ON `players`
FOR EACH ROW
BEGIN
    INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES (NEW.`id`, 0, 10);
    INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES (NEW.`id`, 1, 10);
    INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES (NEW.`id`, 2, 10);
    INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES (NEW.`id`, 3, 10);
    INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES (NEW.`id`, 4, 10);
    INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES (NEW.`id`, 5, 10);
    INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES (NEW.`id`, 6, 10);
END|

DELIMITER ;
 
Code:
Błąd

zapytanie SQL:

CREATE TRIGGER `oncreate_players` AFTER INSERT ON `players`
FOR EACH
ROW
BEGIN
INSERT INTO `player_skills` ( `player_id` , `skillid` , `value` )
VALUES (
NEW.`id` , 0, 10
);

INSERT INTO `player_skills` ( `player_id` , `skillid` , `value` )
VALUES (
NEW.`id` , 1, 10
);

INSERT INTO `player_skills` ( `player_id` , `skillid` , `value` )
VALUES (
NEW.`id` , 2, 10
);

INSERT INTO `player_skills` ( `player_id` , `skillid` , `value` )
VALUES (
NEW.`id` , 3, 10
);

INSERT INTO `player_skills` ( `player_id` , `skillid` , `value` )
VALUES (
NEW.`id` , 4, 10
);

INSERT INTO `player_skills` ( `player_id` , `skillid` , `value` )
VALUES (
NEW.`id` , 5, 10
);

INSERT INTO `player_skills` ( `player_id` , `skillid` , `value` )
VALUES (
NEW.`id` , 6, 10
);

END

MySQL zwrócił komunikat: Dokumentacja
#1235 - This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
 
Back
Top