This operation scans every player and inserts default rows where skills are missing.
fetchAll("SELECT `id` FROM `players`;"); if ($players !== false) { $Splayers = count($players); foreach ($players as $char) { // Check if player have skills $skills = db()->fetchOne("SELECT `value` FROM `player_skills` WHERE `player_id` = ? AND `skillid` = 2 LIMIT 1;", [$char['id']]); // If he dont have any skills if ($skills === false) { $Sfixed++; // Loop through every skill id and give him default skills. $rows = array(); $params = array(); for ($i = 0; $i < 7; $i++) { $rows[] = '(?, ?, 10, 0)'; $params[] = $char['id']; $params[] = $i; } db()->execute( "INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES " . implode(', ', $rows) . ";", $params ); } else $Salready++; } acp_log('maintenance.repair_skills', 'ALL', ['players' => $Splayers, 'repaired' => $Sfixed]); ?>Players detected:
Players already fixed:
Repaired player accounts:
Something went wrong.