Add ped fall event for MafiaC + send jobs

This commit is contained in:
Vortrex
2022-09-29 11:15:38 -05:00
parent 94195d95d3
commit 4948ba8f98

View File

@@ -33,6 +33,10 @@ function addAllEventHandlers() {
addEventHandler("onPedExitedVehicleEx", onPedExitedVehicle);
addEventHandler("onPedEnteredSphereEx", onPedEnteredSphere);
addEventHandler("onPedExitedSphereEx", onPedExitedSphere);
if (getGame() == AGRP_GAME_MAFIA_ONE) {
addEventHandler("onPedFall", onPedFall);
}
}
// ===========================================================================
@@ -581,11 +585,14 @@ async function onPlayerSpawn(client) {
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
sendAllBusinessesToPlayer(client);
sendAllHousesToPlayer(client);
//sendAllJobsToPlayer(client);
//sendAllVehiclesToPlayer(client);
sendAllJobsToPlayer(client);
requestPlayerPedNetworkId(client);
}
if (!areServerElementsSupported()) {
sendAllVehiclesToPlayer(client);
}
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
updatePlayerSpawnedState(client, true);
@@ -599,6 +606,19 @@ async function onPlayerSpawn(client) {
setPlayerWeaponDamageEvent(client, AGRP_WEAPON_DAMAGE_EVENT_NORMAL);
if (doesPlayerHaveGUIEnabled(client) && getServerConfig().useGUI == true) {
if (checkForGeoIPModule()) {
let iso = getPlayerCountryISOCode(client);
let localeId = getLocaleFromCountryISO(iso);
if (localeId != 0) {
if (getLocaleData(localeId).enabled) {
messagePlayerTip(client, getLanguageLocaleString(localeId, "LocaleOffer", `/lang ${getLocaleData(localeId).isoCode}`), getColourByName("white"), 10000, "Roboto");
}
}
}
}
if (areServerElementsSupported()) {
if (getGlobalConfig().playerStreamInDistance == -1 || getGlobalConfig().playerStreamOutDistance == -1) {
getPlayerPed(client).netFlags.distanceStreaming = false;
@@ -840,4 +860,15 @@ function onPlayerExitingVehicle(client, vehicle, seat) {
}
// ===========================================================================
function onPedFall(ped) {
if (ped.isType(ELEMENT_PLAYER)) {
let client = getClientFromPlayerElement(ped);
if (client != null) {
processPlayerDeath(client);
}
}
}
// ===========================================================================