Giter VIP home page Giter VIP logo

ikkentim / sampsharp Goto Github PK

View Code? Open in Web Editor NEW
209.0 25.0 40.0 16.94 MB

A framework for writing game modes for SA-MP in C#. SA-MP is a free Massively Multiplayer Online game mod for the PC version of Rockstar Games Grand Theft Auto: San Andreas.

Home Page: https://sampsharp.net

License: Apache License 2.0

C# 59.07% C 9.69% C++ 31.21% Makefile 0.02% Pawn 0.01%
sampsharp sa-mp sa-mp-development gtasa gta-sa sa-mp-server gta

sampsharp's Introduction

SampSharp

GitHub Action: dotnet GitHub Action: Plugin (Linux) GitHub Action: Plugin (win32) GitHub Releases GitHub Issues

Join us on Discord

SampSharp is a plugin and library that allows you to write San Andreas: Multiplayer(SA-MP) gamemodes in C#. SampSharp's aim is to allow you to enjoy all features of object-oriented programming and .NET. SampSharp uses the .NET runtime which allows the plugin to run on both Windows and Linux server. For information about installing and building SampSharp, check the documentation. If you have any questions, feel free to join our Discord chat or file an issue.

Documentation

The SampSharp .NET packages provided are available on NuGet.org and contains all API documentation. Additional documentation is available on https://sampsharp.net/ and https://api.sampsharp.net/

Examples

Some example gamemodes are available here:

  • GrandLarc (GM) - SA-MP default gamemode "grandlarc" ported to C# using SampSharp.GameMode
  • GrandLarc (ECS) - SA-MP default gamemode "grandlarc" ported to C# using SampSharp.Entities
  • RiverShell (GM) - SA-MP default gamemode "rivershell" ported to C# using SampSharp.GameMode

Building SampSharp

In order to build the .NET libraries you can simply open and build SampSharp.sln using Visual Studio 2022, or you can build it from the command line using dotnet (version 6 or newer) dotnet publish SampSharp.sln --configuration Release.

To build the plugin on Windows, build SampSharp.Plugin.sln with Visual Studio 2022. You'll need to have the "Desktop development with C++" workload installed using Visal Studio Installer.

To build the plugin on Linux you'll at least need to have the packages make gcc g++ gcc-multilib g++-multilib installed. Run make to build the plugin.

sampsharp's People

Contributors

amir-halloul avatar batuaksoy avatar cipriann23 avatar d0nt avatar donxp avatar duydang2311 avatar gitter-badger avatar ikkentim avatar inerska avatar kirillborunov avatar ldami avatar marcoacierno avatar mrdave1999 avatar sionzee avatar ts-pytham avatar y0ung3r avatar zelyutin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sampsharp's Issues

How to work with other plugins ?

SampGDK provide a generic way to hook any callback which works with plugin callbacks too.
So how you manage to work with plugin callbacks ?
Does this work with streamer ?

OnPlayerPickDynamicPickup ?

Server crash when putting player in vehicle

My server crashes when putting a player in a vehicle that was just created.

The crashdetect plugin says:

[00:55:43] [debug] Server crashed due to an unknown error
[00:55:43] [debug] Native backtrace:
[00:55:43] [debug] #0 0f94c0fb in SampSharp::HandleEvent () from plugins\SampSharp.DLL
[00:55:43] [debug] #1 0f95bdf3 in OnPublicCall () from plugins\SampSharp.DLL
[00:55:43] [debug] #2 0f927ce2 in sampgdk_callback_invoke () from plugins\SampSharp.DLL
[00:55:43] [debug] #3 0f929354 in sampgdk_param_get_string () from plugins\SampSharp.DLL
[00:55:43] [debug] #4 0046dcdb in ?? () from samp-server.exe
[00:55:43] [debug] #5 0047f68b in ?? () from samp-server.exe
[00:55:43] [debug] #6 0047833c in ?? () from samp-server.exe
[00:55:43] [debug] #7 65aa923c in ?? () from mono-2.0.dll
[00:55:43] [debug] #8 65a631a7 in ?? () from mono-2.0.dll
[00:55:43] [debug] #9 0f9287dc in sampgdk_native_find_warn_stub () from plugins\SampSharp.DLL
[00:55:43] [debug] #10 0f977db0 in std::_Facetptrstd::ctype::_Psave () from plugins\SampSharp.DLL
[00:55:43] [debug] #11 0018e784 in ?? ()

