Fix server enter veh event for IV
This commit is contained in:
@@ -44,8 +44,8 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(blipModel != -1) {
|
|
||||||
let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||||
|
if(blipModel != -1) {
|
||||||
let blipId = natives.addBlipForCoord(entrancePosition);
|
let blipId = natives.addBlipForCoord(entrancePosition);
|
||||||
if(blipId) {
|
if(blipId) {
|
||||||
tempHouseData.blipId = blipId;
|
tempHouseData.blipId = blipId;
|
||||||
@@ -53,11 +53,11 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
|
|||||||
natives.setBlipMarkerLongDistance(blipId, false);
|
natives.setBlipMarkerLongDistance(blipId, false);
|
||||||
//natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
//natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
houses.push(tempHouseData);
|
houses.push(tempHouseData);
|
||||||
setAllHouseDataIndexes();
|
setAllHouseDataIndexes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -240,39 +240,24 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let vehicle = null;
|
||||||
|
|
||||||
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
|
vehicle = getVehicleFromIVNetworkId(clientVehicle);
|
||||||
|
} else {
|
||||||
if(client.player == null) {
|
if(client.player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
await waitUntil(() => client != null && client.player != null && client.player.vehicle != null);
|
await waitUntil(() => client != null && client.player != null && client.player.vehicle != null);
|
||||||
//setTimeout(function() {
|
|
||||||
//if(client.player.vehicle == null) {
|
|
||||||
// onPlayerEnteredVehicle(client, clientVehicle, seat);
|
|
||||||
//}
|
|
||||||
|
|
||||||
let vehicle = client.player.vehicle;
|
vehicle = client.player.vehicle;
|
||||||
|
|
||||||
//if(vehicle.syncer != client.index) {
|
|
||||||
// if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
|
||||||
// vehicle.setSyncer(client, true);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
if(vehicle.owner != -1) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getVehicleData(vehicle)) {
|
if(!getVehicleData(vehicle)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(getPlayerData(client).enteringVehicle == null || getPlayerData(client).enteringVehicle != vehicle) {
|
|
||||||
// messagePlayerError(client, "You can't enter this vehicle!");
|
|
||||||
// removePlayerFromVehicle(client);
|
|
||||||
// messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}tried to warp into a locked vehicle`);
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||||
|
|
||||||
getPlayerData(client).lastVehicle = vehicle;
|
getPlayerData(client).lastVehicle = vehicle;
|
||||||
@@ -364,7 +349,6 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
|||||||
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}, client.ping+500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -492,14 +476,14 @@ function onPlayerSpawn(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[VRR.Event] Setting player skin for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).skin}`);
|
if(isCustomCameraSupported()) {
|
||||||
//setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
|
||||||
|
|
||||||
//if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
|
|
||||||
restorePlayerCamera(client);
|
restorePlayerCamera(client);
|
||||||
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||||
|
if(areServerElementsSupported()) {
|
||||||
getPlayerData(client).ped = client.player;
|
getPlayerData(client).ped = client.player;
|
||||||
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
||||||
messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white"));
|
messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white"));
|
||||||
@@ -532,9 +516,11 @@ function onPlayerSpawn(client) {
|
|||||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||||
|
if(isSnowSupported()) {
|
||||||
updatePlayerSnowState(client);
|
updatePlayerSnowState(client);
|
||||||
|
}
|
||||||
|
|
||||||
if(getServerGame() == VRR_GAME_GTA_SA) {
|
if(areServerElementsSupported() && getServerGame() == VRR_GAME_GTA_SA) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
||||||
setEntityData(client.player, "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
setEntityData(client.player, "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||||
|
|
||||||
@@ -579,16 +565,18 @@ function onPlayerSpawn(client) {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
if(isGTAIV()) {
|
if(isGTAIV()) {
|
||||||
sendPlayerPedPartsAndProps(client);
|
//sendPlayerPedPartsAndProps(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||||
|
|
||||||
|
if(areServerElementsSupported()) {
|
||||||
syncPlayerProperties(client);
|
syncPlayerProperties(client);
|
||||||
//setTimeout(function() {
|
//setTimeout(function() {
|
||||||
// syncPlayerProperties(client);
|
// syncPlayerProperties(client);
|
||||||
//}, 1000);
|
//}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
@@ -597,15 +585,14 @@ function onPlayerSpawn(client) {
|
|||||||
updateAllPlayerNameTags();
|
updateAllPlayerNameTags();
|
||||||
|
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
sendAllBusinessEntrancesToPlayer(client);
|
sendAllBusinessesToPlayer(client);
|
||||||
sendAllHouseEntrancesToPlayer(client);
|
sendAllHousesToPlayer(client);
|
||||||
//sendAllJobLocationsToPlayer(client);
|
//sendAllJobLocationsToPlayer(client);
|
||||||
}
|
|
||||||
|
|
||||||
requestPlayerPedNetworkId(client);
|
requestPlayerPedNetworkId(client);
|
||||||
|
}
|
||||||
|
|
||||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user