Player ped network ID for IV
This commit is contained in:
@@ -85,7 +85,6 @@ function addAllNetworkHandlers() {
|
|||||||
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
|
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
|
||||||
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
|
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
|
||||||
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
||||||
addNetworkEventHandler("vrr.gameScript", setGameScriptState);
|
|
||||||
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
|
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
|
||||||
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
|
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
|
||||||
|
|
||||||
@@ -105,7 +104,9 @@ function addAllNetworkHandlers() {
|
|||||||
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
|
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
|
||||||
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
|
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.holdObject", localPlayerHoldObject);
|
addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
|
||||||
|
|
||||||
|
addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -210,18 +211,6 @@ function setEnterPropertyKey(key) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setGameScriptState(scriptName, state) {
|
|
||||||
if(state == VRR_GAMESCRIPT_FORCE) {
|
|
||||||
logToConsole(`[VRR.Server] Starting game script '${scriptName}'`);
|
|
||||||
game.startNewScript(scriptName);
|
|
||||||
} else if(state == VRR_GAMESCRIPT_DENY) {
|
|
||||||
logToConsole(`[VRR.Server] Terminating game script '${scriptName}'`);
|
|
||||||
game.terminateScript(scriptName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function serverRequestedClientInfo() {
|
function serverRequestedClientInfo() {
|
||||||
sendServerClientInfo();
|
sendServerClientInfo();
|
||||||
}
|
}
|
||||||
@@ -271,6 +260,9 @@ function setElementCollisionsEnabled(elementId, state) {
|
|||||||
function setLocalPlayerPedPartsAndProps(parts, props) {
|
function setLocalPlayerPedPartsAndProps(parts, props) {
|
||||||
for(let i in parts) {
|
for(let i in parts) {
|
||||||
localPlayer.changeBodyPart(parts[0], parts[1], parts[2]);
|
localPlayer.changeBodyPart(parts[0], parts[1], parts[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(let i in props) {
|
||||||
localPlayer.changeBodyProp(props[0], props[1]);
|
localPlayer.changeBodyProp(props[0], props[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,10 +310,16 @@ function setLocalPlayerSkin(skinId) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function makePedHoldObject(client, modelIndex) {
|
function makePedHoldObject(pedId, modelIndex) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
|
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function sendLocalPlayerNetworkIdToServer() {
|
||||||
|
sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -74,6 +74,7 @@ function addAllNetworkHandlers() {
|
|||||||
addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection);
|
addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection);
|
||||||
addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
|
addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
|
||||||
addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
|
addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
|
||||||
|
addNetworkEventHandler("vrr.playerPedId", receivePlayerPedNetworkId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -223,29 +224,6 @@ function updatePlayerSnowState(client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendExcludedModelsForGroundSnowToPlayer(client) {
|
|
||||||
if(getGameConfig().excludedGroundSnowModels[getServerGame()].length > 0) {
|
|
||||||
for(let i in getGameConfig().excludedGroundSnowModels[getServerGame()]) {
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Misc] Sending excluded model ${i} for ground snow to ${getPlayerName(client)}`);
|
|
||||||
sendNetworkEventToPlayer("vrr.excludeGroundSnow", client, getGameConfig().excludedGroundSnowModels[getServerGame()][i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function sendRemovedWorldObjectsToPlayer(client) {
|
|
||||||
if(getGameConfig().removedWorldObjects[getServerGame()].length > 0) {
|
|
||||||
for(let i in getGameConfig().removedWorldObjects[getServerGame()]) {
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending removed world object ${i} (${getGameConfig().removedWorldObjects[getServerGame()][i][0]}) to ${getPlayerName(client)}`);
|
|
||||||
sendNetworkEventToPlayer("vrr.removeWorldObject", client, getGameConfig().removedWorldObjects[getServerGame()][i][0], getGameConfig().removedWorldObjects[getServerGame()][i][1], getGameConfig().removedWorldObjects[getServerGame()][i][2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function updatePlayerHotBar(client) {
|
function updatePlayerHotBar(client) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
||||||
let tempHotBarItems = [];
|
let tempHotBarItems = [];
|
||||||
@@ -1053,12 +1031,6 @@ function setPlayerHeadLookPosition(client, position) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerGameScriptState(client, scriptName, state) {
|
|
||||||
sendNetworkEventToPlayer("vrr.gameScript", client, scriptName, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function requestClientInfo(client) {
|
function requestClientInfo(client) {
|
||||||
sendNetworkEventToPlayer("vrr.clientInfo", client);
|
sendNetworkEventToPlayer("vrr.clientInfo", client);
|
||||||
}
|
}
|
||||||
@@ -1078,7 +1050,10 @@ function forcePlayerToSyncElementProperties(client, element) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerPedPartsAndProps(client) {
|
function sendPlayerPedPartsAndProps(client) {
|
||||||
sendNetworkEventToPlayer("vrr.ped")
|
let bodyParts = getPlayerCurrentSubAccount(client).bodyParts;
|
||||||
|
let bodyProps = getPlayerCurrentSubAccount(client).bodyProps;
|
||||||
|
|
||||||
|
sendNetworkEventToPlayer("vrr.ped", client, [bodyParts.hair, bodyParts.head, bodyParts.upper, bodyParts.lower], [bodyProps.hair, bodyProps.eyes, bodyProps.head, bodyProps.leftHand, bodyProps.rightHand, bodyProps.leftWrist, bodyProps.rightWrist, bodyParts.hip, bodyProps.leftFoot, bodyProps.rightFoot]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1171,7 +1146,19 @@ function sendAllHouseEntrancesToPlayer(client) {
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
function makePlayerHoldObjectModel(client, modelIndex) {
|
function makePlayerHoldObjectModel(client, modelIndex) {
|
||||||
sendNetworkEventToPlayer("vrr.holdObject", client, modelIndex);
|
sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).pedId, modelIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==========================================================================
|
||||||
|
|
||||||
|
function receivePlayerPedNetworkId(client, pedId) {
|
||||||
|
getPlayerData(client).pedId = pedId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==========================================================================
|
||||||
|
|
||||||
|
function requestPlayerPedNetworkId(client) {
|
||||||
|
sendNetworkEventToPlayer("vrr.playerPedId", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -602,6 +602,8 @@ function onPlayerSpawn(client) {
|
|||||||
//sendAllJobLocationsToPlayer(client);
|
//sendAllJobLocationsToPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requestPlayerPedNetworkId(client);
|
||||||
|
|
||||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user