Calling natives during shutdown causes a crash

Native stacktrace:

    /usr/lib/libmonoboehm-2.0.so.1(+0xcb5f4) [0xb70c75f4]
    /usr/lib/libmonoboehm-2.0.so.1(+0x11e728) [0xb711a728]
    /usr/lib/libmonoboehm-2.0.so.1(+0x29d7e) [0xb7025d7e]
    [0xb771f40c]
    ./samp03svr() [0x80d704b]
    plugins/libSampSharp.so(sampgdk_DestroyVehicle+0x5d) [0xb73cfe64]
    [0xb5c29f94]
    [0xb6b1535c]
    [0xb6b1511b]
    [0xb6b0c001]
    /usr/lib/libmonoboehm-2.0.so.1(+0x1d4644) [0xb71d0644]

Debug info from gdb:


=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Aborted (core dumped)

Disposed vehicles still in the pool

When disposing vehicles, they sometimes remain in the pool, but they seem to have no proper information (e.g. model id is 0 after disposing it) but i can still access them using the All Property or the GetAll() method of the pool.

Exceptions in the TimerController

Sometimes i get exceptions in the TimerController:

[08/11/2014 15:05:29] Exception thrown:
System.NullReferenceException: Object reference not set to an instance of an object
  at SampSharp.GameMode.Controllers.TimerController.<RegisterEvents>b__0 (System.Object sender, System.EventArgs args) [0x00001] in [***]\SampSharp.GameMode\Controllers\TimerController.cs:32 
  at SampSharp.GameMode.BaseMode.OnTimerTick (Int32 timerid, System.Object args) [0x00015] in [***]\SampSharp.GameMode\BaseMode.cs:837 

key not found exception

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

How to call functions which need an array ?

First or all a brief view about your plugin is that I guess this is going to be ultimate way of creating new gamemodes in a real language like C#.
I thank you so much!

Now I need to call a streamer function which is like following

    native CreateDynamicPolygon(Float:points[], Float:minz = -FLOAT_INFINITY, Float:maxz = FLOAT_INFINITY, maxpoints = sizeof points, worldid = -1, interiorid = -1, playerid = -1);

How to send points as array to the function !?

Player disposed too early

The playercontroller is early up in the controllers queue, therefore it's quickly disposing the player object before other controllers have access to it.

Vehicle.Create returns null even if the vehicle is created by SA:MP

If you create a vehicle using Vehicle.Create it will return null even if the modelid is valid and the vehicle is created in the game.

PlayerVehicle = Vehicle.Create(455,
     new Vector(Coords.spawnPositions[Id, 0], Coords.spawnPositions[Id, 1], Coords.spawnPositions[Id, 2]),
     (float)Coords.spawnPositions[Id, 3],
     0, 0, -1
);

Add static Delay class

Delay.Run will run an action after a given interval once. Works like a non-repeating timer, but without event handlers.

Retrive array in callbacks

GPS_WhenRouteIsCalculated(routeid,node_id_array[],amount_of_nodes,Float:distance,Float:Polygon[],Polygon_Size,Float:NodePosX[],Float:NodePosY[],Float:NodePosZ[]);

How to get node_id_array ?
It's a pawn array

when playerid != 0, chat messages are incomplete

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"

Troubles using the entity framework

I tried to use the entity framework (MySQL) with SampSharp, but it says:

Could not load type 'MySql.Data.Entity.MySqlEFConfiguration' from assembly 'MySql.Data.Entity.EF6, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.

Did you test the entity framework? Maybe you can tell me if i have to configure it a special way or something.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.