Use radio station index
This commit is contained in:
@@ -315,10 +315,11 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closestProperty.streamingRadioStation != -1) {
|
let radioStationIndex = closestProperty.streamingRadioStationIndex;
|
||||||
if (getRadioStationData(closestProperty.streamingRadioStation)) {
|
if (radioStationIndex != -1) {
|
||||||
playRadioStreamForPlayer(client, getRadioStationData(closestProperty.streamingRadioStation).url);
|
if (getRadioStationData(radioStationIndex)) {
|
||||||
getPlayerData(client).streamingRadioStation = closestProperty.streamingRadioStation;
|
playRadioStreamForPlayer(client, getRadioStationData(radioStationIndex).url);
|
||||||
|
getPlayerData(client).streamingRadioStation = radioStationIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -371,17 +372,17 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
let inBusiness = getPlayerBusiness(client);
|
let inBusiness = getPlayerBusiness(client);
|
||||||
|
|
||||||
if (inBusiness != -1) {
|
if (inBusiness != -1) {
|
||||||
if (getBusinessData(inBusiness).streamingRadioStation != -1) {
|
if (getBusinessData(inBusiness).streamingRadioStationIndex != -1) {
|
||||||
if (getRadioStationData(getBusinessData(inBusiness).streamingRadioStation)) {
|
if (getRadioStationData(getBusinessData(inBusiness).streamingRadioStationIndex)) {
|
||||||
playRadioStreamForPlayer(client, getRadioStationData(getBusinessData(inBusiness).streamingRadioStation).url);
|
playRadioStreamForPlayer(client, getRadioStationData(getBusinessData(inBusiness).streamingRadioStationIndex).url);
|
||||||
getPlayerData(client).streamingRadioStation = getBusinessData(inBusiness).streamingRadioStation;
|
getPlayerData(client).streamingRadioStation = getBusinessData(inBusiness).streamingRadioStationIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (inHouse != -1) {
|
} else if (inHouse != -1) {
|
||||||
if (getHouseData(inHouse).streamingRadioStation != -1) {
|
if (getHouseData(inHouse).streamingRadioStationIndex != -1) {
|
||||||
if (getRadioStationData(getHouseData(inHouse).streamingRadioStation)) {
|
if (getRadioStationData(getHouseData(inHouse).streamingRadioStationIndex)) {
|
||||||
playRadioStreamForPlayer(client, getRadioStationData(getHouseData(inHouse).streamingRadioStation).url);
|
playRadioStreamForPlayer(client, getRadioStationData(getHouseData(inHouse).streamingRadioStationIndex).url);
|
||||||
getPlayerData(client).streamingRadioStation = getHouseData(inHouse).streamingRadioStation;
|
getPlayerData(client).streamingRadioStation = getHouseData(inHouse).streamingRadioStationIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,10 +118,11 @@ function playStreamingRadioCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (doesEntityDataExist(client, "agrp.inHouse")) {
|
if (isPlayerInAnyHouse(client)) {
|
||||||
let houseId = getEntityData(client, "agrp.inHouse");
|
let houseId = getPlayerHouse(client);
|
||||||
if (radioStationId == 0) {
|
if (radioStationId == 0) {
|
||||||
getHouseData(houseId).streamingRadioStation = -1;
|
getHouseData(houseId).streamingRadioStationIndex = -1;
|
||||||
|
getHouseData(houseId).streamingRadioStationIndex = 0;
|
||||||
getHouseData(houseId).needsSaved = true;
|
getHouseData(houseId).needsSaved = true;
|
||||||
getPlayerData(client).streamingRadioStation = -1;
|
getPlayerData(client).streamingRadioStation = -1;
|
||||||
meActionToNearbyPlayers(client, `turns off the house radio`);
|
meActionToNearbyPlayers(client, `turns off the house radio`);
|
||||||
@@ -133,7 +134,8 @@ function playStreamingRadioCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getHouseData(houseId).streamingRadioStation = radioStationId - 1;
|
getHouseData(houseId).streamingRadioStationIndex = radioStationId - 1;
|
||||||
|
getHouseData(houseId).streamingRadioStation = getRadioStationData(radioStationId - 1).databaseId;
|
||||||
getHouseData(houseId).needsSaved = true;
|
getHouseData(houseId).needsSaved = true;
|
||||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
||||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionHouseRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
meActionToNearbyPlayers(client, getLocaleString(client, "ActionHouseRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
||||||
@@ -148,7 +150,8 @@ function playStreamingRadioCommand(command, params, client) {
|
|||||||
} else if (isPlayerInAnyBusiness(client)) {
|
} else if (isPlayerInAnyBusiness(client)) {
|
||||||
let businessId = getPlayerBusiness(client);
|
let businessId = getPlayerBusiness(client);
|
||||||
if (radioStationId == 0) {
|
if (radioStationId == 0) {
|
||||||
getBusinessData(businessId).streamingRadioStation = -1;
|
getBusinessData(businessId).streamingRadioStation = 0;
|
||||||
|
getBusinessData(businessId).streamingRadioStationIndex = -1;
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
getPlayerData(client).streamingRadioStation = -1;
|
getPlayerData(client).streamingRadioStation = -1;
|
||||||
meActionToNearbyPlayers(client, `turns off the business radio`);
|
meActionToNearbyPlayers(client, `turns off the business radio`);
|
||||||
@@ -160,7 +163,8 @@ function playStreamingRadioCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getBusinessData(businessId).streamingRadioStation = radioStationId - 1;
|
getBusinessData(businessId).streamingRadioStationIndex = radioStationId - 1;
|
||||||
|
getBusinessData(businessId).streamingRadioStation = getRadioStationData(radioStationId - 1).databaseId;
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
||||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionBusinessRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
meActionToNearbyPlayers(client, getLocaleString(client, "ActionBusinessRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
||||||
|
|||||||
Reference in New Issue
Block a user