Added game checks to some synced properties

This commit is contained in:
Vortrex
2021-03-25 21:34:02 -05:00
parent b78cd8e5f1
commit 5085ee917f

View File

@@ -98,24 +98,28 @@ function syncVehicleProperties(vehicle) {
} }
} }
if(doesEntityDataExist(vehicle, "ag.suspensionHeight")) { //if(doesEntityDataExist(vehicle, "ag.suspensionHeight")) {
let suspensionHeight = getEntityData(vehicle, "ag.suspensionHeight"); // let suspensionHeight = getEntityData(vehicle, "ag.suspensionHeight");
vehicle.setSuspensionHeight(suspensionHeight); // vehicle.setSuspensionHeight(suspensionHeight);
} //}
if(doesEntityDataExist(vehicle, "ag.upgrades")) { if(getGame() == GAME_GTA_SA) {
let upgrades = getEntityData(vehicle, "ag.upgrades"); if(doesEntityDataExist(vehicle, "ag.upgrades")) {
for(let i in upgrades) { let upgrades = getEntityData(vehicle, "ag.upgrades");
vehicle.addUpgrade(upgrades[i]); for(let i in upgrades) {
vehicle.addUpgrade(upgrades[i]);
}
} }
} }
if(doesEntityDataExist(vehicle, "ag.livery")) { if(getGame() == GAME_GTA_SA || getGame() == GAME_GTA_IV) {
let upgrades = getEntityData(vehicle, "ag.livery"); if(doesEntityDataExist(vehicle, "ag.livery")) {
if(getServerGame() == GAME_GTA_SA) { let livery = getEntityData(vehicle, "ag.livery");
vehicle.setPaintJob(livery); if(getGame() == GAME_GTA_SA) {
} else if(getServerGame() == GAME_GTA_IV) { vehicle.setPaintJob(livery);
vehicle.livery = livery; } else if(getGame() == GAME_GTA_IV) {
vehicle.livery = livery;
}
} }
} }
@@ -125,95 +129,212 @@ function syncVehicleProperties(vehicle) {
// =========================================================================== // ===========================================================================
function syncCivilianProperties(civilian) { function syncCivilianProperties(civilian) {
if(doesEntityDataExist(civilian, "ag.scale")) { if(getGame() == GAME_GTA_III) {
let scaleFactor = getEntityData(civilian, "ag.scale"); if(doesEntityDataExist(civilian, "ag.scale")) {
let tempMatrix = civilian.matrix; let scaleFactor = getEntityData(civilian, "ag.scale");
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z)); let tempMatrix = civilian.matrix;
let tempPosition = civilian.position; tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
civilian.matrix = tempMatrix; let tempPosition = civilian.position;
tempPosition.z += scaleFactor.z; civilian.matrix = tempMatrix;
civilian.position = tempPosition; tempPosition.z += scaleFactor.z;
civilian.position = tempPosition;
}
} }
if(doesEntityDataExist(civilian, "ag.fightStyle")) { if(getGame() == GAME_GTA_SA) {
let fightStyle = getEntityData(civilian, "ag.fightStyle"); if(doesEntityDataExist(civilian, "ag.fightStyle")) {
civilian.fightStyle = fightStyle; let fightStyle = getEntityData(civilian, "ag.fightStyle");
civilian.setFightStyle(getGameData().fightStyles[gta.game][0][1]);
}
} }
if(doesEntityDataExist(civilian, "ag.walkStyle")) { if(getGame() == GAME_GTA_III) {
let walkStyle = getEntityData(civilian, "ag.walkStyle"); if(doesEntityDataExist(civilian, "ag.walkStyle")) {
civilian.walkStyle = walkStyle; let walkStyle = getEntityData(civilian, "ag.walkStyle");
//if(gta.game == GAME_GTA_III || gta.game == GAME_GTA_VC) { civilian.walkStyle = walkStyle;
// gta.SET_ANIM_GROUP_FOR_CHAR() }
//}
} }
if(doesEntityDataExist(civilian, "ag.bodyPartHead")) { if(getGame() == GAME_GTA_IV) {
let bodyPartHead = getEntityData(civilian, "ag.bodyPartHead"); if(doesEntityDataExist(civilian, "ag.bodyPropHair")) {
civilian.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]); let bodyPropHair = getEntityData(civilian, "ag.bodyPropHair");
} civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPartUpper")) { if(doesEntityDataExist(civilian, "ag.bodyPropHead")) {
let bodyPartUpper = getEntityData(civilian, "ag.bodyPartUpper"); let bodyPropHead = getEntityData(civilian, "ag.bodyPropHead");
civilian.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]); civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
} }
if(doesEntityDataExist(civilian, "ag.bodyPartLower")) { if(doesEntityDataExist(civilian, "ag.bodyPropEyes")) {
let bodyPartLower = getEntityData(civilian, "ag.bodyPartLower"); let bodyPropEyes = getEntityData(civilian, "ag.bodyPropEyes");
civilian.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]); civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropLeftHand")) {
let bodyPropLeftHand = getEntityData(civilian, "ag.bodyPropLeftHand");
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropRightHand")) {
let bodyPropRightHand = getEntityData(civilian, "ag.bodyPropRightHand");
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropLeftWrist")) {
let bodyPropLeftWrist = getEntityData(civilian, "ag.bodyPropLeftWrist");
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(civilian, "ag.bodyPropRightWrist");
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(civilian, "ag.bodyPropRightWrist");
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropHip")) {
let bodyPropHip = getEntityData(civilian, "ag.bodyPropHip");
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropLeftFoot")) {
let bodyPropLeftFoot = getEntityData(civilian, "ag.bodyPropLeftFoot");
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
}
if(doesEntityDataExist(civilian, "ag.bodyPropRightFoot")) {
let bodyPropRightFoot = getEntityData(civilian, "ag.bodyPropRightFoot");
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
}
} }
} }
// =========================================================================== // ===========================================================================
function syncPlayerProperties(player) { function syncPlayerProperties(player) {
if(doesEntityDataExist(player, "ag.scale")) { if(getGame() == GAME_GTA_III) {
let scaleFactor = getEntityData(player, "ag.scale"); if(doesEntityDataExist(player, "ag.scale")) {
let tempMatrix = player.matrix; let scaleFactor = getEntityData(player, "ag.scale");
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z)); let tempMatrix = player.matrix;
let tempPosition = player.position; tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
player.matrix = tempMatrix; let tempPosition = player.position;
tempPosition.z += scaleFactor.z; player.matrix = tempMatrix;
player.position = tempPosition; tempPosition.z += scaleFactor.z;
player.position = tempPosition;
}
} }
if(doesEntityDataExist(player, "ag.fightStyle")) { if(getGame() == GAME_GTA_SA) {
let fightStyle = getEntityData(player, "ag.fightStyle"); if(doesEntityDataExist(player, "ag.fightStyle")) {
player.fightStyle = fightStyle; let fightStyle = getEntityData(player, "ag.fightStyle");
player.fightStyle = fightStyle;
}
} }
if(doesEntityDataExist(player, "ag.walkStyle")) { //if(getGame() == GAME_GTA_SA) {
let walkStyle = getEntityData(player, "ag.walkStyle"); // if(doesEntityDataExist(player, "ag.walkStyle")) {
player.walkStyle = walkStyle; // let walkStyle = getEntityData(player, "ag.walkStyle");
// player.walkStyle = walkStyle;
// }
//}
if(getGame() == GAME_GTA_IV) {
if(doesEntityDataExist(player, "ag.bodyPartHair")) {
let bodyPartHead = getEntityData(player, "ag.bodyPartHair");
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
}
if(doesEntityDataExist(player, "ag.bodyPartHead")) {
let bodyPartHead = getEntityData(player, "ag.bodyPartHead");
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
}
if(doesEntityDataExist(player, "ag.bodyPartUpper")) {
let bodyPartUpper = getEntityData(player, "ag.bodyPartUpper");
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
}
if(doesEntityDataExist(player, "ag.bodyPartLower")) {
let bodyPartLower = getEntityData(player, "ag.bodyPartLower");
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
}
} }
if(doesEntityDataExist(player, "ag.bodyPartHead")) { if(getGame() == GAME_GTA_IV) {
let bodyPartHead = getEntityData(player, "ag.bodyPartHead"); if(doesEntityDataExist(player, "ag.bodyPropHair")) {
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]); let bodyPropHair = getEntityData(player, "ag.bodyPropHair");
} player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
}
if(doesEntityDataExist(player, "ag.bodyPartUpper")) { if(doesEntityDataExist(player, "ag.bodyPropHead")) {
let bodyPartUpper = getEntityData(player, "ag.bodyPartUpper"); let bodyPropHead = getEntityData(player, "ag.bodyPropHead");
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]); player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
} }
if(doesEntityDataExist(player, "ag.bodyPartLower")) { if(doesEntityDataExist(player, "ag.bodyPropEyes")) {
let bodyPartLower = getEntityData(player, "ag.bodyPartLower"); let bodyPropEyes = getEntityData(player, "ag.bodyPropEyes");
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]); player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropLeftHand")) {
let bodyPropLeftHand = getEntityData(player, "ag.bodyPropLeftHand");
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropRightHand")) {
let bodyPropRightHand = getEntityData(player, "ag.bodyPropRightHand");
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropLeftWrist")) {
let bodyPropLeftWrist = getEntityData(player, "ag.bodyPropLeftWrist");
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(player, "ag.bodyPropRightWrist");
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropRightWrist")) {
let bodyPropRightWrist = getEntityData(player, "ag.bodyPropRightWrist");
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropHip")) {
let bodyPropHip = getEntityData(player, "ag.bodyPropHip");
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropLeftFoot")) {
let bodyPropLeftFoot = getEntityData(player, "ag.bodyPropLeftFoot");
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
}
if(doesEntityDataExist(player, "ag.bodyPropRightFoot")) {
let bodyPropRightFoot = getEntityData(player, "ag.bodyPropRightFoot");
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
}
} }
} }
// =========================================================================== // ===========================================================================
function syncObjectProperties(object) { function syncObjectProperties(object) {
if(doesEntityDataExist(object, "ag.scale")) { if(getGame() == GAME_GTA_III) {
let scaleFactor = getEntityData(object, "ag.scale"); if(doesEntityDataExist(object, "ag.scale")) {
let tempMatrix = object.matrix; let scaleFactor = getEntityData(object, "ag.scale");
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z)); let tempMatrix = object.matrix;
let tempPosition = object.position; tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
object.matrix = tempMatrix; let tempPosition = object.position;
tempPosition.z += scaleFactor.z; object.matrix = tempMatrix;
object.position = tempPosition; tempPosition.z += scaleFactor.z;
object.position = tempPosition;
}
} }
} }