Offload vehicle purchase logic to clientside
This commit is contained in:
@@ -819,4 +819,34 @@ function processGameSpecifics() {
|
||||
destroyAutoCreatedPickups();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processVehiclePurchasing() {
|
||||
if(vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
|
||||
if(inVehicle == false) {
|
||||
vehiclePurchaseState = VRR_VEHBUYSTATE_EXITEDVEH;
|
||||
triggerNetworkEvent("vrr.vehBuyState", VRR_VEHBUYSTATE_EXITEDVEH);
|
||||
return false;
|
||||
} else {
|
||||
if(vehiclePurchasing.id == inVehicle) {
|
||||
if(getDistance(inVehicle.position, vehiclePurchasePosition) >= 25) {
|
||||
vehiclePurchaseState = VRR_VEHBUYSTATE_FARENOUGH;
|
||||
triggerNetworkEvent("vrr.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
|
||||
}
|
||||
} else {
|
||||
vehiclePurchaseState = VRR_VEHBUYSTATE_WRONGVEH;
|
||||
triggerNetworkEvent("vrr.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setVehiclePurchaseState(state, vehicle, position) {
|
||||
vehiclePurchaseState = state;
|
||||
vehiclePurchasePosition = position;
|
||||
vehiclePurchasing = vehicle;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user