Merge branch 'nightly' into ragemp
This commit is contained in:
@@ -92,6 +92,8 @@ class BusinessData {
|
||||
this.streamingRadioStation = 0;
|
||||
//this.streamingRadioStationIndex = -1;
|
||||
|
||||
this.paintBallPlayers = [];
|
||||
|
||||
this.labelHelpType = AGRP_PROPLABEL_INFO_NONE;
|
||||
|
||||
if (dbAssoc) {
|
||||
@@ -850,6 +852,7 @@ function setBusinessEntranceFeeCommand(command, params, client) {
|
||||
|
||||
getBusinessData(businessId).entranceFee = entranceFee;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to {ALTCOLOUR}${getCurrencyString(entranceFee)}`);
|
||||
}
|
||||
|
||||
@@ -2914,6 +2917,7 @@ function updateBusinessPickupLabelData(businessId) {
|
||||
}
|
||||
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "agrp.label.fee", getBusinessData(businessId).entranceFee, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -314,18 +314,14 @@ function loadGlobalConfig() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromGameAndPort(gameId, port) {
|
||||
async function loadServerConfigFromGameAndPort(gameId, port) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM svr_main WHERE svr_game = ${gameId} AND svr_port = ${port} LIMIT 1;`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if (dbQuery) {
|
||||
if (dbQuery.numRows > 0) {
|
||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
return tempServerConfigData;
|
||||
}
|
||||
let dbAssoc = await fetchQueryAssoc(dbConnection, dbQueryString);
|
||||
if (dbAssoc.length > 0) {
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc[0]);
|
||||
return tempServerConfigData;
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
@@ -334,18 +330,15 @@ function loadServerConfigFromGameAndPort(gameId, port) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromGame(gameId) {
|
||||
async function loadServerConfigFromGame(gameId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM svr_main WHERE svr_game = ${gameId} LIMIT 1;`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if (dbQuery) {
|
||||
if (dbQuery.numRows > 0) {
|
||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
return tempServerConfigData;
|
||||
}
|
||||
let dbAssocArray = await fetchQueryAssoc(dbConnection, dbQueryString);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `${dbAssocArray[0]}`);
|
||||
if (dbAssocArray.length > 0) {
|
||||
let tempServerConfigData = new ServerConfigData(dbAssocArray[0]);
|
||||
return tempServerConfigData;
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
@@ -354,21 +347,17 @@ function loadServerConfigFromGame(gameId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromId(tempServerId) {
|
||||
async function loadServerConfigFromId(tempServerId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM svr_main WHERE svr_id = ${tempServerId} LIMIT 1;`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if (dbQuery) {
|
||||
if (dbQuery.numRows > 0) {
|
||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
return tempServerConfigData;
|
||||
}
|
||||
let dbAssoc = await fetchQueryAssoc(dbConnection, dbQueryString);
|
||||
if (dbAssoc.length > 0) {
|
||||
let tempServerConfigData = new ServerConfigData(dbAssoc[0]);
|
||||
return tempServerConfigData;
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -917,8 +917,18 @@ function freeDatabaseQuery(dbQuery) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function fetchQueryAssoc(dbQuery) {
|
||||
return dbQuery.fetchAssoc();
|
||||
async function fetchQueryAssoc(dbConnection, dbQueryString) {
|
||||
//logToConsole(LOG_DEBUG, dbQueryString);
|
||||
let dbQuery = dbConnection.query(dbQueryString);
|
||||
let assocArray = [];
|
||||
let dbAssoc = null;
|
||||
|
||||
while (dbAssoc = dbQuery.fetchAssoc()) {
|
||||
assocArray.push(dbAssoc);
|
||||
//logToConsole(LOG_DEBUG | LOG_WARN, dbAssoc["svr_id"]);
|
||||
}
|
||||
|
||||
return assocArray;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -71,10 +71,15 @@ function startPaintBall(client) {
|
||||
|
||||
getPlayerData(client).inPaintBall = true;
|
||||
getPlayerData(client).paintBallBusiness = getPlayerBusiness(client);
|
||||
getPlayerData(client).paintBallKills = 0;
|
||||
getPlayerData(client).paintBallDeaths = 0;
|
||||
getBusinessData(getPlayerData(client).paintBallBusiness).paintBallPlayers.push(client.index);
|
||||
getBusinessData(getPlayerData(client).paintBallBusiness).paintBallPot += getBusinessData(getPlayerData(client).paintBallBusiness).entranceFee * 2;
|
||||
|
||||
givePlayerPaintBallItems(client);
|
||||
|
||||
messagePlayerAlert(client, getLocaleString(client, "JoinedPaintBall"));
|
||||
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
}
|
||||
|
||||
@@ -90,7 +95,31 @@ function stopPaintBall(client) {
|
||||
deletePaintBallItems(client);
|
||||
restorePlayerTempLockerItems(client);
|
||||
|
||||
let tempBusiness = getPlayerData(client).paintBallBusiness;
|
||||
|
||||
messagePlayerAlert(client, getLocaleString(client, "LeftPaintBall"));
|
||||
|
||||
getBusinessData(tempBusiness).paintBallPlayers.splice(getBusinessData(tempBusiness).paintBallPlayers.indexOf(client.index), 1);
|
||||
|
||||
if (getBusinessData(tempBusiness).paintBallPlayers.length == 0) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "PaintBallEnded"));
|
||||
messagePlayerInfo(client, getLocaleString(client, "YourPaintBallResults", getPlayerData(client).paintBallKills, getPlayerData(client).paintBallDeaths));
|
||||
|
||||
//messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderEventWinners")));
|
||||
//messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderEventWinners")));
|
||||
|
||||
givePlayerCash(client, getBusinessData(tempBusiness).paintBallPot);
|
||||
getBusinessData(tempBusiness).paintBallPot = 0;
|
||||
}
|
||||
|
||||
getPlayerData(client).inPaintBall = false;
|
||||
getPlayerData(client).paintBallBusiness = false;
|
||||
getPlayerData(client).tempLockerType = AGRP_TEMP_LOCKER_TYPE_NONE;
|
||||
getPlayerData(client).paintBallKills = 0;
|
||||
getPlayerData(client).paintBallDeaths = 0;
|
||||
|
||||
//checkRemainingPaintBallPlayers(tempBusiness);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
}
|
||||
|
||||
@@ -164,4 +193,12 @@ function isPlayerInPaintBall(client) {
|
||||
return getPlayerData(client).inPaintBall;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkRemainingPaintBallPlayers(businessIndex) {
|
||||
//if (getBusinessData(businessIndex).paintBallPlayers.length == 0) {
|
||||
//
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user