A SAMP C++ extension of SAMPGDK.
This library uses pacc package manager.
- Download pacc
- Add
github:PoetaKodu/[email protected]
as a dependency to your project - Type
pacc install
Done.
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);
}