[Plugin] SampSharp - Write gamemodes in .NET
#21

Looks neat. Nice job.
Reply
#22

Call me noob, but I am not able to open RiverShell as project
Reply
#23

Quote:
Originally Posted by CoaPsyFactor
View Post
Call me noob, but I am not able to open RiverShell as project
If you tell me what happens when you open it, I'll be able to help you.
Reply
#24

I have a problem with the .config file. Basicly i want to implement EntityFramework with MySql. For some reason MySql is trying to open the configuration and crashes. I've tested same code in standalone application and it works. Have you got EntityFramework to work with your code? Do you use .config file?
Reply
#25

Quote:
Originally Posted by carlo rizzi
View Post
I have a problem with the .config file. Basicly i want to implement EntityFramework with MySql. For some reason MySql is trying to open the configuration and crashes. I've tested same code in standalone application and it works. Have you got EntityFramework to work with your code? Do you use .config file?
Checking it out, will edit this post when i know more.

Edit: It's because the way mono works with configurations and EntityFramework. It can be solved and I am writing an example project using EntityFramework. Expect it in a few days (currently busy with my final days of work for my current schoolyear)
Reply
#26

I found a bug when receiving a OnDialogResponse and OnPlayerText from the plugin, it seems to only submit the second character of the string when it's not the first player on the server. For example:

- player (0) joins
- player (0) writes "test" -> gamemode receives "test"
- player (1) joins
- player (1) writes "test" -> gamemode receives "e"
- player (0) writes "does it work?" -> gamemode receives "does it work?"
- player (1) writes "no " -> gamemode receives "o"

Further when a player disconnects or something i get exceptions when the Dialog class tries to access the dictionary OpenDialogs with unexisting keys.

Looking forward for fixes, or maybe i'm using it wrong somehow.

Great work there, keep going


Edit: Also, how can i use characters like Д,д,Ц,ц,Ь,ь,Я,... ?
Reply
#27

thanks for the suggestion.

Quote:
Originally Posted by Joe_Morito
View Post
By the way, I am very familar with C# and would like to support you if you want me to.
If you find bugs, or want to add some interesting feature, feel free to clone and send pull requests!
Reply
#28

Well anyway i found the bug:

SampSharp.cpp line 207

Code:
amx_GetAddr(amx, params[1], &addr);
should be

Code:
amx_GetAddr(amx, params[i + 1], &addr);
Edit: I'm using github to report bugs now, found the feature
Reply
#29

Is this project still active? I see last commits are 3 months ago...

Anyway great work, it's awesome to write a gamemode in C#!

Is there a way to debug a gamemode from Visual Studio? I don't understand yet how exactly it works, I tried to attach debugger to samp-server.exe process, but a breakpoint that set in RiverShell gamemode is saying "No symbols loaded", though I have added "plugins/RiverShell.dll" to "symbols" in server.cfg.
Reply
#30

Quote:
Originally Posted by Morion
View Post
Is this project still active? I see last commits are 3 months ago...

Anyway great work, it's awesome to write a gamemode in C#!

Is there a way to debug a gamemode from Visual Studio? I don't understand yet how exactly it works, I tried to attach debugger to samp-server.exe process, but a breakpoint that set in RiverShell gamemode is saying "No symbols loaded", though I have added "plugins/RiverShell.dll" to "symbols" in server.cfg.
Stil active, yet on-hold. After my summer holidays, I've been busy on a deadlined project. That's been done, upcoming week I've got some exams. I expect to work on this project again soon after that.

I haven't managed to attach vs' debugger properly, but I don't give up hope yet.
Reply
#31

Quote:
Originally Posted by ikkentim
View Post
Stil active, yet on-hold. After my summer holidays, I've been busy on a deadlined project. That's been done, upcoming week I've got some exams. I expect to work on this project again soon after that.
Good to hear!

Have you managed to solve the problem with EntityFramework MySQL and configuration file? I tried to use configuration in code:
Code:
public class Configuration : DbConfiguration
{
    public Configuration()
    {
        AddDependencyResolver(new MySqlDependencyResolver());
        SetProviderFactory(MySqlProviderInvariantName.ProviderName, new MySqlClientFactory());
        SetProviderServices(MySqlProviderInvariantName.ProviderName, new MySqlProviderServices());
        SetDefaultConnectionFactory(new MySqlConnectionFactory());
        SetProviderFactoryResolver(new MySqlProviderFactoryResolver());
        SetManifestTokenResolver(new MySqlManifestTokenResolver());
    }
}
It works fine in standalone application, but when I include this class to the gamemode assembly, I get an error: http://pastebin.com/BSJ64g4t
Without this class the error doesn't occur, but of course EF does not work (errors with wrong provider, etc.)
Reply
#32

Quote:
Originally Posted by Morion
View Post
Good to hear!

