SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 06/05/2014, 08:53 PM   #1
ikkentim
High-roller
 
ikkentim's Avatar
 
Join Date: Jan 2010
Location: Kampen, The Netherlands
Posts: 1,069
Reputation: 176
Default SampSharp - Write gamemodes in .NET



SampSharp





SampSharp is a plugin and library which allows you to write SA-MP gamemodes in C#, VB or any other .NET language. The plugin works both on Linux and Windows. The library contains various classes for every type of resource available in SA-MP (players, vehicles, textdraws, etc). Aside from this wrapper around native functions, the library also contains a good structure to build your gamemode on.

SampSharp provides wrappers for existing plugins (currently only the streamer plugin) and a number of resources for writing wrappers for existing plugins. There are also a small number of example gamemodes available.

Feedback and suggestions are highly appreciated!
If you have any questions, please leave a message below.

The following snippet shows how easy it is to create a command which spawns a vehicle:
PHP Code:
[Command("spawn")]
public static 
void VehicleCommand(BasePlayer playerVehicleModelType model)
{
    
Console.WriteLine($"Spawning a {model} for {player.Name}");
    var 
vehicle GtaVehicle.Create(modelplayer.Position + new Vector3(000.5f), player.Rotation.Z);
    
player.PutInVehicle(vehicle);
    
player.SendClientMessage(Color.GreenYellow, $"You have spawned a {model}!");

Download SampSharp
https://github.com/ikkentim/SampSharp/releases

Current stable version:


Current unstable version:


Documentation
http://sampsharp.timpotze.nl

Notice: Documentation is currently lacking lots of vital information, please take a look around the examples/source for more detailed information. As soon as I have time I'll focus on improving the documentation.

Source code
https://www.github.com/ikkentim/SampSharp
__________________
Greetings,
Tim Potze

Projects
GAMEDEV | Part-time developer working on Parkitect. | Steampage
LSRES | A SA:MP server from the past, and hopefully, back in the future.
SampSharp | Plugin for writing SA:MP gamemodes in C#. | Topic Website Github
SanMap | San Andreas in Google Maps! | Topic Github Sample

Last edited by ikkentim; 25/02/2017 at 09:42 PM.
ikkentim is offline   Reply With Quote
Old 06/05/2014, 09:09 PM   #2
NoahF
Gangsta
 
NoahF's Avatar
 
Join Date: Jul 2012
Location: Connecticut, USA.
Posts: 863
Reputation: 37
Default Re: SampSharp - Write gamemodes in .NET

Nice!!! I am sure some people will find this very helpful.
NoahF is offline   Reply With Quote
Old 07/11/2014, 04:25 AM   #3
Arastair
Gangsta
 
Join Date: Jun 2014
Posts: 874
Reputation: 49
Default Re: SampSharp - Write gamemodes in .NET

Quote:
Originally Posted by NoahF View Post
Nice!!! I am sure some people will find this very helpful.
It is helpful for me
__________________
"War does not determine who is right... only who is left"
Arastair is offline   Reply With Quote
Old 09/11/2014, 08:12 PM   #4
Dr0n
Little Clucker
 
Join Date: Nov 2014
Posts: 3
Reputation: 0
Question Re: SampSharp - Write gamemodes in .NET

Hello guys,
I've got a little problem with SendClientMessage. When I want to send letters "č,ř" etc., server shows it like "Y,...". Have anyone some idea how to solve it?
Dr0n is offline   Reply With Quote
Old 09/11/2014, 08:21 PM   #5
ikkentim
High-roller
 
ikkentim's Avatar
 
Join Date: Jan 2010
Location: Kampen, The Netherlands
Posts: 1,069
Reputation: 176
Default Re: SampSharp - Write gamemodes in .NET

Quote:
Originally Posted by Dr0n View Post
Hello guys,
I've got a little problem with SendClientMessage. When I want to send letters "č,ř" etc., server shows it like "Y,...". Have anyone some idea how to solve it?
What charset is this? Cyrillic or Greek or something? There is currently an open issue on github about the plugin not supporting Cyrillic characters.

I am willing to fix it, but I can't get the characters to display in my client when I use pawn's SendClientMessage. It just shows some jibberish. If someone can explain how I change sa-mp's charset, then I can fix it.
__________________
Greetings,
Tim Potze

Projects
GAMEDEV | Part-time developer working on Parkitect. | Steampage
LSRES | A SA:MP server from the past, and hopefully, back in the future.
SampSharp | Plugin for writing SA:MP gamemodes in C#. | Topic Website Github
SanMap | San Andreas in Google Maps! | Topic Github Sample
ikkentim is offline   Reply With Quote
Old 09/11/2014, 08:29 PM   #6
Dr0n
Little Clucker
 
Join Date: Nov 2014
Posts: 3
Reputation: 0
Default Re: SampSharp - Write gamemodes in .NET

Quote:
Originally Posted by ikkentim View Post
What charset is this? Cyrillic or Greek or something? There is currently an open issue on github about the plugin not supporting Cyrillic characters.

I am willing to fix it, but I can't get the characters to display in my client when I use pawn's SendClientMessage. It just shows some jibberish. If someone can explain how I change sa-mp's charset, then I can fix it.
These letters are from czech language ( UTF-8 ).
Game mode written in pawno shows them properly.
Dr0n is offline   Reply With Quote
Old 06/05/2014, 09:36 PM   #7
Gigi-The-Beast
Huge Clucker
 
Join Date: Jan 2010
Posts: 289
Reputation: 25
Default Re: SampSharp - Write gamemodes in .NET

Nice effort, hope it doesn't get abbandoned as other similar projects.
I am not expirienced with c# but I want to learn it, so is there a way to use current plugins with this?
As I prefer to use mysql,streamer,sscanf plugins and some others?
Gigi-The-Beast is offline   Reply With Quote
Old 06/05/2014, 09:43 PM   #8
ikkentim
High-roller
 
ikkentim's Avatar
 
Join Date: Jan 2010
Location: Kampen, The Netherlands
Posts: 1,069
Reputation: 176
Default Re: SampSharp - Write gamemodes in .NET

Quote:
Originally Posted by Gigi-The-Beast View Post
Nice effort, hope it doesn't get abbandoned as other similar projects.
I'll maintain it as long as possible
Quote:
Originally Posted by Gigi-The-Beast View Post
I am not expirienced with c# but I want to learn it, so is there a way to use current plugins with this?
Not the way the plugin works now. However, you shouldn't need to.

Quote:
Originally Posted by Gigi-The-Beast View Post
As I prefer to use mysql,streamer,sscanf plugins and some others?
Mysql: you can simply use the c# library from oracle, or, better yet, use entityframework. One great .net library, google it and you'll love it.
Streamer: i'm going to implement the most important features in the library.
Sscanf: if you are using it to process commands, sampsharp has something better, check the commandstest class in the testmode project. I'll soon document it and make it more awesome.
__________________
Greetings,
Tim Potze

Projects
GAMEDEV | Part-time developer working on Parkitect. | Steampage
LSRES | A SA:MP server from the past, and hopefully, back in the future.
SampSharp | Plugin for writing SA:MP gamemodes in C#. | Topic Website Github
SanMap | San Andreas in Google Maps! | Topic Github Sample
ikkentim is offline   Reply With Quote
Old 06/05/2014, 09:59 PM   #9
Gigi-The-Beast
Huge Clucker
 
Join Date: Jan 2010
Posts: 289
Reputation: 25
Default Re: SampSharp - Write gamemodes in .NET

Okay, thank you for your reply.
But would you be able to implement a way to allow using the current plugins too? As there are lots of other useful plugins there, like fcnpc, ysf, mapandreas and some others?
Gigi-The-Beast is offline   Reply With Quote
Old 06/05/2014, 10:51 PM   #10
ikkentim
High-roller
 
ikkentim's Avatar
 
Join Date: Jan 2010
Location: Kampen, The Netherlands
Posts: 1,069
Reputation: 176
Default Re: SampSharp - Write gamemodes in .NET

Quote:
Originally Posted by Gigi-The-Beast View Post
Okay, thank you for your reply.
But would you be able to implement a way to allow using the current plugins too? As there are lots of other useful plugins there, like fcnpc, ysf, mapandreas and some others?
I haven't yet found a way to call natives by name. SampSharp has build in support for mapandreas though.

Quote:
Originally Posted by Scaleta View Post
Seems pretty sweet. I can't wait to see some more documentation on this.

Does this have any effect on how fast things are processed?
Havent yet tested it, but I'm quite sure pure pawn or pure sampgdk is faster.

The reason to use this plugin would be OO, .NET and all libraries written for .NET.
__________________
Greetings,
Tim Potze

Projects
GAMEDEV | Part-time developer working on Parkitect. | Steampage
LSRES | A SA:MP server from the past, and hopefully, back in the future.
SampSharp | Plugin for writing SA:MP gamemodes in C#. | Topic Website Github
SanMap | San Andreas in Google Maps! | Topic Github Sample
ikkentim is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Write on the map hejsan123 Scripting Help 3 23/09/2012 08:35 AM
How to write something in a VAR? Ihsan_Cingisiz Help Archive 4 29/05/2010 07:24 PM
How Do You Write This? sidhu123 Everything and Nothing 2 12/09/2009 04:05 AM
Write something in big and to the top TimBuk.Ekh Help Archive 3 18/04/2009 07:19 PM


All times are GMT. The time now is 10:22 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.