Jump to content

Recommended Posts

Posted (edited)
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Das System kann die angegebene Datei nicht finden.
   at EntityFrameworkServicesBuilder Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.TryAddCoreServices()
   at bool Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.ApplyServices(IDbContextOptions options, ServiceCollection services)
   at IServiceProvider Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, bool providerRequired)+(long k) => { }
   at TValue System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
   at IServiceProvider Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, bool providerRequired)
   at new Microsoft.EntityFrameworkCore.DbContext(DbContextOptions options)
   at new Test.DBCtx()
   at void Test.Main.OnResourceStart()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at GTANetworkInternals.ScriptingEngine.InvokeVoidMethod(String method, Object[] args)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at GTANetworkInternals.EventHandler.ParseEx(Event _event, ScriptingEngine engine, Object[] arguments)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at GTANetworkInternals.GameServer.StartResource(String resourceName, String parent)

I got this error

Edited by Arthason
Posted
58 minutes ago, Arthason said:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Das System kann die angegebene Datei nicht finden.
   at EntityFrameworkServicesBuilder Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.TryAddCoreServices()
   at bool Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.ApplyServices(IDbContextOptions options, ServiceCollection services)
   at IServiceProvider Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, bool providerRequired)+(long k) => { }
   at TValue System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
   at IServiceProvider Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd(IDbContextOptions options, bool providerRequired)
   at new Microsoft.EntityFrameworkCore.DbContext(DbContextOptions options)
   at new Test.DBCtx()
   at void Test.Main.OnResourceStart()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at GTANetworkInternals.ScriptingEngine.InvokeVoidMethod(String method, Object[] args)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at GTANetworkInternals.EventHandler.ParseEx(Event _event, ScriptingEngine engine, Object[] arguments)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at GTANetworkInternals.GameServer.StartResource(String resourceName, String parent)

I got this error

Are you sure you followed every step carefully? 


Btw, I will update this tutorial this week per Adam's suggestion. Haven't had the time to do it recently

Posted
vor 6 Stunden schrieb xForcer:

Are you sure you followed every step carefully? 


Btw, I will update this tutorial this week per Adam's suggestion. Haven't had the time to do it recently

Yes. The NuGet packages where updated, it could be a new dependency

Posted

How get from database for example money?  Is any special functions for get params from db? Or I must use GetEntitySharedData?

 

Posted
1 hour ago, Astroo said:

How get from database for example money?  Is any special functions for get params from db? Or I must use GetEntitySharedData?

 

Use int to store and load money to/from database. You can store the money into C# properties per player or use SetEntityData.

You can find better tutorials for that

  • 5 weeks later...
Posted (edited)
On 9/10/2019 at 12:30 AM, yhyhydryx said:

Hi. Is possibility to connect with microsoft sql database? 

Yes, you just have to use a different provider

Finally updated the code. If there is anything wrong, let me know so I can quickly fix it.

I could eventually add repositories and other advanced stuff, but I would like to keep it simple and effective

Edited by xForcer
Posted (edited)

One Question 

I was trying your Tutorial but if i want to start my Server it says

"The type or namespace name 'Key' could not be found (are you missing a using directive or an assembly reference?"

So i added "<assembly ref="../../runtime/System.ComponentModel.DataAnnotations.dll" />" in my meta.xml but still the same error 

what are im doing wrong?

Edit: Here the file with the Error 

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace wsgRoleplay.Player
{
    public class PlayerInfo
    {
        [Key]
        public int UID { get; set; }
        public string _uName { get; set; }

        public string _uPassword { get; set; }

        public int _uMoney { get; set; }

        public int _uJob { get; set; }

        public int _uNJob { get; set; }

        public int _uGang { get; set; }

        public int _uSFrak { get; set; }
    }
}

 

Edited by bulllox
forgot something
Posted
3 hours ago, bulllox said:

One Question 

I was trying your Tutorial but if i want to start my Server it says

"The type or namespace name 'Key' could not be found (are you missing a using directive or an assembly reference?"

So i added "<assembly ref="../../runtime/System.ComponentModel.DataAnnotations.dll" />" in my meta.xml but still the same error 

what are im doing wrong?

Edit: Here the file with the Error 


using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace wsgRoleplay.Player
{
    public class PlayerInfo
    {
        [Key]
        public int UID { get; set; }
        public string _uName { get; set; }

        public string _uPassword { get; set; }

        public int _uMoney { get; set; }

        public int _uJob { get; set; }

        public int _uNJob { get; set; }

        public int _uGang { get; set; }

        public int _uSFrak { get; set; }
    }
}

 

Did you build the solution and copied every dll needed to the runtime folder as the tutorial says?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...