Extra spawn checks, fix keybinds, game time fix
This commit is contained in:
@@ -98,6 +98,7 @@ function onPlayerChat(event, client, messageText) {
|
|||||||
|
|
||||||
function onProcess(event, deltaTime) {
|
function onProcess(event, deltaTime) {
|
||||||
checkVehicleBuying();
|
checkVehicleBuying();
|
||||||
|
updateServerGameTime();
|
||||||
//checkPlayerSpawning();
|
//checkPlayerSpawning();
|
||||||
//checkPlayerPedState();
|
//checkPlayerPedState();
|
||||||
//checkVehicleBurning();
|
//checkVehicleBurning();
|
||||||
@@ -121,7 +122,7 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
|||||||
if(getVehicleData(vehicle).locked) {
|
if(getVehicleData(vehicle).locked) {
|
||||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||||
if(doesPlayerHaveKeyBindForCommand(client, "lock")) {
|
if(doesPlayerHaveKeyBindForCommand(client, "lock")) {
|
||||||
messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press ${getInlineChatColourByName("lightGrey")}${sdl.getKeyName(getPlayerKeyBindForCommand(client, "lock").key)} ${getInlineChatColourByName("white")}to unlock it.`);
|
messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))} ${getInlineChatColourByName("white")}to unlock it.`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
||||||
}
|
}
|
||||||
@@ -238,7 +239,7 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
|||||||
if(!getVehicleData(vehicle).engine) {
|
if(!getVehicleData(vehicle).engine) {
|
||||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||||
if(doesPlayerHaveKeyBindForCommand(client, "engine")) {
|
if(doesPlayerHaveKeyBindForCommand(client, "engine")) {
|
||||||
messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press ${getInlineChatColourByName("lightGrey")}${sdl.getKeyName(getPlayerKeyBindForCommand(client, "engine").key)} ${getInlineChatColourByName("white")}to start it.`);
|
messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} ${getInlineChatColourByName("white")}to start it.`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
|
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
|
||||||
}
|
}
|
||||||
@@ -271,8 +272,7 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
|||||||
|
|
||||||
if(getVehicleData(vehicle).streamingRadioStation != -1) {
|
if(getVehicleData(vehicle).streamingRadioStation != -1) {
|
||||||
if(getPlayerData(client).streamingRadioStation != getVehicleData(vehicle).streamingRadioStation) {
|
if(getPlayerData(client).streamingRadioStation != getVehicleData(vehicle).streamingRadioStation) {
|
||||||
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url);
|
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, getPlayerData(client).streamingRadioVolume);
|
||||||
setPlayerStreamingRadioVolume(client, getPlayerData(client).streamingRadioVolume);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}, client.ping+500);
|
//}, client.ping+500);
|
||||||
@@ -345,9 +345,9 @@ function onPlayerDeath(client, position) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedSpawn(ped) {
|
function onPedSpawn(ped) {
|
||||||
//if(ped.type == ELEMENT_PLAYER) {
|
if(ped.type == ELEMENT_PLAYER) {
|
||||||
// setTimeout(onPlayerSpawn, 500, ped);
|
setTimeout(onPlayerSpawn, 250, ped);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -365,7 +365,21 @@ function onPlayerSpawn(client) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||||
if(!getPlayerData(client)) {
|
if(!getPlayerData(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||||
client.disconnect();
|
client.despawnPlayer();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||||
|
if(!getPlayerData(client).loggedIn) {
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||||
|
client.despawnPlayer();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||||
|
if(getPlayerData(client).currentSubAccount == -1) {
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||||
|
client.despawnPlayer();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,7 +476,7 @@ function onPlayerSpawn(client) {
|
|||||||
|
|
||||||
if(doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
if(doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId}, ${sdl.getKeyName(keyId)}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId}, ${toUpperCase(getKeyNameFromId(keyId))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendPlayerEnterPropertyKey(client, keyId);
|
sendPlayerEnterPropertyKey(client, keyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user