Add bus driver job stuff (incomplete)
This commit is contained in:
@@ -8,14 +8,14 @@
|
|||||||
// TYPE: Client (JavaScript)
|
// TYPE: Client (JavaScript)
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
let allServerBlips = [];
|
|
||||||
let currentServerBlips = [];
|
|
||||||
|
|
||||||
let bigMessageFont = null;
|
let bigMessageFont = null;
|
||||||
let mainLogo = null;
|
let mainLogo = null;
|
||||||
|
|
||||||
let showLogo = true;
|
let showLogo = true;
|
||||||
|
|
||||||
|
let busStopBlip = null;
|
||||||
|
let busStopSphere = null;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
addNetworkHandler("ag.connectCamera", function(cameraPosition, cameraLookat) {
|
addNetworkHandler("ag.connectCamera", function(cameraPosition, cameraLookat) {
|
||||||
@@ -62,6 +62,9 @@ addEventHandler("onPickupCollected", function(event, pickup, ped) {
|
|||||||
|
|
||||||
bindEventHandler("onResourceStart", thisResource, function(event, resource) {
|
bindEventHandler("onResourceStart", thisResource, function(event, resource) {
|
||||||
triggerNetworkEvent("ag.clientReady");
|
triggerNetworkEvent("ag.clientReady");
|
||||||
|
|
||||||
|
addEvent("OnLocalPlayerEnterSphere", 1);
|
||||||
|
addEvent("OnLocalPlayerExitSphere", 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -227,10 +230,7 @@ addNetworkHandler("ag.removeFromVehicle", function() {
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function initLocalPlayer(player) {
|
function initLocalPlayer(player) {
|
||||||
attemptToShowBlipsOnSpawn(player);
|
addEventHandler("onProcess", processEvent);
|
||||||
if(gta.game < GAME_GTA_IV) {
|
|
||||||
addEventHandler("onProcess", processEvent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -240,11 +240,13 @@ function processEvent(event, deltaTime) {
|
|||||||
if(localPlayer.position.distance(sphere.position) <= sphere.radius) {
|
if(localPlayer.position.distance(sphere.position) <= sphere.radius) {
|
||||||
if(localPlayer.getData("ag.inSphere") == null) {
|
if(localPlayer.getData("ag.inSphere") == null) {
|
||||||
localPlayer.setData("ag.inSphere", sphere);
|
localPlayer.setData("ag.inSphere", sphere);
|
||||||
|
triggerEvent("OnLocalPlayerEnterSphere", sphere, sphere);
|
||||||
triggerNetworkEvent("ag.onPlayerEnterSphere", sphere);
|
triggerNetworkEvent("ag.onPlayerEnterSphere", sphere);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(localPlayer.getData("ag.inSphere")) {
|
if(localPlayer.getData("ag.inSphere") != null) {
|
||||||
localPlayer.removeData("ag.inSphere", sphere);
|
localPlayer.removeData("ag.inSphere", sphere);
|
||||||
|
triggerEvent("OnLocalPlayerExitSphere", sphere, sphere);
|
||||||
triggerNetworkEvent("ag.onPlayerExitSphere", sphere);
|
triggerNetworkEvent("ag.onPlayerExitSphere", sphere);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,8 +372,8 @@ addNetworkHandler("ag.freeze", function(state) {
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
addNetworkHandler("ag.control", function(state) {
|
addNetworkHandler("ag.control", function(controlState, cursorState = false) {
|
||||||
gui.showCursor(state, false);
|
gui.showCursor(cursorState, controlState);
|
||||||
});
|
});
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -380,4 +382,21 @@ addNetworkHandler("ag.fadeCamera", function(state, time) {
|
|||||||
gta.fadeCamera(state, time);
|
gta.fadeCamera(state, time);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
addEventHandler("OnPedWasted", function(event, wastedPed, killerPed, weapon, pedPiece) {
|
||||||
|
wastedPed.clearWeapons();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
addNetworkHandler("ag.showBusStop", function(position, colour) {
|
||||||
|
let busStopSphere = gta.createSphere(position, 3);
|
||||||
|
let busStopBlip = gta.createBlip(position, 0, 2, colour);
|
||||||
|
|
||||||
|
bindEventHandler("OnLocalPlayerEnterSphere", busStopSphere, function(event, sphere) {
|
||||||
|
triggerNetworkEvent("ag.arrivedAtBusStop");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -104,10 +104,10 @@ let busRoutes = [
|
|||||||
function getNextStopOnBusRoute(client) {
|
function getNextStopOnBusRoute(client) {
|
||||||
if(getEntityData(client, "ag.busRoute") && getEntityData(client, "ag.lastBusStop")) {
|
if(getEntityData(client, "ag.busRoute") && getEntityData(client, "ag.lastBusStop")) {
|
||||||
if(!isGoingToLastStopOnBusRoute(client)) {
|
if(!isGoingToLastStopOnBusRoute(client)) {
|
||||||
return busRoutes[server.game][getEntityData(client, "ag.busRoute")][getEntityData(client, "ag.lastBusStop")+1];
|
return busRoutes[server.game][getEntityData(client, "ag.busRoute")].positions[getEntityData(client, "ag.lastBusStop")+1];
|
||||||
} else {
|
} else {
|
||||||
let slot = busRoutes[server.game][getEntityData(client, "ag.busRoute")].length-1;
|
let slot = busRoutes[server.game][getEntityData(client, "ag.busRoute")].length-1;
|
||||||
return busRoutes[server.game][getEntityData(client, "ag.busRoute")][slot];
|
return busRoutes[server.game][getEntityData(client, "ag.busRoute")].positions[slot];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,13 +125,20 @@ function isGoingToLastStopOnBusRoute(client) {
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function freezeBusForStop(client) {
|
function freezeBusForStop(client) {
|
||||||
triggerNetworkEvent("ag.freeze", client, true);
|
triggerNetworkEvent("ag.control", client, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function unFreezeBusForStop(client) {
|
function unFreezeBusForStop(client) {
|
||||||
triggerNetworkEvent("ag.freeze", client, false);
|
triggerNetworkEvent("ag.control", client, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function showNextBusStop(client) {
|
||||||
|
let nextStop = getNextStopOnBusRoute(client);
|
||||||
|
triggerNetworkEvent("ag.showBusStop", client, nextStop, getColourByName("busDriverGreen"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
Reference in New Issue
Block a user