Re: SampSharp - Write gamemodes in .NET -
corne - 21.11.2018
Considering to use this seeing as I've started to use C# and ASP.NET more often lately. Most of the includes and plugins I use can be replaced with something else in C#, although as far as I know there's no replacement for ColAndreas. Will you implement support for ColAndreas?
EDIT: 0.3.DL support would also be nice
Re: SampSharp - Write gamemodes in .NET -
Banditul18 - 21.11.2018
Quote:
Originally Posted by corne
Considering to use this seeing as I've started to use C# and ASP.NET more often lately. Most of the includes and plugins I use can be replaced with something else in C#, although as far as I know there's no replacement for ColAndreas. Will you implement support for ColAndreas?
EDIT: 0.3.DL support would also be nice
|
As far i know and as ikkentim said, its easy to make a wraper for it(call his functions and what not). Best bet is to join the slack chat as him
Re: SampSharp - Write gamemodes in .NET -
Geese - 16.02.2019
When I try to build my server, it creates a .dll file correctly but when loading samp-server.exe; it just loads a default template without any of my console writelines. I believe it is the cfg file I am screwing up but I have messed around with it and done most configurations but it still continues with the template server
Please can I get some advice on how to setup my server.cfg.
Thanks.
Re: SampSharp - Write gamemodes in .NET -
RenanMsV - 18.02.2019
I just tried this. Made my gamemode.
If I got it right, to make it to work I need to:
Open samp_server.exe. <= this will open the server and listen for a gamemode to connect
Run this command in the windows command prompt : dotnet mygamemode.dll <= this will connect my gamemode dll to the server and start the gamemode (need to have all dll dependencies and the MyGameMode.runtimeconfig.json file in the same folder or it will just give an error and not start)
So thats it?
Do I really need to run this dotnet command in the cmd or theres any config in the server.cfg to auto-run that?
Thanks anyway. Great project!
Re: SampSharp - Write gamemodes in .NET -
ikkentim - 18.02.2019
Sorry on phone rn so can’t do more than paste this
(...) hosting a game mode inside the sa-mp server process. If you wish to use this, use the following instructions:
- Download the x86 .NET Core binaries:
https://www.microsoft.com/net/downlo...s-x86-binaries
- Compile your game mode with at least SampSharp.Core version 0.8.0-alpha8
- Update the SampSharp plugin to at least 0.8.0-alpha8
- In your server.cfg, set `coreclr` to `path/to/downloaded/dotnet-runtime-2.1.1-win-x86/shared/Microsoft.NETCore.App/2.1.1`
- In your server.cfg, set `gamemode` to `path/to/your/GameMode.dll`
Re: SampSharp - Write gamemodes in .NET -
RenanMsV - 18.02.2019
Great!
Its working.
Side note: I tried with NETCore 2.1.8 (was installed by visual studio 2017) and it didn't work. Then I downloaded the 2.1.1 and its working fine.
Thanks
Re: SampSharp - Write gamemodes in .NET -
ikkentim - 18.02.2019
Please note you need the 32 bit version of .net core (since samp is 32 bit). VS probably installed 64 bits.
Re: SampSharp - Write gamemodes in .NET -
RenanMsV - 18.02.2019
Its me again. Sorry.
But how to I show a Dialog ? or a Textdraw? theres no info in the docs about it.
Edit found it for dialog:
Still figuring out how to handle the response.
Edit2 got it working, is this the right way?
PHP код:
[Command("help",Shortcut = "h")]
public static bool help(BasePlayer _sender)
{
_sender.SendClientMessage("Opening help dialog");
MessageDialog diag = new MessageDialog($"This dialog caption with your name: {_sender.Name}", "This info Line 1\nNow its the line2\nThis is a really really really long giga max3turbo string", "Accept", "Reject");
diag.Response += HelpDiagResponse;
diag.Show(_sender);
return true;
}
private static void HelpDiagResponse(object sender, DialogResponseEventArgs e)
{
BasePlayer _sender = e.Player;
_sender.SendClientMessage($"Dialog response: Button: {e.DialogButton} , DialogId: {e.DialogId} , e.Player.Name : {e.Player.Name} , ListItem: {e.ListItem} , InputText: {e.InputText} .");
}
This is what i get as response
Код HTML:
Dialog response : Button : Right , DialogId: 10000 , e.Player.Name : MyName , ListItem: -1 , InputText
------
Another question, when the user miss an argument to the command it will show him an error message "Usage /kick [player]", but what if i want to change the language of this error message?
Re: SampSharp - Write gamemodes in .NET -
RenanMsV - 23.02.2019
Here is the Bare gamemode from Samp ported to SampSharp 0.8 if anyone want to use as a starting point.
https://github.com/RenanMsV/SampSharp-bare
Re: SampSharp - Write gamemodes in .NET -
ikkentim - 24.02.2019
Quote:
Originally Posted by RenanMsV
Another question, when the user miss an argument to the command it will show him an error message "Usage /kick [player]", but what if i want to change the language of this error message?
|
You might want to join the Slack chat if you want some quicker responses
In the command attribute you can specify the UsageMessage
Re: SampSharp - Write gamemodes in .NET -
m3shys - 28.02.2019
What's the performance hit from this? also can you update main-thread to include that information?
Re: SampSharp - Write gamemodes in .NET -
ikkentim - 28.02.2019
The performance according to my last bench was better than Pawn. I don’t know what you mean with your second wuestion, sorry.
I’ll try and create some benchmarking scripts for new benchmarks soon.
Re: SampSharp - Write gamemodes in .NET -
Crayder - 28.02.2019
I can't seem to figure this out again... My old version works fine still but when I try to make a new server I have absolutely no luck. I've even tried using the grandlarc example, it doesn't actually load the gamemode. The plugin loads fine and the blank gamemode is loading as well as the two filterscripts. Not sure what I'm doing wrong... :thinking:
EDIT: Like, not even TestMode in the SampSharp solution is running the actual gamemode. The mode is generated, but never seems to give any output when running the server.
Re: SampSharp - Write gamemodes in .NET -
Banditul18 - 01.03.2019
Can you show the server.cfg/serverlog?
This is what i made(not the best or good thing):
https://github.com/Banditul/SAMP-BasicGamemode
But should give a somekind of example
Re: SampSharp - Write gamemodes in .NET -
Crayder - 01.03.2019
Quote:
Originally Posted by Banditul18
|
log:
Code:
----------
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3.DL-R1, ©2005-2018 SA-MP Team
[22:15:09]
[22:15:09] Server Plugins
[22:15:09] --------------
[22:15:09] Loading plugin: SampSharp
[22:15:09] Loaded.
[22:15:09] Loaded 1 plugins.
[22:15:09]
[22:15:09] Filterscripts
[22:15:09] ---------------
[22:15:09] Loaded 0 filterscripts.
[22:15:09] Filterscript 'empty.amx' loaded.
[22:15:09]
[22:15:09] SampSharp Plugin
[22:15:09] ----------------
[22:15:09] v0.8.0-alpha10, ©2014-2018 Tim Potze
[22:15:09]
[22:15:09] Filterscript 'intermission.amx' loaded.
[22:15:09] [SampSharp:INFO] Creating pipe \\.\pipe\SampSharp...
[22:15:09] [SampSharp:INFO] Pipe created.
[22:15:09] Number of vehicle models: 0
[22:17:13] [connection] incoming connection: 127.0.0.1:65163 id: 0
[22:17:13] [join] Crayder has joined the server (0:127.0.0.1)
[22:38:23] [part] Crayder has left the server (0:1)
cfg:
Code:
rcon_password mysecurepassword
hostname SA-MP 0.3 Server
gamemode0 empty 1
logtimeformat [%H:%M:%S]
language English
plugins SampSharp
I'm going to take a look at yours though, is it SampSharp 0.8.0?
Re: SampSharp - Write gamemodes in .NET -
Banditul18 - 01.03.2019
Yes. Its 0.8.0 (or atleast beta 10)
You need the net core runtime:
https://github.com/ikkentim/SampSharp/issues/298 as far i see