PoetaKodu / samp-cpp

A SAMP C++ extension of SAMPGDK.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

samp-cpp

A SAMP C++ extension of SAMPGDK.

πŸš€ Installation

This library uses pacc package manager.

  1. Download pacc
  2. Add github:PoetaKodu/samp-cpp@0.1.0 as a dependency to your project
  3. Type pacc install

Done.

πŸ‘€ Overview

Spawning vehicle example:

spawnVehicleFor(playerid, modelid)
{
	if (IsPlayerInAnyVehicle(playerid))
	{
		DestroyVehicle(GetPlayerVehicleID(playerid));
	}

	new Float:pos[3];
	new Float:rot;

	GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
	GetPlayerFacingAngle(playerid, rot);

	new vehid = CreateVehicle(modelid, pos[0], pos[1], pos[2], rot, 3, 4, 5000);

	PutPlayerInVehicle(playerid, vehid, 0);
}

C++ version using this library:

void spawnVehicleFor(Player player, Vehicle::Model model)
{
	if (player.isInAnyVehicle())
		player.getVehicle().destroy();

	auto veh = Vehicle::create(model, player.pos(), player.rot(), 3, 4, 5000);

	player.putInVehicle(veh, 0);
}

About

A SAMP C++ extension of SAMPGDK.

License:MIT License


Languages

Language:C++ 100.0%