All Projects → Zeex → Sampgdk

Zeex / Sampgdk

Licence: apache-2.0
Write SA-MP gamemodes in C/C++

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Sampgdk

Samp Plugin Profiler
Performance profiler plugin for SA-MP server
Stars: ✭ 33 (-70.8%)
Mutual labels:  cmake, plugin
Easyclangcomplete
💥 Robust C/C++ code completion for Sublime Text 3
Stars: ✭ 537 (+375.22%)
Mutual labels:  cmake, plugin
Fcnpc
FCNPC - Fully Controllable NPC
Stars: ✭ 73 (-35.4%)
Mutual labels:  cmake, plugin
Ida Cmake
IDA plugin CMake build-script
Stars: ✭ 30 (-73.45%)
Mutual labels:  cmake, plugin
Qv2ray
⭐ Linux / Windows / macOS 跨平台 V2Ray 客户端 | 支持 VMess / VLESS / SSR / Trojan / Trojan-Go / NaiveProxy / HTTP / HTTPS / SOCKS5 | 使用 C++ / Qt 开发 | 可拓展插件式设计 ⭐
Stars: ✭ 12,886 (+11303.54%)
Mutual labels:  cmake, plugin
Search Plugins
Search plugins for the search feature
Stars: ✭ 1,860 (+1546.02%)
Mutual labels:  plugin
Caveexpress
CaveExpress is a classic 2D platformer with physics-based gameplay and dozens of levels. CavePacker is a Sokoban game.
Stars: ✭ 111 (-1.77%)
Mutual labels:  cmake
Pg Calendar
📆 beautiful and eidetic date picker
Stars: ✭ 109 (-3.54%)
Mutual labels:  plugin
Kcp Bulild
Unity3D中可靠UDP网络库kcp的各平台动态库构建项目
Stars: ✭ 109 (-3.54%)
Mutual labels:  cmake
Ros Examples
This repository is home to a collection of ROS nodes that process 3D sensor information from Velodyne LIDAR
Stars: ✭ 113 (+0%)
Mutual labels:  cmake
Poetry Pycharm Plugin
A PyCharm plugin for poetry
Stars: ✭ 113 (+0%)
Mutual labels:  plugin
Responsive Sidebar Navigation
An easy-to-integrate side, vertical navigation, ideal for dashboards and admin areas.
Stars: ✭ 111 (-1.77%)
Mutual labels:  plugin
Kicad Doc
KiCad new documentation repository [moved to https://gitlab.com/kicad]
Stars: ✭ 110 (-2.65%)
Mutual labels:  cmake
Nrf5 Sdk For Mesh
This repo is a "Release" clone of the zip files available @
Stars: ✭ 112 (-0.88%)
Mutual labels:  cmake
Kepka
Unofficial Telegram Desktop messaging app
Stars: ✭ 109 (-3.54%)
Mutual labels:  cmake
Jira Vim
A vim plugin to access your Jira workspace directly from Vim
Stars: ✭ 113 (+0%)
Mutual labels:  plugin
Moderncppci
This is an example of doing a Modern C++ project with CI
Stars: ✭ 109 (-3.54%)
Mutual labels:  cmake
Android Styler
Android Studio / IDEA plugin that helps to create styles
Stars: ✭ 110 (-2.65%)
Mutual labels:  plugin
Qhttpengine
HTTP server for Qt applications
Stars: ✭ 112 (-0.88%)
Mutual labels:  cmake
Mybot ws
URDF model for Gazebo integrated with ROS
Stars: ✭ 111 (-1.77%)
Mutual labels:  cmake

GDK - Gamemode SDK for C/C++

Version Build Status Build Status - Windows Gitter

Introduction

The GDK (Gamemode Development Kit) is a library that allows you to write SA-MP gamemodes in C/C++. It mirrors the Pawn scripting API provied by the SA-MP server and lets you handle various SA-MP events a.k.a callbacks in a similar fashion.

For the impatient, here is what it looks like in C++:

#include <stdio.h>
#include <string.h>

#include <sampgdk/a_players.h>
#include <sampgdk/a_samp.h>
#include <sampgdk/core.h>
#include <sampgdk/sdk.h>

void SAMPGDK_CALL PrintTickCountTimer(int timerid, void *params) {
  sampgdk::logprintf("Tick count: %d", GetTickCount());
}

PLUGIN_EXPORT bool PLUGIN_CALL OnGameModeInit() {
  SetGameModeText("Hello, World!");
  AddPlayerClass(0, 1958.3783f, 1343.1572f, 15.3746f, 269.1425f,
                 0, 0, 0, 0, 0, 0);
  SetTimer(1000, true, PrintTickCountTimer, 0);
  return true;
}

PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerConnect(int playerid) {
  SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the HelloWorld server!");
  return true;
}

PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerRequestClass(int playerid,
                                                    int classid) {
  SetPlayerPos(playerid, 1958.3783f, 1343.1572f, 15.3746f);
  SetPlayerCameraPos(playerid, 1958.3783f, 1343.1572f, 15.3746f);
  SetPlayerCameraLookAt(playerid, 1958.3783f, 1343.1572f, 15.3746f, CAMERA_CUT);
  return true;
}

PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerCommandText(int playerid,
                                                   const char *cmdtext) {
  if (strcmp(cmdtext, "/hello") == 0) {
    char name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    char message[MAX_CLIENT_MESSAGE];
    sprintf(message, "Hello, %s!", name);
    SendClientMessage(playerid, 0x00FF00FF, message);
    return true;
  }
  return false;
}

Build Instructions

In order to build the GDK you first you need to download and install the following dependencies:

Once all dependencies are installed you can use the following commands to build and install the library:

cd path/to/sampgdk
mkdir build && cd build
cmake .. -DSAMP_SDK_ROOT=path/to/sdk
cmake --build . --config Release
cmake --build . --config Release --target install

You can pass additional arguments to CMake and change one or more of the following options:

  • SAMPGDK_STATIC - Build as static library (default is OFF)
  • SAMPGDK_BUILD_PLUGINS - Build example plugins (default is OFF)
  • SAMPGDK_BUILD_AMALGAMATION - Build amalgamation (default is OFF)
  • SAMPGDK_BUILD_DOCS - Build Doxygen documentation (default is ON)

For example, to build GDK as a static library together with example plugins:

cmake .. -DSAMPGDK_STATIC=ON -DSAMPGDK_BUILD_PLUGINS=ON

The following built-in variables may also be useful:

  • CMAKE_BUILD_TYPE - Bulid type: Debug, Release, RelWIthDebInfo, MinSizeRel
  • CMAKE_INSTALL_PREFIX - Where to install files

For more information or questions about CMake please read the CMake FAQ.

Getting Started

You can start with downloading the source code and playing a little bit with the helloworld plugin. In case you need documentation it's available online here, in a browsable form, as well as in the GDK header files.

If you feel like making a new project there's a step-by-step guide on setting up a GDK project with CMake. No prior knowledge of CMake is required to follow it.

Using Git

If you know Git and you've already managed to build the library successfully the easiest way to get started is probably to clone this repo (if you haven't done so) and create a new local branch for your personal project:

git clone git://github.com/Zeex/sampgdk.git
git checkout -b my-project

and begin working on it right inside the GDK source tree. You could either edit the helloworld project or create a new project in a separate folder under the plugins/ directory. The latter is recommended as it would avoid possible merge conflicts if helloworld suddenly gets updated in upstream.

Later if you decide that it's time to update the library, say to version v1.2.3, you would simply fetch master from upstream and merge the changes into your project's branch:

git fetch origin master
git merge v1.2.3

License

Licensed under the Apache Licese version 2.0. See the LICENSE.txt file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].