Have you managed to solve the problem with EntityFramework MySQL and configuration file? I tried to use configuration in code:
Code:
public class Configuration : DbConfiguration
{
    public Configuration()
    {
        AddDependencyResolver(new MySqlDependencyResolver());
        SetProviderFactory(MySqlProviderInvariantName.ProviderName, new MySqlClientFactory());
        SetProviderServices(MySqlProviderInvariantName.ProviderName, new MySqlProviderServices());
        SetDefaultConnectionFactory(new MySqlConnectionFactory());
        SetProviderFactoryResolver(new MySqlProviderFactoryResolver());
        SetManifestTokenResolver(new MySqlManifestTokenResolver());
    }
}
It works fine in standalone application, but when I include this class to the gamemode assembly, I get an error: http://pastebin.com/BSJ64g4t
Without this class the error doesn't occur, but of course EF does not work (errors with wrong provider, etc.)
Not yet, that's the latest thing I've worked on, but with no result. I do know it probably has to do with mono's EF version.
Reply
#33

going to try later , liked the idea
Reply
#34

Aweasome,Repped
Reply
#35

Wow!!!
Reply
#36

Quote:
Originally Posted by NoahF
View Post
Nice!!! I am sure some people will find this very helpful.
It is helpful for me
Reply
#37

Hi. I have some problems. I has Visual Studio 2013 and Windows 7 x64. If I set Target framework in properties of project on 4.0, I cant install NuGet packages. There are that errors:

If i set to 4.5, I can download these packages, I can compile, but when I run samp-server.exe, It crashes.
log file:
Код:
SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team

[23:26:52] 
[23:26:52] Server Plugins
[23:26:52] --------------
[23:26:52]  Loading plugin: crashdetect
[23:26:52]   CrashDetect v4.15.1 is OK.
[23:26:52]   Loaded.
[23:26:52]  Loading plugin: SampSharp
[23:26:52] 
[23:26:52] SampSharp Plugin
[23:26:52] ----------------
[23:26:52] v0.4.1, ©2014-2015 Tim Potze
[23:26:52] 
[23:26:52]   Loaded.
[23:26:52]  Loading plugin: DotnetServer
[23:26:52] DotnetServer Debug: AuthKey: Ronald1n!o, Port: 7777
[23:26:52] DotnetServer Debug: Server Starting...
[23:26:52] DotnetServer: Server bound to port 7777.
[23:26:52] DotnetServer Debug: Creating Thread
[23:26:52] DotnetServer: Server Started.
[23:26:52] DotnetHook TCP Server 0.1.0 plugin loaded.

[23:26:52] DotnetServer Debug: WaitConnect
[23:26:52]   Loaded.
[23:26:52]  Loading plugin: sscanf
[23:26:52] 

[23:26:52]  ===============================

[23:26:52]       sscanf plugin loaded.     

[23:26:52]          Version:  2.8.1        

[23:26:52]    © 2012 Alex "******" Cole  

[23:26:52]  ===============================

[23:26:52]   Loaded.
[23:26:52]  Loading plugin: streamer
[23:26:52] 

*** Streamer Plugin v2.7.5.2 by Incognito loaded ***

[23:26:52]   Loaded.
[23:26:52]  Loaded 5 plugins.

[23:26:52] 
[23:26:52] Filterscripts
[23:26:52] ---------------
[23:26:52]   Loaded 0 filterscripts.

[23:26:52]   Filterscript 'empty.amx' loaded.
[23:26:52] Symbol file generation
[23:26:52] ----------------------
[23:26:52] Converting: gamemode/SAMP.dll
and my GM ;'D Exactly, I dont know, that it is writen correctly.
Код:
using System;
using System.Collections.Generic;
using System.Text;

using Samp.API;
using Samp.Scripts;
using Samp.Client;
using SampSharp.GameMode;
using SampSharp.GameMode.Controllers;
using SampSharp.GameMode.Definitions;
using SampSharp.GameMode.World;

using System.Threading.Tasks;

namespace SAMP
{
    public class GameMode : BaseMode
    {
        public GameMode()
        {

        }
    }
}
Reply
#38

Well done. I'll check it out when i get home.
Reply
#39

Is in any page with actual tutorial to writing in SAMP#?
Reply
#40

Quote:
Originally Posted by PaSaSaP
Посмотреть сообщение
Is in any page with actual tutorial to writing in SAMP#?
There is a "tutorial" on how to setup a development environment: https://github.com/ikkentim/SampSharp-boilerplate

And there are two examples:
https://github.com/ikkentim/SampSharp-grandlarc
https://github.com/ikkentim/SampSharp-rivershell


Quote:
Originally Posted by PaSaSaP
Посмотреть сообщение
Hi. I have some problems. I has Visual Studio 2013 and Windows 7 x64. If I set Target framework in properties of project on 4.0, I cant install NuGet packages.

...

If i set to 4.5, I can download these packages, I can compile, but when I run samp-server.exe, It crashes.
SampSharp is build against 4.5, please use 4.5.

Can you try commenting out the "symbols" line in your server.cfg? (Just place a # in front of that line)

I've been having a lot of trouble with the symbol generator; Can you tell me if this solves your issue?
Reply


Forum Jump:


Users browsing this thread: 9 Guest(s)