All Projects → PatrickGTR → gta-open

PatrickGTR / gta-open

Licence: Apache-2.0 license
A gamemode made for open.mp, using open.mp naming conventions and best coding practices!

Programming Languages

Pawn
127 projects
POV-Ray SDL
72 projects
SourcePawn
201 projects
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to gta-open

ExtremeStudio
ExtremeStudio is a PAWN editor and is designed to be used in SA-MP development.
Stars: ✭ 25 (-57.63%)
Mutual labels:  sa-mp, sa-mp-development
samp-missions
GTA:SA story missions for SA-MP.
Stars: ✭ 26 (-55.93%)
Mutual labels:  sa-mp, gamemode
Open-GTO
RPG gamemode for SA-MP
Stars: ✭ 45 (-23.73%)
Mutual labels:  sa-mp, gamemode
pawn-requests
pawn-requests provides an API for interacting with HTTP(S) JSON APIs.
Stars: ✭ 56 (-5.08%)
Mutual labels:  sa-mp, sa-mp-development
GWRP-0.3
Игровой режим для San Andreas Multiplayer
Stars: ✭ 22 (-62.71%)
Mutual labels:  sa-mp, gamemode
pawn-stdlib
The Pawn Standard Library Package, not including any files related to SA:MP - designed for the sampctl package management system.
Stars: ✭ 13 (-77.97%)
Mutual labels:  sa-mp, sa-mp-development
samp-node-lib
NodeJS library for Scripting San Andreas Multiplayer:SAMP depends on samp-node plugin
Stars: ✭ 23 (-61.02%)
Mutual labels:  sa-mp, sa-mp-development
Anti cheat pack
An anti cheat library improved over 3 years
Stars: ✭ 25 (-57.63%)
Mutual labels:  sa-mp, sampctl
code-parse.inc
Pre-processor macros for analysing PAWN functions.
Stars: ✭ 23 (-61.02%)
Mutual labels:  sa-mp, sa-mp-development
amx assembly
Interesting #emit stuff
Stars: ✭ 49 (-16.95%)
Mutual labels:  sa-mp
progress2
A SA:MP UI library for rendering progress bars used to visualise all manner of data from health to a countdown timer.
Stars: ✭ 42 (-28.81%)
Mutual labels:  sa-mp
PacPaw
Pawn package manager for SA-MP
Stars: ✭ 14 (-76.27%)
Mutual labels:  sa-mp
protection
Flexible server protection system (development)
Stars: ✭ 23 (-61.02%)
Mutual labels:  sa-mp
SS-Gang-System-SQLITE
SS Gang System for SA-MP
Stars: ✭ 23 (-61.02%)
Mutual labels:  sa-mp
samp-server-cli
Control server configuration via command line (without manually editing server.cfg)
Stars: ✭ 14 (-76.27%)
Mutual labels:  sa-mp
wine-launcher
Wine Launcher - Running Windows games under Linux
Stars: ✭ 249 (+322.03%)
Mutual labels:  gamemode
PawnPlus
A SA-MP plugin enhancing the capabilities of the Pawn programming language
Stars: ✭ 79 (+33.9%)
Mutual labels:  sa-mp
samp-ptl
SA:MP Plugin Template Library (C++17)
Stars: ✭ 16 (-72.88%)
Mutual labels:  sa-mp
sscanf
SA:MP sscanf plugin
Stars: ✭ 33 (-44.07%)
Mutual labels:  sa-mp
samp-plugin-crashdetect
Crash/error reporting plugin for SA-MP server
Stars: ✭ 93 (+57.63%)
Mutual labels:  sa-mp

Logo

A Cops and robbers mode based in Los Santos with features including...
  • Robbing stores and players
  • Attachments (a.k.a clothing system)
  • Houses with different interiors that can be customised with an array of furnitures.
  • Be a drug dealer, get the skill to plant cannabis and make cocaine.
  • Casino where you can play on slot machine and gamble.
  • Become a good citizen, do legal missions such as pizza delivery, trucking and so much more!
  • Per player vehicle system, customize your car, cutomize your plate and everything will be saved.
  • Gangs, competitive gang system that competes with other gangs kills, deaths and zone captures.

Discord server

Logo

Running & Compiling

Run this gamemode in three line!

sampctl package ensure
sampctl package build
sampctl package run

How to contribute.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create.

Any contributions you make are greatly appreciated.

    1. Fork the Project
    1. Create your Feature Branch (git checkout -b feature/)
    1. Commit your Changes (git commit -m 'Add some AmazingFeature')
    1. Push to the Branch (git push origin feature/AmazingFeature)
    1. Open a Pull Request

Style Guide

// Constants and macros in "UPPER_CASE", with underscores separating words.
#define MAX_PASSWORD    (16)

const INVALID_ARENA_ID = -1;

