samp.directory
← Scripts et bibliothèques

wg1337/omp-gta-popcycle

Exposes GTA:SA popcycle.dat values to open.mp

Bibliothèque★ 1mis à jour il y a 40 joursUnlicensePawnsampctl
Ouvrir sur GitHub

Installer avec sampctl

sampctl package install wg1337/omp-gta-popcycle

Lance ceci dans le dossier de ton projet. sampctl télécharge le paquet et ce dont il dépend.

L’essayer dans le compilateur Pawn →

Ajoute ses fichiers include, avec les bibliothèques dont il dépend, au compilateur Pawn de ton navigateur, prêts à être inclus dans un script.

README.md

What is it?

This is a simple include for open.mp to load the values from GTA:SA "popcycle.dat" file into Pawn. This file contains values for what kind of "groups" spawn in singleplayer GTA:SA in a certain area type based on day of the week and time. These "groups" refer to GTA:SA population, that can be "peds" or "vehicles" depending on use case. This is a recreation of "CPopCycle::Initialise()" from gta-reversed along with some helper functions. Be aware, this include is not very useful by itself. If you wanted to populate open.mp with peds and vehicles based on the logic in GTA:SA, then this is going to be a part of, specifically this include provides "how big of the total population should a certain population group be" and returns a percentage. It becomes much more useful when you also include zone information from "info.zon".

How to use it?

  1. Place "popcycle.dat" in your "scriptfiles/" folder
  2. Include it in your script:
#include <omp_gta_popcycle>

public OnFilterScriptInit() {
    ....
    if(!LoadPopCycleDat()) {
        print("ERROR: Failed to load popcycle.dat");
        return false;
    }
    ....
    return true;
}
  1. You probably want to attach the function that tracks the day of the week to your existing time progression system, for example:
public OnWorldHourChange(hour) {
...
    CallRemoteFunction("GTAPopCycle_UpdateHour", "i", hour);
...
    return true;
}
  1. Use the provided funcations, for example:
//Gets how many of the population can be with type "GTA_POPCYCLE_TYPE_BUSINESS"
new cars = GetPopCycleCars(GTA_POPCYCLE_TYPE_BUSINESS, GetPopCycleDayType(hour), GetPopCycleTimeSlot(hour));

Cette page est construite à partir de ce que GitHub publie sur le dépôt. samp.directory n’héberge pas le code. Signaler un problème avec cette fiche

wg1337/omp-gta-popcycle : Bibliothèque SA-MP | samp.directory