More indentation conversion
This commit is contained in:
8
scripts/client/vehicle.js
Normal file
8
scripts/client/vehicle.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// ===========================================================================
|
||||||
|
// Vortrex's Roleplay Resource
|
||||||
|
// https://github.com/VortrexFTW/gtac_roleplay
|
||||||
|
// ===========================================================================
|
||||||
|
// FILE: vehicle.js
|
||||||
|
// DESC: Provides vehicle functions and arrays with data
|
||||||
|
// TYPE: Client (JavaScript)
|
||||||
|
// ===========================================================================
|
||||||
@@ -10,27 +10,27 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerHandCuffed(client) {
|
function isPlayerHandCuffed(client) {
|
||||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function handCuffPlayer(client) {
|
function handCuffPlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
||||||
setPlayerControlState(client, false);
|
setPlayerControlState(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unHandCuffPlayer(client) {
|
function unHandCuffPlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerSurrendered(client) {
|
function isPlayerSurrendered(client) {
|
||||||
return true; //(getPlayerData(client).pedState == VRR_PEDSTATE_TAZED || getPlayerData(client).pedState == VRR_PEDSTATE_HANDSUP);
|
return true; //(getPlayerData(client).pedState == VRR_PEDSTATE_TAZED || getPlayerData(client).pedState == VRR_PEDSTATE_HANDSUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,48 +8,48 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getItemWithPhoneNumber(phoneNumber) {
|
function getItemWithPhoneNumber(phoneNumber) {
|
||||||
for(let i in getServerData().items) {
|
for(let i in getServerData().items) {
|
||||||
if(getItemTypeData(getItemData(i).itemTypeIndex).useType == VRR_ITEM_USETYPE_PHONE) {
|
if(getItemTypeData(getItemData(i).itemTypeIndex).useType == VRR_ITEM_USETYPE_PHONE) {
|
||||||
if(getItemData(i).value == phoneNumber) {
|
if(getItemData(i).value == phoneNumber) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPhoneItemEnabled(itemIndex) {
|
function isPhoneItemEnabled(itemIndex) {
|
||||||
return getItemData(itemIndex).enabled;
|
return getItemData(itemIndex).enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function ringPhoneForNearbyPlayers(itemIndex) {
|
function ringPhoneForNearbyPlayers(itemIndex) {
|
||||||
/*
|
/*
|
||||||
if(isPhoneItemEnabled(itemIndex)) {
|
if(isPhoneItemEnabled(itemIndex)) {
|
||||||
switch(getItemData(itemIndex).ownerType) {
|
switch(getItemData(itemIndex).ownerType) {
|
||||||
case VRR_ITEM_OWNER_GROUND:
|
case VRR_ITEM_OWNER_GROUND:
|
||||||
playRingtoneForPlayersInRange(getItemData(itemIndex).position, getItemData(i).extra);
|
playRingtoneForPlayersInRange(getItemData(itemIndex).position, getItemData(i).extra);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_ITEM_OWNER_VEHTRUNK:
|
case VRR_ITEM_OWNER_VEHTRUNK:
|
||||||
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_ITEM_OWNER_VEHDASH:
|
case VRR_ITEM_OWNER_VEHDASH:
|
||||||
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function phoneTransmit(radioFrequency, messageText, transmittingPlayer) {
|
function phoneTransmit(radioFrequency, messageText, transmittingPlayer) {
|
||||||
phoneOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
phoneOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -10,21 +10,21 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerTied(client) {
|
function isPlayerTied(client) {
|
||||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function ropeTiePlayer(client) {
|
function ropeTiePlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
||||||
setPlayerControlState(client, false);
|
setPlayerControlState(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function ropeUnTiePlayer(client) {
|
function ropeUnTiePlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -10,34 +10,34 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerTazed(client) {
|
function isPlayerTazed(client) {
|
||||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_TAZED);
|
return (getPlayerData(client).pedState == VRR_PEDSTATE_TAZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function tazePlayer(client) {
|
function tazePlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_TAZED;
|
getPlayerData(client).pedState = VRR_PEDSTATE_TAZED;
|
||||||
setPlayerControlState(client, false);
|
setPlayerControlState(client, false);
|
||||||
|
|
||||||
let animationId = getAnimationFromParams("tazed");
|
let animationId = getAnimationFromParams("tazed");
|
||||||
if(animationId != false) {
|
if(animationId != false) {
|
||||||
forcePlayerPlayAnimation(client, animationId);
|
forcePlayerPlayAnimation(client, animationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
unTazePlayer(client);
|
unTazePlayer(client);
|
||||||
doActionToNearbyPlayers(client, `The tazer effect wears off`);
|
doActionToNearbyPlayers(client, `The tazer effect wears off`);
|
||||||
}, getGlobalConfig().tazerEffectDuration);
|
}, getGlobalConfig().tazerEffectDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unTazePlayer(client) {
|
function unTazePlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||||
|
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
|
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
|
||||||
makePedStopAnimation(getPlayerData(client).ped);
|
makePedStopAnimation(getPlayerData(client).ped);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ function getPlayerActiveWalkieTalkieFrequency(client) {
|
|||||||
return getItemData(getPlayerData(client).hotBarItems[walkieTalkieSlot]).value;
|
return getItemData(getPlayerData(client).hotBarItems[walkieTalkieSlot]).value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function walkieTalkieTransmit(radioFrequency, messageText, transmittingPlayer) {
|
function walkieTalkieTransmit(radioFrequency, messageText, transmittingPlayer) {
|
||||||
walkieTalkieOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
walkieTalkieOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
||||||
|
|
||||||
//let clients = getServerData().items;
|
//let clients = getServerData().items;
|
||||||
//for(let i in clients) {
|
//for(let i in clients) {
|
||||||
|
|||||||
@@ -8,157 +8,157 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function policeTazerCommand(command, params, client) {
|
function policeTazerCommand(command, params, client) {
|
||||||
if(!canPlayerUseJobs(client)) {
|
if(!canPlayerUseJobs(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canPlayerUsePoliceJob(client)) {
|
if(!canPlayerUsePoliceJob(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerWorking(client)) {
|
if(!isPlayerWorking(client)) {
|
||||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||||
messagePlayerError(client, "You don't have a police job.");
|
messagePlayerError(client, "You don't have a police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function policeCuffCommand(command, params, client) {
|
function policeCuffCommand(command, params, client) {
|
||||||
if(!canPlayerUseJobs(client)) {
|
if(!canPlayerUseJobs(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canPlayerUsePoliceJob(client)) {
|
if(!canPlayerUsePoliceJob(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerWorking(client)) {
|
if(!isPlayerWorking(client)) {
|
||||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||||
messagePlayerError(client, "You don't have a police job.");
|
messagePlayerError(client, "You don't have a police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function policeArrestCommand(command, params, client) {
|
function policeArrestCommand(command, params, client) {
|
||||||
if(!canPlayerUseJobs(client)) {
|
if(!canPlayerUseJobs(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canPlayerUsePoliceJob(client)) {
|
if(!canPlayerUsePoliceJob(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerWorking(client)) {
|
if(!isPlayerWorking(client)) {
|
||||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||||
messagePlayerError(client, "You don't have a police job.");
|
messagePlayerError(client, "You don't have a police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function policeSearchCommand(command, params, client) {
|
function policeSearchCommand(command, params, client) {
|
||||||
if(!canPlayerUseJobs(client)) {
|
if(!canPlayerUseJobs(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canPlayerUsePoliceJob(client)) {
|
if(!canPlayerUsePoliceJob(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerWorking(client)) {
|
if(!isPlayerWorking(client)) {
|
||||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||||
messagePlayerError(client, "You don't have a police job.");
|
messagePlayerError(client, "You don't have a police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function policeDragCommand(command, params, client) {
|
function policeDragCommand(command, params, client) {
|
||||||
if(!canPlayerUseJobs(client)) {
|
if(!canPlayerUseJobs(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canPlayerUsePoliceJob(client)) {
|
if(!canPlayerUsePoliceJob(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerWorking(client)) {
|
if(!isPlayerWorking(client)) {
|
||||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||||
messagePlayerError(client, "You don't have a police job.");
|
messagePlayerError(client, "You don't have a police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function policeDetainCommand(command, params, client) {
|
function policeDetainCommand(command, params, client) {
|
||||||
if(!canPlayerUseJobs(client)) {
|
if(!canPlayerUseJobs(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canPlayerUsePoliceJob(client)) {
|
if(!canPlayerUsePoliceJob(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use the police job.");
|
messagePlayerError(client, "You are not allowed to use the police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerWorking(client)) {
|
if(!isPlayerWorking(client)) {
|
||||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
if(!doesPlayerHaveJobType(client, VRR_JOB_POLICE)) {
|
||||||
messagePlayerError(client, "You don't have a police job.");
|
messagePlayerError(client, "You don't have a police job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,25 +8,25 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function taxiSetFareCommand(command, params, client) {
|
function taxiSetFareCommand(command, params, client) {
|
||||||
if(!canPlayerUseJobs(client)) {
|
if(!canPlayerUseJobs(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canPlayerUseTaxiJob(client)) {
|
if(!canPlayerUseTaxiJob(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use the taxi job.");
|
messagePlayerError(client, "You are not allowed to use the taxi job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerWorking(client)) {
|
if(!isPlayerWorking(client)) {
|
||||||
messagePlayerError(client, "You are not working! Use /startwork first.");
|
messagePlayerError(client, "You are not working! Use /startwork first.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!doesPlayerHaveJobType(client, VRR_JOB_TAXI)) {
|
if(!doesPlayerHaveJobType(client, VRR_JOB_TAXI)) {
|
||||||
messagePlayerError(client, "You don't have a taxi job.");
|
messagePlayerError(client, "You don't have a taxi job.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -10,90 +10,90 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerPosition(client) {
|
function getPlayerPosition(client) {
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
return getPlayerData(client).syncPosition;
|
return getPlayerData(client).syncPosition;
|
||||||
} else {
|
} else {
|
||||||
if(client.player != null) {
|
if(client.player != null) {
|
||||||
return client.player.position;
|
return client.player.position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerPosition(client, position) {
|
function setPlayerPosition(client, position) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s position to ${position.x}, ${position.y}, ${position.z}`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s position to ${position.x}, ${position.y}, ${position.z}`);
|
||||||
sendPlayerSetPosition(client, position);
|
sendPlayerSetPosition(client, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerHeading(client) {
|
function getPlayerHeading(client) {
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
return getPlayerData(client).syncHeading;
|
return getPlayerData(client).syncHeading;
|
||||||
} else {
|
} else {
|
||||||
if(client.player != null) {
|
if(client.player != null) {
|
||||||
return client.player.heading;
|
return client.player.heading;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerHeading(client, heading) {
|
function setPlayerHeading(client, heading) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s heading to ${heading}`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s heading to ${heading}`);
|
||||||
sendPlayerSetHeading(client, heading);
|
sendPlayerSetHeading(client, heading);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerVehicle(client) {
|
function getPlayerVehicle(client) {
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
return getPlayerData().syncVehicle;
|
return getPlayerData().syncVehicle;
|
||||||
} else {
|
} else {
|
||||||
if(client.player.vehicle) {
|
if(client.player.vehicle) {
|
||||||
return client.player.vehicle;
|
return client.player.vehicle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerDimension(client) {
|
function getPlayerDimension(client) {
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
return getPlayerData(client).syncDimension;
|
return getPlayerData(client).syncDimension;
|
||||||
} else {
|
} else {
|
||||||
if(client.player != null) {
|
if(client.player != null) {
|
||||||
return client.player.dimension;
|
return client.player.dimension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerInterior(client) {
|
function getPlayerInterior(client) {
|
||||||
return getPlayerCurrentSubAccount(client).interior || 0;
|
return getPlayerCurrentSubAccount(client).interior || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerDimension(client, dimension) {
|
function setPlayerDimension(client, dimension) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s dimension to ${dimension}`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s dimension to ${dimension}`);
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
getPlayerData(client).syncDimension = dimension;
|
getPlayerData(client).syncDimension = dimension;
|
||||||
} else {
|
} else {
|
||||||
if(client.player != null) {
|
if(client.player != null) {
|
||||||
client.player.dimension = dimension;
|
client.player.dimension = dimension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerInterior(client, interior) {
|
function setPlayerInterior(client, interior) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s interior to ${interior}`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s interior to ${interior}`);
|
||||||
sendPlayerSetInterior(client, interior);
|
sendPlayerSetInterior(client, interior);
|
||||||
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||||
getPlayerCurrentSubAccount(client).interior = interior;
|
getPlayerCurrentSubAccount(client).interior = interior;
|
||||||
}
|
}
|
||||||
@@ -102,19 +102,19 @@ function setPlayerInterior(client, interior) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerInAnyVehicle(client) {
|
function isPlayerInAnyVehicle(client) {
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
return (getPlayerData().syncVehicle != null);
|
return (getPlayerData().syncVehicle != null);
|
||||||
} else {
|
} else {
|
||||||
return (client.player.vehicle != null);
|
return (client.player.vehicle != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerVehicleSeat(client) {
|
function getPlayerVehicleSeat(client) {
|
||||||
if(!isPlayerInAnyVehicle(client)) {
|
if(!isPlayerInAnyVehicle(client)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
return getPlayerData().syncVehicleSeat;
|
return getPlayerData().syncVehicleSeat;
|
||||||
@@ -126,25 +126,25 @@ function getPlayerVehicleSeat(client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerSpawned(client) {
|
function isPlayerSpawned(client) {
|
||||||
return getPlayerData(client).spawned;
|
return getPlayerData(client).spawned;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getVehiclePosition(vehicle) {
|
function getVehiclePosition(vehicle) {
|
||||||
return vehicle.position;
|
return vehicle.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getVehicleHeading(vehicle) {
|
function getVehicleHeading(vehicle) {
|
||||||
return vehicle.heading;
|
return vehicle.heading;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -153,13 +153,13 @@ function setVehicleHeading(vehicle, heading) {
|
|||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
return sendNetworkEventToPlayer("vrr.vehPosition", null, getVehicleForNetworkEvent(vehicle), heading);
|
return sendNetworkEventToPlayer("vrr.vehPosition", null, getVehicleForNetworkEvent(vehicle), heading);
|
||||||
}
|
}
|
||||||
return vehicle.heading = heading;
|
return vehicle.heading = heading;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getVehicleSyncer(vehicle) {
|
function getVehicleSyncer(vehicle) {
|
||||||
return getElementSyncer(vehicle);
|
return getElementSyncer(vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -171,40 +171,40 @@ function getVehicleForNetworkEvent(vehicle) {
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return vehicle.id;
|
return vehicle.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function deleteGameElement(element) {
|
function deleteGameElement(element) {
|
||||||
try {
|
try {
|
||||||
if(element != null) {
|
if(element != null) {
|
||||||
destroyElement(element);
|
destroyElement(element);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerInFrontVehicleSeat(client) {
|
function isPlayerInFrontVehicleSeat(client) {
|
||||||
return (getPlayerVehicleSeat(client) == 0 || getPlayerVehicleSeat(client) == 1);
|
return (getPlayerVehicleSeat(client) == 0 || getPlayerVehicleSeat(client) == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function removePlayerFromVehicle(client) {
|
function removePlayerFromVehicle(client) {
|
||||||
logToConsole(LOG_DEBUG, `Removing ${getPlayerDisplayForConsole(client)} from their vehicle`);
|
logToConsole(LOG_DEBUG, `Removing ${getPlayerDisplayForConsole(client)} from their vehicle`);
|
||||||
sendPlayerRemoveFromVehicle(client);
|
sendPlayerRemoveFromVehicle(client);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerSkin(client, skinIndex) {
|
function setPlayerSkin(client, skinIndex) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameConfig().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameConfig().skins[getGame()][skinIndex][1]})`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameConfig().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameConfig().skins[getGame()][skinIndex][1]})`);
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
|
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
|
||||||
} else {
|
} else {
|
||||||
@@ -215,35 +215,35 @@ function setPlayerSkin(client, skinIndex) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerSkin(client) {
|
function getPlayerSkin(client) {
|
||||||
return getSkinIndexFromModel(client.player.modelIndex);
|
return getSkinIndexFromModel(client.player.modelIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerHealth(client, health) {
|
function setPlayerHealth(client, health) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to ${health}`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to ${health}`);
|
||||||
sendPlayerSetHealth(client, health);
|
sendPlayerSetHealth(client, health);
|
||||||
getServerData(client).health = health;
|
getServerData(client).health = health;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerHealth(client) {
|
function getPlayerHealth(client) {
|
||||||
return getServerData(client).health;
|
return getServerData(client).health;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerArmour(client, armour) {
|
function setPlayerArmour(client, armour) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to ${armour}`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to ${armour}`);
|
||||||
sendPlayerSetArmour(client, armour);
|
sendPlayerSetArmour(client, armour);
|
||||||
//client.player.armour = armour;
|
//client.player.armour = armour;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerArmour(client) {
|
function getPlayerArmour(client) {
|
||||||
return client.player.armour;
|
return client.player.armour;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -253,9 +253,9 @@ function setPlayerCash(client, amount) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isNaN(amount)) {
|
if(isNaN(amount)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerCurrentSubAccount(client).cash = toInteger(amount);
|
getPlayerCurrentSubAccount(client).cash = toInteger(amount);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
@@ -268,9 +268,9 @@ function givePlayerCash(client, amount) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isNaN(amount)) {
|
if(isNaN(amount)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerCurrentSubAccount(client).cash = getPlayerCurrentSubAccount(client).cash + toInteger(amount);
|
getPlayerCurrentSubAccount(client).cash = getPlayerCurrentSubAccount(client).cash + toInteger(amount);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
@@ -283,9 +283,9 @@ function takePlayerCash(client, amount) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isNaN(amount)) {
|
if(isNaN(amount)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerCurrentSubAccount(client).cash = getPlayerCurrentSubAccount(client).cash - toInteger(amount);
|
getPlayerCurrentSubAccount(client).cash = getPlayerCurrentSubAccount(client).cash - toInteger(amount);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
@@ -294,173 +294,173 @@ function takePlayerCash(client, amount) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function disconnectPlayer(client) {
|
function disconnectPlayer(client) {
|
||||||
logToConsole(LOG_DEBUG, `Disconnecting (kicking) ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `Disconnecting (kicking) ${getPlayerDisplayForConsole(client)}`);
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getElementSyncer(element) {
|
function getElementSyncer(element) {
|
||||||
return getClients()[element.syncer];
|
return getClients()[element.syncer];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerWeaponAmmo(client) {
|
function getPlayerWeaponAmmo(client) {
|
||||||
return client.player.weaponAmmunition;
|
return client.player.weaponAmmunition;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerVelocity(client, velocity) {
|
function setPlayerVelocity(client, velocity) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s velocity to ${velocity.x}, ${velocity.y}, ${velocity.z}`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s velocity to ${velocity.x}, ${velocity.y}, ${velocity.z}`);
|
||||||
if(typeof client.player.velocity != "undefined") {
|
if(typeof client.player.velocity != "undefined") {
|
||||||
client.player.velocity = velocity;
|
client.player.velocity = velocity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerVelocity(client, velocity) {
|
function getPlayerVelocity(client, velocity) {
|
||||||
if(typeof client.player.velocity != "undefined") {
|
if(typeof client.player.velocity != "undefined") {
|
||||||
return client.player.velocity;
|
return client.player.velocity;
|
||||||
}
|
}
|
||||||
return toVector3(0.0, 0.0, 0.0);
|
return toVector3(0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getElementDimension(element) {
|
function getElementDimension(element) {
|
||||||
if(typeof element.dimension != "undefined") {
|
if(typeof element.dimension != "undefined") {
|
||||||
return element.dimension;
|
return element.dimension;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setElementDimension(element, dimension) {
|
function setElementDimension(element, dimension) {
|
||||||
if(typeof element.dimension != "undefined") {
|
if(typeof element.dimension != "undefined") {
|
||||||
element.dimension = dimension;
|
element.dimension = dimension;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setElementRotation(element, rotation) {
|
function setElementRotation(element, rotation) {
|
||||||
return element.setRotation(rotation);
|
return element.setRotation(rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerHealth(client, amount) {
|
function givePlayerHealth(client, amount) {
|
||||||
if(getPlayerHealth(client)+amount > 100) {
|
if(getPlayerHealth(client)+amount > 100) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to 100`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to 100`);
|
||||||
setPlayerHealth(client, 100);
|
setPlayerHealth(client, 100);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to ${getPlayerHealth(client)+amount}`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to ${getPlayerHealth(client)+amount}`);
|
||||||
setPlayerHealth(client, getPlayerHealth(client)+amount);
|
setPlayerHealth(client, getPlayerHealth(client)+amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerArmour(client, amount) {
|
function givePlayerArmour(client, amount) {
|
||||||
if(getPlayerArmour(client)+amount > 100) {
|
if(getPlayerArmour(client)+amount > 100) {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to 100`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to 100`);
|
||||||
setPlayerArmour(client, 100);
|
setPlayerArmour(client, 100);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to ${getPlayerArmour(client)+amount}`);
|
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s armour to ${getPlayerArmour(client)+amount}`);
|
||||||
setPlayerArmour(client, getPlayerArmour(client)+amount);
|
setPlayerArmour(client, getPlayerArmour(client)+amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getServerGame() {
|
function getServerGame() {
|
||||||
return getGame();
|
return getGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function consolePrint(text) {
|
function consolePrint(text) {
|
||||||
console.log(text);
|
console.log(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerName(client) {
|
function getPlayerName(client) {
|
||||||
return client.name;
|
return client.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getServerName() {
|
function getServerName() {
|
||||||
return server.name;
|
return server.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createGamePickup(modelIndex, position, type) {
|
function createGamePickup(modelIndex, position, type) {
|
||||||
if(!isGameFeatureSupported("pickups")) {
|
if(!isGameFeatureSupported("pickups")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return game.createPickup(modelIndex, position, type);
|
return game.createPickup(modelIndex, position, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createGameBlip(position, type = 0, colour = toColour(255, 255, 255, 255)) {
|
function createGameBlip(position, type = 0, colour = toColour(255, 255, 255, 255)) {
|
||||||
if(!isGameFeatureSupported("blips")) {
|
if(!isGameFeatureSupported("blips")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return game.createBlip(type, position, 1, colour);
|
return game.createBlip(type, position, 1, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createGameObject(modelIndex, position) {
|
function createGameObject(modelIndex, position) {
|
||||||
if(!isGameFeatureSupported("objects")) {
|
if(!isGameFeatureSupported("objects")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return game.createObject(getGameConfig().objects[getGame()][modelIndex][0], position);
|
return game.createObject(getGameConfig().objects[getGame()][modelIndex][0], position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setElementOnAllDimensions(element, state) {
|
function setElementOnAllDimensions(element, state) {
|
||||||
if(!isNull(element) && element != false) {
|
if(!isNull(element) && element != false) {
|
||||||
element.onAllDimensions = state;
|
element.onAllDimensions = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function destroyGameElement(element) {
|
function destroyGameElement(element) {
|
||||||
if(!isNull(element) && element != false) {
|
if(!isNull(element) && element != false) {
|
||||||
destroyElement(element);
|
destroyElement(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isMeleeWeapon(weaponId, gameId = getServerGame()) {
|
function isMeleeWeapon(weaponId, gameId = getServerGame()) {
|
||||||
return (getGameConfig().meleeWeapons[gameId].indexOf(weaponId) != -1);
|
return (getGameConfig().meleeWeapons[gameId].indexOf(weaponId) != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerLastVehicle(client) {
|
function getPlayerLastVehicle(client) {
|
||||||
return getPlayerData(client).lastVehicle;
|
return getPlayerData(client).lastVehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isVehicleObject(vehicle) {
|
function isVehicleObject(vehicle) {
|
||||||
return (vehicle.type == ELEMENT_VEHICLE);
|
return (vehicle.type == ELEMENT_VEHICLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -479,7 +479,7 @@ function setVehicleLights(vehicle, lights) {
|
|||||||
|
|
||||||
function setVehicleEngine(vehicle, engine) {
|
function setVehicleEngine(vehicle, engine) {
|
||||||
vehicle.engine = engine;
|
vehicle.engine = engine;
|
||||||
setEntityData(vehicle, "vrr.engine", engine, true);
|
setEntityData(vehicle, "vrr.engine", engine, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -524,13 +524,13 @@ function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1
|
|||||||
vehicle.colour1 = colour1;
|
vehicle.colour1 = colour1;
|
||||||
vehicle.colour2 = colour2;
|
vehicle.colour2 = colour2;
|
||||||
|
|
||||||
if(colour3 != -1) {
|
if(colour3 != -1) {
|
||||||
vehicle.colour3 = colour3;
|
vehicle.colour3 = colour3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(colour4 != -1) {
|
if(colour4 != -1) {
|
||||||
vehicle.colour4 = colour4;
|
vehicle.colour4 = colour4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -544,7 +544,7 @@ function createGameVehicle(modelIndex, position, heading, toClient = null) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getIsland(position) {
|
function getIsland(position) {
|
||||||
if(getServerGame() == VRR_GAME_GTA_III) {
|
if(getServerGame() == VRR_GAME_GTA_III) {
|
||||||
if(position.x > 616) {
|
if(position.x > 616) {
|
||||||
return VRR_ISLAND_PORTLAND;
|
return VRR_ISLAND_PORTLAND;
|
||||||
} else if(position.x < -283) {
|
} else if(position.x < -283) {
|
||||||
@@ -561,11 +561,11 @@ function getIsland(position) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isValidVehicleModel(model) {
|
function isValidVehicleModel(model) {
|
||||||
if(getVehicleModelIndexFromModel(model) != false) {
|
if(getVehicleModelIndexFromModel(model) != false) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -589,8 +589,8 @@ function setPlayerFightStyle(client, fightStyleId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setEntityData(getPlayerElement(client), "vrr.fightStyle", [getGameConfig().fightStyles[getServerGame()][fightStyleId][1][0], getGameConfig().fightStyles[getServerGame()][fightStyleId][1][1]]);
|
setEntityData(getPlayerElement(client), "vrr.fightStyle", [getGameConfig().fightStyles[getServerGame()][fightStyleId][1][0], getGameConfig().fightStyles[getServerGame()][fightStyleId][1][1]]);
|
||||||
forcePlayerToSyncElementProperties(null, getPlayerElement(client));
|
forcePlayerToSyncElementProperties(null, getPlayerElement(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -649,32 +649,32 @@ function isTaxiVehicle(vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getVehicleName(vehicle) {
|
function getVehicleName(vehicle) {
|
||||||
let model = getElementModel(vehicle);
|
let model = getElementModel(vehicle);
|
||||||
return getVehicleNameFromModel(model) || "Unknown";
|
return getVehicleNameFromModel(model) || "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getElementModel(element) {
|
function getElementModel(element) {
|
||||||
if(typeof element.modelIndex != "undefined") {
|
if(typeof element.modelIndex != "undefined") {
|
||||||
return element.modelIndex;
|
return element.modelIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeof element.model != "undefined") {
|
if(typeof element.model != "undefined") {
|
||||||
return element.model;
|
return element.model;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerWeaponAmmo(client, ammo) {
|
function givePlayerWeaponAmmo(client, ammo) {
|
||||||
givePlayerWeapon(client, getPlayerWeapon(client), getPlayerWeaponAmmo(client) + ammo);
|
givePlayerWeapon(client, getPlayerWeapon(client), getPlayerWeaponAmmo(client) + ammo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerWeapon(client) {
|
function getPlayerWeapon(client) {
|
||||||
return client.player.weapon;
|
return client.player.weapon;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -914,7 +914,7 @@ function sendNetworkEventToPlayer(eventName, client, ...args) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addNetworkEventHandler(eventName, handlerFunction) {
|
function addNetworkEventHandler(eventName, handlerFunction) {
|
||||||
addNetworkHandler(eventName, handlerFunction);
|
addNetworkHandler(eventName, handlerFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1027,8 +1027,8 @@ function setVehicleHealth(vehicle, health) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||||
sendNetworkEventToPlayer("vrr.giveWeapon", client, weaponId, ammo, active);
|
sendNetworkEventToPlayer("vrr.giveWeapon", client, weaponId, ammo, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
1
third-party/mexui/Core/Component/Control.js
vendored
1
third-party/mexui/Core/Component/Control.js
vendored
@@ -131,4 +131,3 @@ mexui.Component.Control.prototype.unbind = function()
|
|||||||
{
|
{
|
||||||
this.boundTo = null;
|
this.boundTo = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Component/Entry.js
vendored
1
third-party/mexui/Core/Component/Entry.js
vendored
@@ -29,4 +29,3 @@ mexui.Component.Entry.prototype.remove = function()
|
|||||||
this.control.axis[this.getAxisKey()].entries.splice(this.getEntryIndex(), 1);
|
this.control.axis[this.getAxisKey()].entries.splice(this.getEntryIndex(), 1);
|
||||||
this.control.checkToShowScrollBars();
|
this.control.checkToShowScrollBars();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Component/Event.js
vendored
1
third-party/mexui/Core/Component/Event.js
vendored
@@ -3,4 +3,3 @@ mexui.Component.Event = function()
|
|||||||
this.used = false;
|
this.used = false;
|
||||||
this.clickedAControl = false;
|
this.clickedAControl = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Component/Window.js
vendored
1
third-party/mexui/Core/Component/Window.js
vendored
@@ -386,4 +386,3 @@ mexui.Component.Window.prototype.tree = function(x, y, w, h, styles, callback)
|
|||||||
mexui.Component.Window.prototype.week = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Week(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.week = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Week(this, x, y, w, h, text, styles, callback)); };
|
||||||
mexui.Component.Window.prototype.weekDay = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.WeekDay(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.weekDay = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.WeekDay(this, x, y, w, h, text, styles, callback)); };
|
||||||
mexui.Component.Window.prototype.year = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Year(this, x, y, w, h, text, styles, callback)); };
|
mexui.Component.Window.prototype.year = function(x, y, w, h, text, styles, callback) { return this.addControl(new mexui.Control.Year(this, x, y, w, h, text, styles, callback)); };
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Control/Grid.js
vendored
1
third-party/mexui/Core/Control/Grid.js
vendored
@@ -127,4 +127,3 @@ mexui.Control.Grid.prototype.getAllEntriesLength = function(axisIndex)
|
|||||||
return this.axis.y.getAllEntriesLength2();
|
return this.axis.y.getAllEntriesLength2();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Control/List.js
vendored
1
third-party/mexui/Core/Control/List.js
vendored
@@ -59,4 +59,3 @@ mexui.Control.List.prototype.row = function(text)
|
|||||||
this.axis.y.addEntry(entry);
|
this.axis.y.addEntry(entry);
|
||||||
return entry;
|
return entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Control/Slider.js
vendored
1
third-party/mexui/Core/Control/Slider.js
vendored
@@ -113,4 +113,3 @@ mexui.Control.Slider.prototype.clampProgress = function()
|
|||||||
else if(this.progress > 1.0)
|
else if(this.progress > 1.0)
|
||||||
this.progress = 1.0;
|
this.progress = 1.0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Control/Tree.js
vendored
1
third-party/mexui/Core/Control/Tree.js
vendored
@@ -153,4 +153,3 @@ mexui.Control.Tree.prototype.row = function(text)
|
|||||||
this.axis.y.addEntry(entry);
|
this.axis.y.addEntry(entry);
|
||||||
return entry;
|
return entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Entity/ControlAxis.js
vendored
1
third-party/mexui/Core/Entity/ControlAxis.js
vendored
@@ -197,4 +197,3 @@ mexui.Entity.ControlAxis.prototype.getDisplayedEntryCount = function()
|
|||||||
var displayedEntryCount = Math.floor(displayedEntriesLength / this.control.entrySize[this.axisIndex]);
|
var displayedEntryCount = Math.floor(displayedEntriesLength / this.control.entrySize[this.axisIndex]);
|
||||||
return this.entries.length < displayedEntryCount ? this.entries.length : displayedEntryCount;
|
return this.entries.length < displayedEntryCount ? this.entries.length : displayedEntryCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -95,4 +95,3 @@ mexui.Entity.ControlWithEntries.prototype.removeAllEntries = function()
|
|||||||
this.axis.x.removeAllEntries();
|
this.axis.x.removeAllEntries();
|
||||||
this.axis.y.removeAllEntries();
|
this.axis.y.removeAllEntries();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -207,4 +207,3 @@ mexui.Entity.StyleableEntity.prototype.getTransitionTimeStyle = function(control
|
|||||||
else
|
else
|
||||||
return mexui.Entity.Transition.defaultTransitionTime;
|
return mexui.Entity.Transition.defaultTransitionTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Entity/Transition.js
vendored
1
third-party/mexui/Core/Entity/Transition.js
vendored
@@ -181,4 +181,3 @@ mexui.Entity.Transition.prototype.clearDelayTimer = function()
|
|||||||
clearTimeout(this.delayTimer);
|
clearTimeout(this.delayTimer);
|
||||||
this.delayTimer = null;
|
this.delayTimer = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Entry/GridRow.js
vendored
1
third-party/mexui/Core/Entry/GridRow.js
vendored
@@ -10,4 +10,3 @@ mexui.util.extend(mexui.Entry.GridRow, mexui.Component.Entry);
|
|||||||
|
|
||||||
// default styles
|
// default styles
|
||||||
mexui.Entry.GridRow.defaultStyles = mexui.util.linkStyles(mexui.Entity.StyleableEntity.defaultStyles, {});
|
mexui.Entry.GridRow.defaultStyles = mexui.util.linkStyles(mexui.Entity.StyleableEntity.defaultStyles, {});
|
||||||
|
|
||||||
|
|||||||
1
third-party/mexui/Core/Native.js
vendored
1
third-party/mexui/Core/Native.js
vendored
@@ -151,4 +151,3 @@ mexui.native.drawImage = function(position, size, image, styles)
|
|||||||
{
|
{
|
||||||
drawing.drawRectangle(image, position, size);
|
drawing.drawRectangle(image, position, size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
6
third-party/mexui/Core/Utility.js
vendored
6
third-party/mexui/Core/Utility.js
vendored
@@ -242,9 +242,9 @@ mexui.util.getWindowSize = function()
|
|||||||
mexui.util.isRectangleInsideRectangle = function(pos1, size1, pos2, size2)
|
mexui.util.isRectangleInsideRectangle = function(pos1, size1, pos2, size2)
|
||||||
{
|
{
|
||||||
return !(pos2.x > (pos1.x + size1.x) ||
|
return !(pos2.x > (pos1.x + size1.x) ||
|
||||||
(pos2.x + size2.x) < pos1.x ||
|
(pos2.x + size2.x) < pos1.x ||
|
||||||
pos2.y > (pos1.y + size1.y) ||
|
pos2.y > (pos1.y + size1.y) ||
|
||||||
(pos2.y + size2.y) < pos1.y);
|
(pos2.y + size2.y) < pos1.y);
|
||||||
};
|
};
|
||||||
|
|
||||||
mexui.util.mergeStyles = function(styles, pseudoPartNames)
|
mexui.util.mergeStyles = function(styles, pseudoPartNames)
|
||||||
|
|||||||
1
third-party/mexui/mexui.js
vendored
1
third-party/mexui/mexui.js
vendored
@@ -297,4 +297,3 @@ mexui.setInput = function(showInput)
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user