Fix for client scripts not being loaded

This commit is contained in:
Vortrex
2020-12-26 02:00:43 -06:00
parent 097fe07104
commit 0dcc760a19

View File

@@ -62,7 +62,7 @@ addEventHandler("onPickupCollected", function(event, pickup, ped) {
// ---------------------------------------------------------------------------
bindEventHandler("onResourceStart", thisResource, function(event, resource) {
triggerNetworkEvent("ag.clientReady");
triggerNetworkEvent("ag.clientStarted");
addEvent("OnLocalPlayerEnterSphere", 1);
addEvent("OnLocalPlayerExitSphere", 1);
@@ -77,6 +77,13 @@ bindEventHandler("onResourceStart", thisResource, function(event, resource) {
addNetworkHandler("ag.passenger", enterVehicleAsPassenger);
});
// ---------------------------------------------------------------------------
bindEventHandler("onResourceReady", thisResource, function(event, resource) {
triggerNetworkEvent("ag.clientReady");
});
// ----------------------------------------------------------------------------
bindEventHandler("OnResourceStop", thisResource, function(event, resource) {
@@ -150,8 +157,7 @@ function syncVehicle(vehicle) {
}
}
}
addNetworkHandler("ag.veh.sync", syncVehicle)
;
addNetworkHandler("ag.veh.sync", syncVehicle);
// ---------------------------------------------------------------------------
@@ -492,15 +498,6 @@ addEventHandler("OnPedWasted", function(event, wastedPed, killerPed, weapon, ped
addNetworkHandler("ag.showBusStop", function(position, colour) {
busStopSphere = gta.createSphere(position, 3);
busStopBlip = gta.createBlip(position, 0, 2, colour);
bindEventHandler("OnLocalPlayerEnterSphere", busStopSphere, function(event, sphere) {
triggerNetworkEvent("ag.arrivedAtBusStop");
unbindEventHandler("OnLocalPlayerEnterSphere", busStopSphere);
destroyElement(busStopSphere);
destroyElement(busStopBlip);
busStopSphere = null;
busStopBlip = null;
});
});
// ---------------------------------------------------------------------------
@@ -519,4 +516,16 @@ addNetworkHandler("ag.removeWorldObject", function(model, position, range) {
gta.removeWorldObject(model, position, range);
});
// ---------------------------------------------------------------------------
addEventHandler("OnLocalPlayerEnterSphere", function(event, sphere) {
if(sphere == busStopSphere) {
destroyElement(busStopSphere);
destroyElement(busStopBlip);
busStopSphere = null;
busStopBlip = null;
triggerNetworkEvent("ag.arrivedAtBusStop");
}
});
// ---------------------------------------------------------------------------