Znote / ZnoteAAC

Developement repository for the Znote AAC project. A website portal to represent and manage your Open Tibia server.
MIT License
143 stars 127 forks source link

Guild Disband #488

Open BoozieII opened 2 years ago

BoozieII commented 2 years ago

I have an issue on my server when a player disbands their guild on the website, it does in fact delete the guild from the website, however it remains on the database. This prevents the same player from creating another guild.

Throws this error: string(105) "INSERT INTO guilds (name, ownerid, creationdata, motd) VALUES ('test', '91', '1629862047', '');" (query - SQL error) Type: voidQuery (voidQuery is used for update, insert or delete from database)

Duplicate entry '91' for key 'guilds_owner_unique'

Or if its the same guild name it will say guild with that name already exists

I think this is the code that does not properly work in guilds.php

if (!$online) { // Then remove guild rank from every player. if ($config['ServerEngine'] !== 'TFS_10') foreach ($members as $member) guild_player_leave(user_character_id($member['name'])); else foreach ($members as $member) guild_player_leave_10(user_character_id($member['name']));

               // Remove all guild invitations to this guild

if ($inv_count > 0) guild_remove_invites($gidd);

                 // Then remove the guild itself.

guild_delete($gidd); header('Location: success.php'); exit(); } else echo 'All members must be offline to disband the guild.';