// 'static' Globals as much as possible to avoid conflict
// with other module that may have the same variable name
static
    // Globals `g` prefixed and camel case.
    gPlayerPassword[MAX_PASSWORD],
    gArenaID[MAX_PLAYERS] = INVALID_ARENA_ID;

// ------------------------------------------------------------------------
// Brace style
// ------------------------------------------------------------------------
// Both style are acceptable but please NOTE!
// make the indentation style consistent depending on the
// module you are working on.

// K & R
if(condition == true)
    condition == false;

// Allman
if(condition == true)
{
    condition == false;
}

// ------------------------------------------------------------------------
// Function Name
// ------------------------------------------------------------------------
// Functions in PascalCase - all words start with an upper-case letter.
// Each Function must be prefixed with the name of the module

// For example we have a module called 'level.inc'
// the module will be an API so we don't have to access the variables anywhere other than the module.
// Functional Programming!!

Level_Get(playerid) {
    if(!IsPlayerConnected(playerid)) {
        return -1; // notice how we used -1, because 0 is a valid level.
    }

    return gPlayerLevel[playerid];
}

Level_GivePlayer(playerid, level) {
    // Braces even for single statements.
    if(!IsPlayerConnected(playerid)) {
        return 0;
    }

    // Single declaration for multiple variables, with each on a new indented line.
    new
        // Variables/parameters in "lowerCamelCase" - as above, except the first word.
        playerLevel = Level_Get(playerid);

    // Module names come first before an underscore.
    Level_Set(playerid, playerLevel + level);
    return 1;
}

Level_Set(playerid, level, bool:save = false) {
    if(!IsPlayerConnected(playerid)) {
        return 0;
    }

    gPlayerLevel[playerid] = level;

    if(save) {
        // mock update the database.
        // UPDATE player_statistics SET level = level + ?
        // ? = level
        // execute statement.
    }
    return 1;
}

// ------------------------------------------------------------------------
// Credentials
// ------------------------------------------------------------------------
// Delicate information such as discord_token & mysql credentials
// must be stored in environment variables to avoid rouge scripter who will tamper with the database
// NOTE:
// USE https://github.com/dakyskye/pawn-env

public OnGameModeInit() {
     new
        MySQLOpt: option_id = mysql_init_options();
	mysql_set_option(option_id, AUTO_RECONNECT, true); // it automatically reconnects when loosing connection to mysql server

    new
        username[24],
        host[24],
        password[24],
        database[24];

    // it's important to add a fallback if first statement fails.
    // like shown below.
    if(Env_Has("MYSQL_USERNAME")) {
        Env_Get("MYSQL_USERNAME", username);
    }
    else {
        print("Could not find environment variable for MYSQL_USERNAME");
    }

    if(Env_Has("MYSQL_PASSWORD")) {
        Env_Get("MYSQL_PASSWORD", password);
    }
    else {
        print("Could not find env ironment variable for MYSQL_PASSWORD");
    }

    if(Env_Has("MYSQL_HOST")) {
        Env_Get("MYSQL_HOST", host);
    }
    else {
        print("Could not find environment variable for MYSQL_HOST");
    }

    if(Env_Has("MYSQL_DATABASE")) {
        Env_Get("MYSQL_DATABASE", database);
    }
    else {
        print("Could not find environment variable for MYSQL_DATABASE");
    }

    MySQL_ConHandle = mysql_connect(host, username, password, database);

    if(MySQL_ConHandle == MYSQL_INVALID_HANDLE || mysql_errno(MySQL_ConHandle) != 0) {
        print("MySQL failed to connect. Server shutting down...");
        exit();
        return 1;
    }

    print("MySQL connection is successful.");
    return 1;
}


// ------------------------------------------------------------------------
// MySQL Prepared Statements
// ------------------------------------------------------------------------
// Each statement declaration must have stmt_ prefix.
// after the prefix, naming must be CamelCase.
static
    stmt_CamelCase;

// long queries must be seperated into different lines
// for better readability.
// it also should be stored in an array with no fixed size
// declared as 'static const'
static const query_LoadAttachments[] = "\
    SELECT \
        slot, \
        model, \
        bone, \
        offset_x, \
        offset_y, \
        offset_z, \
        rotation_x,\
        rotation_y, \
        rotation_z, \
        scale_x, \
        scale_y, \
        scale_z \
    FROM \
        attachments \
    WHERE \
        u_id = ?"
; // this is only acceptable for queries.

Thanks to

Name Message
[Southclaws] Includes, snippets from Scavenge Survive, sampctl.
[maddinat0r] MySQL
[Y_Less] for YSI Library, used a lot throughout the code.
[Zeex] amx_assembly, crashdetect, indirection
[Slice] formatex
[Lorenc] SFCNR, snippets & data from sfcnr

Very special thanks to SA:MP Team past, present and future - SA:MP.

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].