Corso-Project / Corso-RolePlay-GT-MP-

RP gamemode for GT-MP | Corso RP will no longer be updated for GT-MP.
MIT License
5 stars 2 forks source link

Server Error #2

Closed DukeX94 closed 6 years ago

DukeX94 commented 6 years ago

2018-01-07 23:33:10.2242 | Error | ScriptingEngine | EXCEPTION IN RESOURCE corso INSIDE SCRIPTENGINE player_event MySql.Data.MySqlClient.MySqlException (0x80004005): Field 'Access' doesn't have a default value bei MySql.Data.MySqlClient.MySqlStream.ReadPacket() bei MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId) bei MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId) bei MySql.Data.MySqlClient.MySqlDataReader.NextResult() bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) bei MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() bei MySQL.Database.Register_Account(Client player, String Social_ID, String Name, String Password) bei player_event.OnClientEventTrigger(Client player, String eventName, Object[] arguments) bei GrandTheftMultiplayer.Server.Models.ScriptingEngine.<>c__DisplayClass58_0.b__0() bei GrandTheftMultiplayer.Server.Models.ScriptingEngine.MainThreadLoop()

does not work for me... :(

ynhhoJ commented 6 years ago

Field 'Access' doesn't have a default value Can you show me the structure of your database?

ynhhoJ commented 6 years ago

Try to create a new table "accounts" with SQL in phpmyadmin:

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";

CREATE TABLE `accounts` (
  `UID` bigint(20) UNSIGNED NOT NULL,
  `Social_ID` varchar(16) NOT NULL,
  `Name` varchar(24) NOT NULL,
  `Password` varchar(256) NOT NULL,
  `Access` smallint(6) NOT NULL,
  `Cash` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `accounts`
  ADD UNIQUE KEY `UID` (`UID`);

ALTER TABLE `accounts`
  MODIFY `UID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
DukeX94 commented 6 years ago

I am currently at work ... As soon as I am at home I will send you the structure of my database and try out your variant.

DukeX94 commented 6 years ago

My Database Struct -->

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

CREATE TABLE accounts ( UID bigint(20) UNSIGNED NOT NULL, Social_ID varchar(16) NOT NULL, Name varchar(24) NOT NULL, Password varchar(256) NOT NULL, Access tinyint(4) NOT NULL, Cash int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE accounts ADD UNIQUE KEY UID (UID);

ALTER TABLE accounts MODIFY UID bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;

DukeX94 commented 6 years ago

I have now used their database structure and unfortunately still have the same error...

eXeGOODER commented 6 years ago

https://github.com/lJohhnyl/Corso-RolePlay-GT-MP-/blob/4cd65fac712b4732f3cdb4cccf73bf814530950d/mysql.cs#L48 if Access not null, need to fiil all values when inserting or use default values

DukeX94 commented 6 years ago

and the PlayerExist check does not work... :/

DukeX94 commented 6 years ago

If you delete the column "Access" then the register system but after disconnect we no longer recognized the account

ynhhoJ commented 6 years ago

@DukeX94 try to debug if playerExists work:

public static bool playerExists(Client player)
{
    connection = new MySqlConnection(myConnectionString);
    command = connection.CreateCommand();
    command.CommandText = "SELECT * FROM accounts";

    connection.Open();
    Reader = command.ExecuteReader();
    while (Reader.Read())
    {
        string name = Reader.GetString("Social_ID");
        if (name == player.name.ToString())
        {
                        func.Debug(true, "playerExists");
            Reader.Close();
            connection.Close();
            return true;
        }
    }
    func.Debug(false, "playerExists");
    connection.Close();
    return false;
}
DukeX94 commented 6 years ago

@lJohhnyl the debug does not work. I always get after registering always the register window

ynhhoJ commented 6 years ago

I have no such problem ... I'll try to fix it, thanks.

SheetTek commented 6 years ago

@lJohhnyl i have the problem too with login :(

Matetv commented 6 years ago

15:23:46.244 | Error | ScriptingEngine | EXCEPTION IN RESOURCE Corso-RolePlay INSIDE SCRIPTENGINE player_event MySql.Data.MySqlClient.MySqlException (0x80004005): Field 'Access' doesn't have a default value bei MySql.Data.MySqlClient.MySqlStream.ReadPacket() bei MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId) bei MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId) bei MySql.Data.MySqlClient.MySqlDataReader.NextResult() bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) bei MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() bei MySQL.Database.Register_Account(Client player, String Social_ID, String Name, String Password) bei player_event.OnClientEventTrigger(Client player, String eventName, Object[] arguments) bei GrandTheftMultiplayer.Server.Models.ScriptingEngine.<>c__DisplayClass58_0.b__0() bei GrandTheftMultiplayer.Server.Models.ScriptingEngine.MainThreadLoop()

sriwanich commented 6 years ago

i have the problem too with login too Please Help me image

2018-02-05 12:39:20.2437 | Error | ScriptingEngine | EXCEPTION IN RESOURCE CorsoRP INSIDE SCRIPTENGINE player_event MySql.Data.MySqlClient.MySqlException (0x80004005): Field 'id' doesn't have a default value at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() at MySQL.Database.Register_Account(Client player, String Social_ID, String Name, String Password) at player_event.OnClientEventTrigger(Client player, String eventName, Object[] arguments) at GrandTheftMultiplayer.Server.Models.ScriptingEngine.<>c__DisplayClass58_0.b__0() at GrandTheftMultiplayer.Server.Models.ScriptingEngine.MainThreadLoop()

ynhhoJ commented 6 years ago

@sriwanich , it's problem on ur side. Give ID a default value.

ynhhoJ commented 6 years ago

Try this:

ALTER TABLE accounts MODIFY COLUMN Access SMALLINT NOT NULL DEFAULT ''