Lots of changes

* Add optional offset for some anims (like sitting)
* Fix int/vw chat check not working
* Disable ambience utils for now
* Add ped stop anim util
* Fix enter veh messages
* Fix radio stream not stopping when exiting vehicle
* Fix job items bugging out
* Don't save job equipment items
* Switch to inactive item slot when going on/off duty
* Fix gotospawn not working with int/vw
* Added anims for offset use
* Added element ID & syncer utils
* Fixed wrong job name being shown when setting job vehicle rank
* Added anim move type constants
* Added element collision net events
* Added is any GUI active util
* Fixed showing player list when a GUI is active
This commit is contained in:
Vortrex
2021-09-13 07:22:00 -05:00
parent cfc22a77ee
commit acfc788371
17 changed files with 319 additions and 134 deletions

View File

@@ -99,6 +99,7 @@ function onProcess(event, deltaTime) {
function onKeyUp(event, keyCode, scanCode, keyModifiers) {
processSkinSelectKeyPress(keyCode);
//processKeyDuringAnimation();
}
// ===========================================================================

View File

@@ -1139,6 +1139,46 @@ let switchCharacterSelect = function(firstName, lastName, cash, clan, lastPlayed
characterSelect.window.shown = true;
}
let isAnyGUIActive = function() {
if(infoDialog.window.shown) {
return true;
}
if(yesNoDialog.window.shown) {
return true;
}
if(errorDialog.window.shown) {
return true;
}
if(register.window.shown) {
return true;
}
if(login.window.shown) {
return true;
}
if(newCharacter.window.shown) {
return true;
}
if(characterSelect.window.shown) {
return true;
}
if(twoFactorAuth.window.shown) {
return true;
}
if(listDialog.window.shown) {
return true;
}
return false;
}
// ===========================================================================
addNetworkHandler("vrr.showLogin", function() {

View File

@@ -47,6 +47,7 @@ let streamingRadioElement = false;
let enterPropertyKey = null;
let inAnimation = false;
let forcedAnimation = null;
let calledDeathEvent = false;

View File

@@ -38,6 +38,10 @@ function initScoreBoardListFont() {
// ===========================================================================
function processScoreBoardRendering() {
if(isAnyGUIActive()) {
return false;
}
if(renderScoreBoard) {
if(isKeyDown(SDLK_TAB)) {
if(scoreBoardListFont != null && scoreBoardTitleFont != null) {

View File

@@ -79,12 +79,15 @@ function addAllNetworkHandlers() {
addNetworkHandler("vrr.veh.repair", repairVehicle);
addNetworkHandler("vrr.pedAnim", makePedPlayAnimation);
addNetworkHandler("vrr.pedStopAnim", makePedStopAnimation);
addNetworkHandler("vrr.hideAllGUI", hideAllGUI);
addNetworkHandler("vrr.gameScript", setGameScriptState);
addNetworkHandler("vrr.clientInfo", serverRequestedClientInfo);
addNetworkHandler("vrr.interiorLights", updateInteriorLightsState);
addNetworkHandler("vrr.syncElement", forceSyncElementProperties);
addNetworkHandler("vrr.elementPosition", setElementPosition);
addNetworkHandler("vrr.elementCollisions", setElementCollisionsEnabled);
}
// ===========================================================================
@@ -221,11 +224,24 @@ function setEnterPropertyKey(key) {
function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
if(getGame() < VRR_GAME_GTA_IV) {
if(animType == VRR_ANIMTYPE_ADD) {
getElementFromId(pedId).position = getElementFromId(pedId).position;
if(getGame() == GAME_GTA_VC || getGame() == GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
}
getElementFromId(pedId).addAnimation(animGroup, animId);
if(getElementFromId(pedId) == localPlayer) {
inAnimation = true;
setLocalPlayerControlState(false, false);
localPlayer.collisionsEnabled = false;
}
} else if(animType == VRR_ANIMTYPE_BLEND) {
getElementFromId(pedId).position = getElementFromId(pedId).position;
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
} else if(animType == VRR_ANIMTYPE_MOVEADD) {
getElementFromId(pedId).position = getElementFromId(pedId).position;
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
}
} else {
natives.requestAnims(animGroup);
@@ -281,4 +297,31 @@ function forceSyncElementProperties(elementId) {
syncElementProperties(getElementFromId(elementId));
}
// ===========================================================================
function setElementPosition(elementId, position) {
getElementFromId(elementId).position = position;
}
// ===========================================================================
function setElementCollisionsEnabled(elementId, state) {
getElementFromId(elementId).collisionsEnabled = state;
}
// ===========================================================================
function makePedStopAnimation(pedId) {
if(getGame() == GAME_GTA_VC || getGame() == GAME_GTA_SA) {
getElementFromId(pedId).clearAnimations();
} else {
getElementFromId(pedId).clearObjective();
}
if(getElementFromId(pedId) == localPlayer) {
localPlayer.collisionsEnabled = true;
setLocalPlayerControlState(true, false);
}
}
// ===========================================================================

View File

@@ -20,7 +20,9 @@ function playPlayerAnimationCommand(command, params, client) {
return false;
}
let animationSlot = getAnimationFromParams(params);
let splitParams = params.split(" ");
let animationSlot = getAnimationFromParams(splitParams[0]);
let animationPositionOffset = getAnimationFromParams(splitParams[1]);
if(!animationSlot) {
messagePlayerError(client, "That animation doesn't exist!");
@@ -29,9 +31,18 @@ function playPlayerAnimationCommand(command, params, client) {
}
getPlayerData(client).currentAnimation = animationSlot;
getPlayerData(client).currentAnimationPositionOffset = animationSlot;
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
//setEntityData(getPlayerData(client).ped, "vrr.animation", animationSlot, true);
makePedPlayAnimation(getPlayerData(client).ped, animationSlot);
makePedPlayAnimation(getPlayerData(client).ped, animationSlot, animationPositionOffset);
}
// ===========================================================================
function stopPlayerAnimationCommand(command, params, client) {
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
makePedStopAnimation(getPlayerData(client).ped);
}
// ===========================================================================

View File

@@ -159,7 +159,7 @@ function phoneIncomingToNearbyPlayers(client, messageText) {
function whisperToNearbyPlayers(client, messageText) {
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().talkDistance);
for(let i in clients) {
if(getPlayerInterior(client) == getPlayerInterior(clients[i] && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
if(getPlayerInterior(client) == getPlayerInterior(clients[i]) && getPlayerDimension(client) == getPlayerDimension(clients[i])) {
messagePlayerWhisper(clients[i], client, messageText);
}
}
@@ -170,7 +170,7 @@ function whisperToNearbyPlayers(client, messageText) {
function shoutToNearbyPlayers(client, messageText) {
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().shoutDistance);
for(let i in clients) {
if(getPlayerInterior(client) == getPlayerInterior(clients[i] && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
if(getPlayerInterior(client) == getPlayerInterior(clients[i]) && getPlayerDimension(client) == getPlayerDimension(clients[i])) {
messagePlayerShout(clients[i], client, messageText);
}
}
@@ -181,7 +181,7 @@ function shoutToNearbyPlayers(client, messageText) {
function doActionToNearbyPlayers(client, messageText) {
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().doActionDistance);
for(let i in clients) {
if(getPlayerInterior(client) == getPlayerInterior(clients[i] && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
if(getPlayerInterior(client) == getPlayerInterior(clients[i]) && getPlayerDimension(client) == getPlayerDimension(clients[i])) {
messagePlayerDoAction(clients[i], client, messageText);
}
}
@@ -192,7 +192,7 @@ function doActionToNearbyPlayers(client, messageText) {
function meActionToNearbyPlayers(client, messageText) {
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().meActionDistance);
for(let i in clients) {
if(getPlayerInterior(client) == getPlayerInterior(clients[i] && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
if(getPlayerInterior(client) == getPlayerInterior(clients[i]) && getPlayerDimension(client) == getPlayerDimension(clients[i])) {
messagePlayerMeAction(clients[i], client, messageText);
}
}

View File

@@ -140,23 +140,23 @@ function showGameMessage(client, text, colour, duration) {
// ===========================================================================
function enableCityAmbienceForPlayer(client, clearElements = false) {
if(server.getCVar("civilians") == false) {
return false;
}
//if(server.getCVar("civilians") == false) {
// return false;
//}
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
triggerNetworkEvent("vrr.ambience", client, true);
//logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
//triggerNetworkEvent("vrr.ambience", client, true);
}
// ===========================================================================
function disableCityAmbienceForPlayer(client, clearElements = false) {
if(server.getCVar("civilians") == true) {
return false;
}
//if(server.getCVar("civilians") == true) {
// return false;
//}
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
triggerNetworkEvent("vrr.ambience", client, false, clearElements);
//logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
//triggerNetworkEvent("vrr.ambience", client, false, clearElements);
}
// ===========================================================================
@@ -928,10 +928,35 @@ function sendPlayerEnterPropertyKey(client, key) {
// ===========================================================================
function makePedPlayAnimation(ped, animationSlot) {
function makePedPlayAnimation(ped, animationSlot, positionOffset) {
let animationData = getAnimationData(animationSlot);
if(animationData[9] != VRR_ANIMMOVE_NONE) {
setElementCollisionsEnabled(ped, false);
switch(animationData[9]) {
case VRR_ANIMMOVE_FORWARD:
setElementPosition(ped, getPosInFrontOfPos(getElementPosition(ped), getElementHeading(ped), positionOffset));
break;
triggerNetworkEvent("vrr.pedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4]);
case VRR_ANIMMOVE_BACK:
setElementPosition(ped, getPosBehindPos(getElementPosition(ped), getElementHeading(ped), positionOffset));
break;
case VRR_ANIMMOVE_LEFT:
setElementPosition(ped, getPosToLeftOfPos(getElementPosition(ped), getElementHeading(ped), positionOffset));
break;
case VRR_ANIMMOVE_RIGHT:
setElementPosition(ped, getPosToRightOfPos(getElementPosition(ped), getElementHeading(ped), positionOffset));
break;
}
}
triggerNetworkEvent("vrr.pedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4], animationData[5], positionOffset);
}
// ===========================================================================
function makePedStopAnimation(ped) {
triggerNetworkEvent("vrr.pedStopAnim", null, ped.id);
}
// ===========================================================================

View File

@@ -56,6 +56,7 @@ function loadCommands() {
commandData("e", playPlayerAnimationCommand, "<animation name>", getStaffFlagValue("none"), true, true, "Makes your player ped use an animation"),
commandData("anims", showAnimationListCommand, "", getStaffFlagValue("none"), true, true, "Shows a list of animations"),
commandData("animlist", showAnimationListCommand, "", getStaffFlagValue("none"), true, true, "Shows a list of animations"),
commandData("stopanim", stopPlayerAnimationCommand, "", getStaffFlagValue("none"), true, true, "Stops your current animation"),
],
antiCheat: [
//commandData("addacscriptwl", addAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("developer"), true, true),

View File

@@ -247,14 +247,18 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
messagePlayerTip(client, `Use /vehbuy if you want to buy it.`);
resetVehiclePosition(vehicle);
} else if(getVehicleData(vehicle).rentPrice > 0) {
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for rent! Cost: ${getInlineChatColourByName("lightGrey")}$${getVehicleData(vehicle).rentPrice} per minute`);
messagePlayerTip(client, `Use /vehrent if you want to rent it.`);
resetVehiclePosition(vehicle);
if(getVehicleData(vehicle).rentedBy != client) {
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for rent! Cost: ${getInlineChatColourByName("lightGrey")}$${getVehicleData(vehicle).rentPrice} per minute`);
messagePlayerTip(client, `Use /vehrent if you want to rent it.`);
resetVehiclePosition(vehicle);
} else {
messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for ${getInlineChatColourByName("lightGrey")}$${getVehicleData(vehicle).rentPrice} per minute. ${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/stoprent ${getInlineChatColourByName("white")}if you want to stop renting it.`);
}
} else {
let ownerName = "Nobody";
let ownerType = "None";
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
switch(vehicleData.ownerType) {
switch(getVehicleData(vehicle).ownerType) {
case VRR_VEHOWNER_CLAN:
ownerName = getClanData(getVehicleData(vehicle).ownerId).name;
ownerType = "clan";
@@ -267,7 +271,7 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
case VRR_VEHOWNER_PLAYER:
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
ownerName = `${subAccountData.firstName} ${subAccountData.lastName} [${subAccountData.databaseId}]`;
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
ownerType = "player";
break;
@@ -280,20 +284,20 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
break;
}
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to ${getInlineChatColourByName("lightGrey")}${ownerName} (${ownerType})`);
}
if(!getVehicleData(vehicle).engine) {
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) {
messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} ${getInlineChatColourByName("white")}to start it.`);
} else {
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
}
if(!getVehicleData(vehicle).engine) {
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) {
messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press ${getInlineChatColourByName("lightGrey")}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} ${getInlineChatColourByName("white")}to start it.`);
} else {
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off and you don't have the keys to start it`);
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
}
resetVehiclePosition(vehicle);
} else {
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off and you don't have the keys to start it`);
}
resetVehiclePosition(vehicle);
}
let currentSubAccount = getPlayerCurrentSubAccount(client);
@@ -344,7 +348,7 @@ function onPlayerExitedVehicle(client, vehicle) {
}
}
playRadioStreamForPlayer(client, "");
stopRadioStreamForPlayer(client);
}
// ===========================================================================

View File

@@ -991,16 +991,18 @@ function getPlayerFirstEmptyHotBarSlot(client) {
// ===========================================================================
function cachePlayerHotBarItems(client) {
for(let i = 0 ; i <= 9 ; i++) {
getPlayerData(client).hotBarItems[i] = -1;
}
if(!isPlayerWorking(client)) {
for(let i = 0 ; i <= 9 ; i++) {
getPlayerData(client).hotBarItems[i] = -1;
}
for(let i in getServerData().items) {
if(getItemData(i).ownerType == VRR_ITEM_OWNER_PLAYER) {
if(getItemData(i).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
if(firstSlot != -1) {
getPlayerData(client).hotBarItems[firstSlot] = i;
for(let i in getServerData().items) {
if(getItemData(i).ownerType == VRR_ITEM_OWNER_PLAYER) {
if(getItemData(i).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
if(firstSlot != -1) {
getPlayerData(client).hotBarItems[firstSlot] = i;
}
}
}
}
@@ -1231,7 +1233,9 @@ function getItemTypeData(itemTypeId) {
function saveAllItemsToDatabase() {
for(let i in getServerData().items) {
if(getServerData().items[i].needsSaved) {
saveItemToDatabase(i);
if(getServerData().items[i].databaseId != -1) {
saveItemToDatabase(i);
}
}
}
}
@@ -1282,12 +1286,13 @@ function saveItemToDatabase(itemId) {
function storePlayerItemsInJobLocker(client) {
for(let i in getPlayerData(client).hotBarItems) {
if(getPlayerData(client).hotBarItems[i] != -1) {
//if(getPlayerData(client).hotBarItems[i] != -1) {
getPlayerData(client).jobLockerCache[i] = getPlayerData(client).hotBarItems[i];
getPlayerData(client).hotBarItems[i] = -1;
}
//}
}
cachePlayerHotBarItems(client);
updatePlayerHotBar(client);
}
@@ -1301,12 +1306,14 @@ function restorePlayerJobLockerItems(client) {
}
for(let i in getPlayerData(client).jobLockerCache) {
if(getPlayerData(client).jobLockerCache[i] != -1) {
//if(getPlayerData(client).jobLockerCache[i] != -1) {
getPlayerData(client).hotBarItems[i] = getPlayerData(client).jobLockerCache[i];
getPlayerData(client).jobLockerCache[i] = -1;
}
//}
}
cachePlayerHotBarItems(client);
updatePlayerHotBar(client);
}

View File

@@ -437,6 +437,7 @@ function startWorking(client) {
return false;
}
switchPlayerActiveHotBarSlot(client, -1);
getPlayerCurrentSubAccount(client).skin = getPlayerSkin(client);
storePlayerItemsInJobLocker(client);
messagePlayerInfo(client, "Your personal items have been stored in your locker while you work");
@@ -516,11 +517,14 @@ function givePlayerJobEquipment(client, equipmentId) {
}
let itemId = createItem(getItemTypeIndexFromDatabaseId(getJobData(jobId).equipment[equipmentId].items[i].itemType), value, VRR_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId);
getItemData(itemId).needsSaved = false;
getItemData(itemId).databaseId = -1; // Make sure it doesnt save
let freeSlot = getPlayerFirstEmptyHotBarSlot(client);
getPlayerData(client).hotBarItems[freeSlot] = itemId;
getPlayerData(client).jobEquipmentCache.push(itemId);
updatePlayerHotBar(client);
}
switchPlayerActiveHotBarSlot(client, -1);
}
// ===========================================================================

View File

@@ -364,8 +364,8 @@ function gotoJobLocationCommand(command, params, client) {
function gotoNewPlayerSpawnCommand(command, params, client) {
client.player.velocity = toVector3(0.0, 0.0, 0.0);
setPlayerPosition(client, getServerConfig().newCharacter.spawnPosition);
setPlayerInterior(client, getServerConfig().newCharacter.spawnInterior);
setPlayerDimension(client, getServerConfig().newCharacter.spawnDimension);
setPlayerInterior(client, 0);
setPlayerDimension(client, 0);
updateInteriorLightsForPlayer(client, true);
messagePlayerSuccess(client, `You teleported to the new character spawn location!`);

View File

@@ -2101,7 +2101,7 @@ let gameData = {
["Marina Burger Shot", [816.55, -1617.00, 13.859], 1.396, null],
// Airports
["Los Santos International Airport", [1958.201049,-2182.789794,13.546875], 1.0, null],
["Los Santos International Airport Gate", [1958.201049,-2182.789794,13.546875], 1.0, null],
["Los Santos International Airport Runway", [2054.12, -2493.84, 13.547], 1.569, null],
["Los Santos Stadium", [2694.261474,-1703.194335,11.506717], 1.0, null],
@@ -2969,76 +2969,82 @@ let gameData = {
],
animations: [
[],
// [name, groupId, animId, animType, deltaTime, null, null, null, null, moveType],
[ // GTA III
["walk", 0, 0, VRR_ANIMTYPE_ADD, 0.0],
["jog", 0, 1, VRR_ANIMTYPE_ADD, 0.0],
["look1", 0, 7, VRR_ANIMTYPE_ADD, 0.0],
["tired", 0, 9, VRR_ANIMTYPE_ADD, 0.0],
["raisegun", 0, 10, VRR_ANIMTYPE_ADD, 0.0],
["wave", 0, 12, VRR_ANIMTYPE_ADD, 0.0],
["talk", 0, 11, VRR_ANIMTYPE_ADD, 0.0],
["stomachhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0],
["headhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0],
["throw1", 0, 53, VRR_ANIMTYPE_ADD, 0.0],
["throw2", 0, 54, VRR_ANIMTYPE_ADD, 0.0],
["punch1", 0, 54, VRR_ANIMTYPE_ADD, 0.0],
["headbutt", 0, 70, VRR_ANIMTYPE_ADD, 0.0],
["kick", 0, 71, VRR_ANIMTYPE_ADD, 0.0],
["kneekick", 0, 72, VRR_ANIMTYPE_ADD, 0.0],
["punch2", 0, 73, VRR_ANIMTYPE_ADD, 0.0],
["flipkick", 0, 74, VRR_ANIMTYPE_ADD, 0.0],
["bow", 0, 126, VRR_ANIMTYPE_ADD, 0.0],
["opendoor1", 0, 127, VRR_ANIMTYPE_ADD, 0.0],
["opendoor2", 0, 128, VRR_ANIMTYPE_ADD, 0.0],
["falling", 0, 151, VRR_ANIMTYPE_ADD, 0.0],
["dive", 0, 156, VRR_ANIMTYPE_ADD, 0.0],
["headscratch", 0, 157, VRR_ANIMTYPE_ADD, 0.0],
["look2", 0, 158, VRR_ANIMTYPE_ADD, 0.0],
["plant", 0, 162, VRR_ANIMTYPE_ADD, 0.0],
["cower", 0, 163, VRR_ANIMTYPE_ADD, 0.0],
["aimdown", 0, 160, VRR_ANIMTYPE_ADD, 0.0],
["aimcrouch", 0, 165, VRR_ANIMTYPE_ADD, 0.0],
["throw3", 0, 166, VRR_ANIMTYPE_ADD, 0.0],
["handsup", 0, 167, VRR_ANIMTYPE_ADD, 0.0],
["walk", 0, 0, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["jog", 0, 1, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["look1", 0, 7, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["tired", 0, 9, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["raisegun", 0, 10, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["wave", 0, 12, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["talk", 0, 11, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["stomachhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["headhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["throw1", 0, 53, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["throw2", 0, 54, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["punch1", 0, 54, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["headbutt", 0, 70, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["kick", 0, 71, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["kneekick", 0, 72, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["punch2", 0, 73, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["flipkick", 0, 74, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["bow", 0, 126, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["opendoor1", 0, 127, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["opendoor2", 0, 128, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["falling", 0, 151, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["dive", 0, 156, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["headscratch", 0, 157, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["look2", 0, 158, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["plant", 0, 162, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["cower", 0, 163, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["aimdown", 0, 160, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["aimcrouch", 0, 165, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["throw3", 0, 166, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["handsup", 0, 167, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
],
[ // GTA VC
["walk", 0, 0, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["jog", 0, 1, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["handcuffs", 0, 7, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["tired", 0, 9, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["raisegun", 0, 10, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["wave", 0, 12, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["talk", 0, 11, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["stomachhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["headhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["headbutt", 0, 49, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["kick", 0, 50, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["kneekick", 0, 51, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["throw2", 0, 54, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["punch1", 0, 52, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["punch2", 0, 53, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["flipkick", 0, 54, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["headscratch", 0, 152, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["aimdown", 0, 155, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["look2", 0, 153, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["handsup", 0, 161, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["cower", 0, 162, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["fucku", 0, 163, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["phone", 0, 166, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["sit", 0, 169, VRR_ANIMTYPE_BLEND, 1.0, null, null, null, null],
["atm", 0, 171, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["cpr", 24, 214, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["idle1", 26, 215, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["idle2", 26, 216, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["idle3", 26, 217, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["idle4", 26, 218, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["dance1", 28, 226, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["dance2", 28, 227, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["dance3", 28, 228, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["dance4", 28, 229, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["dance5", 28, 230, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["dance6", 28, 231, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["dance7", 28, 232, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
["walk", 0, 0, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["jog", 0, 1, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["handcuffs", 0, 7, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["tired", 0, 9, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["raisegun", 0, 10, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["wave", 0, 12, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["talk", 0, 11, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["stomachhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["headhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["headbutt", 0, 49, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["kick", 0, 50, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["kneekick", 0, 51, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["throw2", 0, 54, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["punch1", 0, 52, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["punch2", 0, 53, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["flipkick", 0, 54, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["headscratch", 0, 152, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["aimdown", 0, 155, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["look2", 0, 153, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["handsup", 0, 161, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["cower", 0, 162, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["fucku", 0, 163, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["phone", 0, 166, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["sit", 0, 169, VRR_ANIMTYPE_BLEND, 1.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["atm", 0, 171, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["cpr", 24, 214, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["idle1", 26, 215, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["idle2", 26, 216, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["idle3", 26, 217, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["idle4", 26, 218, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["dance1", 28, 226, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["dance2", 28, 227, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["dance3", 28, 228, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["dance4", 28, 229, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["dance5", 28, 230, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["dance6", 28, 231, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["dance7", 28, 232, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
["sitright", 0, 169, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_RIGHT],
["sitleft", 0, 169, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_LEFT],
["sitforward", 0, 169, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_FORWARD],
["sitback", 0, 169, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_BACK],
],
[ // GTA SA
["talk", "PED", "IDLE_CHAT", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
@@ -3178,7 +3184,7 @@ let gameData = {
house: 1361,
clothes: 1361,
misc: 1361,
exit: 1361
exit: 1361,
},
{ // GTA Vice City
@@ -3201,7 +3207,6 @@ let gameData = {
{ // GTA San Andreas
policeStation: 1247,
fireStation: 1318,
hospital: 1240,
ammunation: 1239,
@@ -4816,4 +4821,28 @@ function getPlayerElement(client) {
return client.player;
}
// ===========================================================================
function setElementPosition(element, position) {
triggerNetworkEvent("vrr.elementPosition", getClientFromSyncerId(element.syncer), element.id, position);
}
// ===========================================================================
function getElementPosition(element) {
return element.position;
}
// ===========================================================================
function getElementHeading(element) {
return element.heading;
}
// ===========================================================================
function setElementCollisionsEnabled(element, state) {
triggerNetworkEvent("vrr.elementCollisions", getClientFromSyncerId(element.syncer), element.id, state);
}
// ===========================================================================

View File

@@ -1574,4 +1574,17 @@ function getCurrentTimeStampWithTimeZone(timeZone) {
return date;
};
// ===========================================================================
function getElementId(element) {
return element.id;
}
// ===========================================================================
function getClientFromSyncerId(syncerId) {
return getClients().filter(c => c.index == syncerId)[0];
}
// ===========================================================================

View File

@@ -632,7 +632,7 @@ function rentVehicleCommand(command, params, client) {
getVehicleData(vehicle).needsSaved = true;
meActionToNearbyPlayers(client, `rents the ${getVehicleName(vehicle)} and receives a set of vehicle keys!`);
messagePlayerAlert(client, `You will be charged ${getVehicleData(vehicle).rentPrice} per minute to use this vehicle. To stop renting this vehicle, use /vehrent again.`);
messagePlayerAlert(client, `You will be charged $${getVehicleData(vehicle).rentPrice} per minute to use this vehicle. To stop renting this vehicle, use /vehrent again.`);
if(!getVehicleData(vehicle).engine) {
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) {
@@ -802,7 +802,7 @@ function setVehicleRankCommand(command, params, client) {
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}rank to ${getInlineChatColourByName("lightGrey")}${getClanRankData(getVehicleData(vehicle).ownerId, rankId).name} ${getInlineChatColourByName("white")}of the ${getInlineChatColourByType("clanOrange")}${getClanData(getVehicleData(vehicle).ownerId).name} [#FFFFFFclan!`);
} else if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
getVehicleData(vehicle).rank = rankId;
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}rank to ${getInlineChatColourByName("lightGrey")}${rankId} ${getInlineChatColourByName("white")}of the ${getInlineChatColourByType("jobYellow")}${getJobData(getVehicleData(vehicle).ownerId).name} ${getInlineChatColourByName("white")}job!`);
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}rank to ${getInlineChatColourByName("lightGrey")}${rankId} ${getInlineChatColourByName("white")}of the ${getInlineChatColourByType("jobYellow")}${getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name} ${getInlineChatColourByName("white")}job!`);
}
getVehicleData(vehicle).needsSaved = true;
@@ -1089,13 +1089,10 @@ function reloadAllVehiclesCommand(command, params, client) {
function respawnAllVehiclesCommand(command, params, client) {
for(let i in getServerData().vehicles) {
if(getServerData().vehicles[i].vehicle != null) {
deleteGameElement(getServerData().vehicles[i].vehicle);
getServerData().vehicles[i].vehicle = null;
}
respawnVehicle(vehicle);
}
spawnAllVehicles();
//spawnAllVehicles();
messageAdminAction(`All server vehicles have been respawned by an admin!`);
}
@@ -1124,7 +1121,7 @@ function respawnVehicle(vehicle) {
}
}
getVehicleData(vehicle).needsSaved = true;
//getVehicleData(vehicle).needsSaved = true;
}
// ===========================================================================
@@ -1220,11 +1217,10 @@ function createNewDealershipVehicle(model, spawnPosition, spawnRotation, price,
if(!vehicle) {
return false;
}
setVehicleHeading(spawnRotation);
setVehicleHeading(vehicle, spawnRotation);
addToWorld(vehicle);
let tempVehicleData = new serverClasses.vehicleData(false, vehicle);
tempVehicleData.buyPrice = price;
tempVehicleData.spawnLocked = true;
tempVehicleData.spawnPosition = spawnPosition;
@@ -1234,8 +1230,7 @@ function createNewDealershipVehicle(model, spawnPosition, spawnRotation, price,
tempVehicleData.needsSaved = true;
let slot = getServerData().vehicles.push(tempVehicleData);
setEntityData(vehicle, "vrr.dataSlot", slot, true);
setEntityData(vehicle, "vrr.dataSlot", slot-1, false);
}
// ===========================================================================
@@ -1284,7 +1279,7 @@ function checkVehicleBuying() {
}
createNewDealershipVehicle(getVehicleData(getPlayerData(clients[i]).buyingVehicle).model, getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnPosition, getVehicleData(getPlayerData(clients[i]).buyingVehicle).spawnRotation, getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice, getVehicleData(getPlayerData(clients[i]).buyingVehicle).ownerId);
takePlayerCash(client, getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice);
takePlayerCash(clients[i], getVehicleData(getPlayerData(clients[i]).buyingVehicle).buyPrice);
updatePlayerCash(clients[i]);
getVehicleData(getPlayerData(clients[i]).buyingVehicle).ownerId = getPlayerCurrentSubAccount(clients[i]).databaseId;
getVehicleData(getPlayerData(clients[i]).buyingVehicle).ownerType = VRR_VEHOWNER_PLAYER;

View File

@@ -62,6 +62,13 @@ const VRR_ANIMTYPE_BLEND = 2;
const VRR_ANIMTYPE_SHARED = 3; // Forces this animation to play in sync with another ped's mirrored anim (handshake, kiss, gang signs, etc)
const VRR_ANIMTYPE_SPECIALACTION = 4; // This animtype uses a special action (only in SA)
// Animation Move Types
const VRR_ANIMMOVE_NONE = 0;
const VRR_ANIMMOVE_FORWARD = 1;
const VRR_ANIMMOVE_BACK = 2;
const VRR_ANIMMOVE_LEFT = 3;
const VRR_ANIMMOVE_RIGHT = 4;
// Multiplayer Modifications
const VRR_MPMOD_NONE = 0;
const VRR_MPMOD_GTAC = 1;