This commit is contained in:
Vortrex
2021-01-02 21:57:43 -06:00
14 changed files with 446 additions and 300 deletions

View File

@@ -8,281 +8,273 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
let serverCommands = {}; let serverCommands = {
account: [
commandData("login", loginCommand, "<password>", getStaffFlagValue("none"), false, false),
commandData("register", registerCommand, "<password>", getStaffFlagValue("none"), false, false),
commandData("changepass", changePasswordCommand, "<password>", getStaffFlagValue("none"), true, false),
commandData("iplogin", autoLoginByIPCommand, "", getStaffFlagValue("none"), true, false),
commandData("autolastchar", autoSelectLastCharacterCommand, "", getStaffFlagValue("none"), true, false),
commandData("gui", toggleAccountGUICommand, "", getStaffFlagValue("none"), false, false),
commandData("2fa", toggleAccountTwoFactorAuthCommand, "", getStaffFlagValue("none"), true, false),
commandData("setemail", setAccountEmailCommand, "<email address>", getStaffFlagValue("none"), true, false),
commandData("setdiscord", setAccountDiscordCommand, "<Name#0000 - discord name and id>", getStaffFlagValue("none"), true, false),
],
ammunation: [],
ban: [
commandData("aban", accountBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true),
commandData("saban", subAccountBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true),
commandData("ipban", ipBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true),
],
bitFlag: [],
business: [
commandData("addbiz", createBusinessCommand, "<name>", getStaffFlagValue("manageBusinesses"), true, false),
commandData("delbiz", deleteBusinessCommand, "[id]", getStaffFlagValue("manageBusinesses"), true, true),
commandData("addbizloc", createBusinessLocationCommand, "<type> <business id> <name>", getStaffFlagValue("manageBusinesses"), true, false),
commandData("delbizloc", deleteBusinessLocationCommand, "[id]", getStaffFlagValue("manageBusinesses"), true, false),
commandData("bizreloadall", reloadAllBusinessesCommand, "", getStaffFlagValue("manageBusinesses"), true, false),
commandData("bizlock", lockBusinessCommand, "", getStaffFlagValue("none"), true, true),
commandData("bizfee", setBusinessEntranceFeeCommand, "<amount>", getStaffFlagValue("none"), true, true),
commandData("biztill", viewBusinessTillAmountCommand, "", getStaffFlagValue("none"), true, true),
commandData("bizwithdraw", withdrawFromBusinessCommand, "<amount>", getStaffFlagValue("none"), true, true),
commandData("bizdeposit", depositIntoBusinessCommand, "<amount>", getStaffFlagValue("none"), true, true),
commandData("bizname", setBusinessNameCommand, "<name>", getStaffFlagValue("none"), true, true),
commandData("bizowner", setBusinessOwnerCommand, "<player name/id>", getStaffFlagValue("none"), true, true),
commandData("bizblip", setBusinessBlipCommand, "<type name/model id>", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizpickup", setBusinessPickupCommand, "<type name/model id>", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizinfo", getBusinessInfoCommand, "[id]", getStaffFlagValue("none"), true, true),
commandData("bizentrance", moveBusinessEntranceCommand, "", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizexit", moveBusinessExitCommand, "", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizinttype", setBusinessInteriorTypeCommand, "<interior template name/business id>", getStaffFlagValue("manageBusinesses"), true, true),
],
chat: [
commandData("me", meActionCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("do", doActionCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("s", shoutCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("shout", shoutCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("talk", talkCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("local", talkCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("l", talkCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("w", whisperCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("whisper", whisperCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("clanchat", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("clan", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("c", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("adminchat", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true),
commandData("a", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true),
commandData("achat", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true),
],
clan: [
commandData("addclan", createClanCommand, "<name>", getStaffFlagValue("manageClans"), true, true),
commandData("delclan", deleteClanCommand, "<clan id>", getStaffFlagValue("manageClans"), true, true),
commandData("clanowner", setClanOwnerCommand, "<clan id> <player name/id>", getStaffFlagValue("none"), true, true),
commandData("clantag", setClanTagCommand, "<tag>", getStaffFlagValue("none"), true, true),
commandData("clanranktag", setClanRankTagCommand, "<rank id> <tag>", getStaffFlagValue("none"), true, true),
commandData("clanmembertag", setClanMemberTagCommand, "<player name/id> <tag>", getStaffFlagValue("none"), true, true),
commandData("clanranktitle", setClanRankTitleCommand, "<rank id> <title>", getStaffFlagValue("none"), true, true),
commandData("clanmembertitle", setClanMemberTitleCommand, "<player name/id> <title>", getStaffFlagValue("none"), true, true),
commandData("addrankflag", addClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true),
commandData("delrankflag", removeClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true),
commandData("addmemberflag", addClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true),
commandData("delmemberflag", removeClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true),
],
class: [],
client: [],
colour: [],
command: [
commandData("cmdenabletype", enableAllCommandsByType, "<type>", getStaffFlagValue("developer"), true, true),
commandData("cmddisabletype", disableAllCommandsByType, "<type>", getStaffFlagValue("developer"), true, true),
commandData("cmdenable", enableCommand, "<command>", getStaffFlagValue("developer"), true, true),
commandData("cmddisable", disableCommand, "<command>", getStaffFlagValue("developer"), true, true),
],
config: [
commandData("settime", setTimeCommand, "<hour> [minute]", getStaffFlagValue("manageServer"), true, true),
commandData("setweather", setWeatherCommand, "<weather id/name>", getStaffFlagValue("manageServer"), true, true),
commandData("setsnow", setSnowingCommand, "<falling snow> <ground snow>", getStaffFlagValue("manageServer"), true, true),
commandData("setlogo", toggleServerLogoCommand, "<0/1 state>", getStaffFlagValue("manageServer"), true, true),
commandData("setgui", toggleServerGUICommand, "<0/1 state>", getStaffFlagValue("manageServer"), true, true),
commandData("newcharspawn", setNewCharacterSpawnPositionCommand, "", getStaffFlagValue("manageServer"), true, true),
commandData("newcharcash", setNewCharacterMoneyCommand, "<amount>", getStaffFlagValue("manageServer"), true, true),
commandData("newcharskin", setNewCharacterSkinCommand, "[skin id]", getStaffFlagValue("manageServer"), true, true),
commandData("jobinfo", getJobInfoCommand, "", getStaffFlagValue("none"), true, true),
commandData("joblocinfo", getJobLocationInfoCommand, "", getStaffFlagValue("none"), true, true),
],
core: [],
database: [],
developer: [
commandData("scode", executeServerCodeCommand, "<code>", getStaffFlagValue("developer"), true, true),
commandData("ccode", executeClientCodeCommand, "<code>", getStaffFlagValue("developer"), true, true),
commandData("gmx", restartGameModeCommand, "", getStaffFlagValue("developer"), true, true),
commandData("saveall", saveAllServerDataCommand, "", getStaffFlagValue("developer"), true, true),
commandData("docmd", simulateCommandForPlayer, "<player name/id> <command> [params]", getStaffFlagValue("developer"), true, true),
commandData("docmdall", simulateCommandForAllPlayers, "<command> [params]", getStaffFlagValue("developer"), true, true),
],
discord: [],
faction: [],
help: [
commandData("help", helpCommand, "", getStaffFlagValue("none"), false, false),
],
house: [
commandData("addhouse", createHouseCommand, "<description>", getStaffFlagValue("manageHouses"), true, false),
commandData("delhouse", deleteHouseCommand, "", getStaffFlagValue("manageHouses"), true, false),
commandData("housereloadall", reloadAllHousesCommand, "", getStaffFlagValue("manageHouses"), true, false),
commandData("houseinfo", getHouseInfoCommand, "", getStaffFlagValue("none"), true, false),
commandData("housedesc", setHouseDescriptionCommand, "", getStaffFlagValue("none"), true, false),
commandData("houselock", lockUnlockHouseCommand, "", getStaffFlagValue("none"), true, false),
commandData("houseowner", setHouseOwnerCommand, "", getStaffFlagValue("none"), true, false),
commandData("houseblip", setHouseBlipCommand, "<type name/model id>", getStaffFlagValue("manageHouses"), true, true),
commandData("housepickup", setHousePickupCommand, "<type name/model id>", getStaffFlagValue("manageHouses"), true, true),
commandData("houseinfo", getHouseInfoCommand, "[id]", getStaffFlagValue("none"), true, true),
commandData("houseentrance", moveHouseEntranceCommand, "", getStaffFlagValue("manageHouses"), true, true),
commandData("houseexit", moveHouseExitCommand, "", getStaffFlagValue("manageHouses"), true, true),
commandData("houseinttype", setHouseInteriorTypeCommand, "<interior template name/business id>", getStaffFlagValue("manageHouses"), true, true),
],
item: [],
job: [
commandData("takejob", takeJobCommand, "", getStaffFlagValue("none"), true, false),
commandData("startwork", startWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("stopwork", stopWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("startjob", startWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("stopjob", stopWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("quitjob", quitJobCommand, "", getStaffFlagValue("none"), true, false),
commandData("uniform", jobUniformCommand, "[uniform]", getStaffFlagValue("none"), true, false),
commandData("equip", jobEquipmentCommand, "[equipment]", getStaffFlagValue("none"), true, false),
commandData("radio", jobRadioCommand, "", getStaffFlagValue("none"), true, false),
commandData("r", jobRadioCommand, "", getStaffFlagValue("none"), true, false),
commandData("department", jobDepartmentRadioCommand, "", getStaffFlagValue("none"), true, false),
commandData("d", jobDepartmentRadioCommand, "", getStaffFlagValue("none"), true, false),
// Taxi
commandData("fare", taxiSetFareCommand, "", getStaffFlagValue("none"), true, false),
// Police
commandData("tazer", policeTazerCommand, "", getStaffFlagValue("none"), true, false),
commandData("cuff", policeCuffCommand, "", getStaffFlagValue("none"), true, false),
commandData("detain", policeDetainCommand, "", getStaffFlagValue("none"), true, false),
commandData("drag", policeDragCommand, "", getStaffFlagValue("none"), true, false),
commandData("search", policeSearchCommand, "", getStaffFlagValue("none"), true, false),
// Bus/Garbage
commandData("startroute", jobStartRouteCommand, "", getStaffFlagValue("none"), true, false),
commandData("stoproute", jobStopRouteCommand, "", getStaffFlagValue("none"), true, false),
// Admin Job Stuff
commandData("addjobloc", createJobLocationCommand, "<job name/id>", getStaffFlagValue("manageJobs"), true, false),
commandData("deljobloc", deleteJobLocationCommand, "", getStaffFlagValue("manageJobs"), true, false),
//commandData("jobloctoggle", toggleJobLocationCommand, "", getStaffFlagValue("manageJobs"), true, false),
commandData("jobwhitelist", toggleJobWhiteListCommand, "[job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobblacklist", toggleJobBlackListCommand, "[job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobtoggle", toggleJobEnabledCommand, "[job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobaddplayerwl", addPlayerToJobWhiteListCommand, "<player name/id> [job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobaddplayerbl", addPlayerToJobBlackListCommand, "<player name/id> [job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobdelplayerbl", removePlayerFromJobBlackListCommand, "<player name/id> [job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobdelplayerbl", removePlayerFromJobWhiteListCommand, "<player name/id> [job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobreloadall", reloadAllJobsCommand, "", getStaffFlagValue("manageJobs"), true, false),
],
keybind: [
commandData("bindkey", addKeyBindCommand, "<key id/name> <command> [params]", getStaffFlagValue("none"), true, false),
commandData("unbindkey", removeKeyBindCommand, "<key id/name>", getStaffFlagValue("none"), true, false),
//commandData("keybinds", showKeyBindCommands, "", getStaffFlagValue("none"), true, false),
],
locale: [],
messaging: [],
misc: [
commandData("pos", getPositionCommand, "", getStaffFlagValue("basicModeration"), true, false),
commandData("idea", submitIdeaCommand, "<message>", getStaffFlagValue("none"), true, true),
commandData("bug", submitBugReportCommand, "<message>", getStaffFlagValue("none"), true, true),
commandData("enter", enterExitPropertyCommand, "", getStaffFlagValue("none"), true, true),
commandData("exit", enterExitPropertyCommand, "", getStaffFlagValue("none"), true, false),
commandData("cursor", toggleMouseCursorCommand, "", getStaffFlagValue("none"), true, false),
commandData("mousecam", toggleMouseCameraCommand, "", getStaffFlagValue("none"), true, false),
],
moderation: [
commandData("kick", kickClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("mute", muteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("freeze", freezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("unmute", unMuteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("unfreeze", unFreezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("goto", gotoPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true),
commandData("gethere", getPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotopos", gotoPositionCommand, "<x> <y> <z> [int] [vw]", getStaffFlagValue("basicModeration"), true, true),
commandData("gotoveh", gotoVehicleCommand, "<vehicle id>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotobiz", gotoBusinessCommand, "<business id/name>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotohouse", gotoHouseCommand, "<house id/name>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotojob", gotoJobLocationCommand, "<job id/name> <location id>", getStaffFlagValue("basicModeration"), true, true),
//commandData("gotoloc", gotoLocationCommand, "<location name>", getStaffFlagValue("basicModeration"), true, true),
commandData("fr", teleportForwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("ba", teleportBackwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("lt", teleportLeftCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("rt", teleportRightCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("up", teleportUpCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("dn", teleportDownCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("int", playerInteriorCommand, "<interior id>", getStaffFlagValue("basicModeration"), true, true),
commandData("vw", playerVirtualWorldCommand, "<virtual world id>", getStaffFlagValue("basicModeration"), true, true),
commandData("addstaffflag", addStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true),
commandData("delstaffflag", takeStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true),
commandData("getstaffflags", getStaffFlagsCommand, "<player name/id>", getStaffFlagValue("manageAdmins"), true, true),
commandData("clearstaffflags", clearStaffFlagsCommand, "<player name/id>", getStaffFlagValue("manageAdmins"), true, true),
commandData("staffflags", allStaffFlagsCommand, "", getStaffFlagValue("manageAdmins"), true, true),
commandData("givemoney", givePlayerMoneyCommand, "<player name/id> <amount>", getStaffFlagValue("giveMoney"), true, true),
],
security: [],
startup: [],
subAccount: [
commandData("switchchar", switchCharacterCommand, "", getStaffFlagValue("none"), true, false),
commandData("newchar", newCharacterCommand, "<first name> <last name>", getStaffFlagValue("none"), true, false),
commandData("usechar", useCharacterCommand, "<character id>", getStaffFlagValue("none"), true, false),
],
translate: [],
utilities: [],
vehicle: [
commandData("addveh", createVehicleCommand, "<model id/name>", getStaffFlagValue("manageVehicles"), true, false),
commandData("tempveh", createTemporaryVehicleCommand, "<model id/name>", getStaffFlagValue("manageVehicles"), true, false),
commandData("delveh", deleteVehicleCommand, "", getStaffFlagValue("manageVehicles"), true, false),
commandData("lock", vehicleLockCommand, "", getStaffFlagValue("none"), true, false),
commandData("unlock", vehicleLockCommand, "", getStaffFlagValue("none"), true, false),
commandData("engine", vehicleEngineCommand, "", getStaffFlagValue("none"), true, false),
commandData("siren", vehicleSirenCommand, "", getStaffFlagValue("none"), true, false),
commandData("lights", vehicleLightsCommand, "", getStaffFlagValue("none"), true, false),
commandData("vehowner", setVehicleOwnerCommand, "<player id/name>", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehclan", setVehicleClanCommand, "<clan id/name>", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehbiz", setVehicleToBusinessCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehjob", setVehicleJobCommand, "[job id/name]", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehdelowner", removeVehicleOwnerCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehrank", setVehicleRankCommand, "<rank id/name>", getStaffFlagValue("none"), true, true),
commandData("vehinfo", getVehicleInfoCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehpark", toggleVehicleSpawnLockCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehrespawnall", respawnAllVehiclesCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehreloadall", reloadAllVehiclesCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehrent", rentVehicleCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehrentprice", setVehicleRentPriceCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehbuyprice", setVehicleBuyPriceCommand, "", getStaffFlagValue("none"), true, true),
commandData("stoprent", stopRentingVehicleCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehbuy", buyVehicleCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehcolour", setVehicleColourCommand, "<colour1> <colour2>", getStaffFlagValue("none"), true, true),
commandData("vehrepair", vehicleRepairCommand, "", getStaffFlagValue("none"), true, true),
commandData("passenger", enterVehicleAsPassengerCommand, "", getStaffFlagValue("none"), true, true),
],
};
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function initCommandScript() { function initCommandScript() {
console.log("[Asshat.Command]: Initializing commands script ..."); console.log("[Asshat.Command]: Initializing commands script ...");
serverCommands = loadCommandData();
console.log("[Asshat.Command]: Initialized commands script!"); console.log("[Asshat.Command]: Initialized commands script!");
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function loadCommandData() {
let tempCommands = {
account: [
commandData("login", loginCommand, "<password>", getStaffFlagValue("none"), false, false),
commandData("register", registerCommand, "<password>", getStaffFlagValue("none"), false, false),
commandData("changepass", changePasswordCommand, "<password>", getStaffFlagValue("none"), true, false),
commandData("iplogin", autoLoginByIPCommand, "", getStaffFlagValue("none"), true, false),
commandData("autolastchar", autoSelectLastCharacterCommand, "", getStaffFlagValue("none"), true, false),
commandData("gui", toggleAccountGUICommand, "", getStaffFlagValue("none"), false, false),
commandData("2fa", toggleAccountTwoFactorAuthCommand, "", getStaffFlagValue("none"), true, false),
commandData("setemail", setAccountEmailCommand, "<email address>", getStaffFlagValue("none"), true, false),
commandData("setdiscord", setAccountDiscordCommand, "<Name#0000 - discord name and id>", getStaffFlagValue("none"), true, false),
],
ammunation: [],
ban: [
commandData("aban", accountBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true),
commandData("saban", subAccountBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true),
commandData("ipban", ipBanCommand, "<player name/id> <reason>", getStaffFlagValue("manageBans"), true, true),
],
bitFlag: [],
business: [
commandData("addbiz", createBusinessCommand, "<name>", getStaffFlagValue("manageBusinesses"), true, false),
commandData("delbiz", deleteBusinessCommand, "[id]", getStaffFlagValue("manageBusinesses"), true, true),
commandData("addbizloc", createBusinessLocationCommand, "<type> <business id> <name>", getStaffFlagValue("manageBusinesses"), true, false),
commandData("delbizloc", deleteBusinessLocationCommand, "[id]", getStaffFlagValue("manageBusinesses"), true, false),
commandData("bizreloadall", reloadAllBusinessesCommand, "", getStaffFlagValue("manageBusinesses"), true, false),
commandData("bizlock", lockBusinessCommand, "", getStaffFlagValue("none"), true, true),
commandData("bizfee", setBusinessEntranceFeeCommand, "<amount>", getStaffFlagValue("none"), true, true),
commandData("biztill", viewBusinessTillAmountCommand, "", getStaffFlagValue("none"), true, true),
commandData("bizwithdraw", withdrawFromBusinessCommand, "<amount>", getStaffFlagValue("none"), true, true),
commandData("bizdeposit", depositIntoBusinessCommand, "<amount>", getStaffFlagValue("none"), true, true),
commandData("bizname", setBusinessNameCommand, "<name>", getStaffFlagValue("none"), true, true),
commandData("bizowner", setBusinessOwnerCommand, "<player name/id>", getStaffFlagValue("none"), true, true),
commandData("bizblip", setBusinessBlipCommand, "<type name/model id>", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizpickup", setBusinessPickupCommand, "<type name/model id>", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizinfo", getBusinessInfoCommand, "[id]", getStaffFlagValue("none"), true, true),
commandData("bizentrance", moveBusinessEntranceCommand, "", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizexit", moveBusinessExitCommand, "", getStaffFlagValue("manageBusinesses"), true, true),
commandData("bizinttype", setBusinessInteriorTypeCommand, "<interior template name/business id>", getStaffFlagValue("manageBusinesses"), true, true),
],
chat: [
commandData("me", meActionCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("do", doActionCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("s", shoutCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("shout", shoutCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("talk", talkCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("local", talkCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("l", talkCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("w", whisperCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("whisper", whisperCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("clanchat", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("clan", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("c", clanChatCommand, "<message>", getStaffFlagValue("none"), true, false),
commandData("adminchat", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true),
commandData("a", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true),
commandData("achat", adminChatCommand, "<message>", getStaffFlagValue("basicModeration"), true, true),
],
clan: [
commandData("addclan", createClanCommand, "<name>", getStaffFlagValue("manageClans"), true, true),
commandData("delclan", deleteClanCommand, "<clan id>", getStaffFlagValue("manageClans"), true, true),
commandData("clanowner", setClanOwnerCommand, "<clan id> <player name/id>", getStaffFlagValue("none"), true, true),
commandData("clantag", setClanTagCommand, "<tag>", getStaffFlagValue("none"), true, true),
commandData("clanranktag", setClanRankTagCommand, "<rank id> <tag>", getStaffFlagValue("none"), true, true),
commandData("clanmembertag", setClanMemberTagCommand, "<player name/id> <tag>", getStaffFlagValue("none"), true, true),
commandData("clanranktitle", setClanRankTitleCommand, "<rank id> <title>", getStaffFlagValue("none"), true, true),
commandData("clanmembertitle", setClanMemberTitleCommand, "<player name/id> <title>", getStaffFlagValue("none"), true, true),
commandData("addrankflag", addClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true),
commandData("delrankflag", removeClanRankFlagCommand, "<rank name/id> <flag name>", getStaffFlagValue("none"), true, true),
commandData("addmemberflag", addClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true),
commandData("delmemberflag", removeClanMemberFlagCommand, "<player name/id> <flag name>", getStaffFlagValue("none"), true, true),
],
class: [],
client: [],
colour: [],
command: [
commandData("cmdenabletype", enableAllCommandsByType, "<type>", getStaffFlagValue("developer"), true, true),
commandData("cmddisabletype", disableAllCommandsByType, "<type>", getStaffFlagValue("developer"), true, true),
commandData("cmdenable", enableCommand, "<command>", getStaffFlagValue("developer"), true, true),
commandData("cmddisable", disableCommand, "<command>", getStaffFlagValue("developer"), true, true),
],
config: [
commandData("settime", setTimeCommand, "<hour> [minute]", getStaffFlagValue("manageServer"), true, true),
commandData("setweather", setWeatherCommand, "<weather id/name>", getStaffFlagValue("manageServer"), true, true),
commandData("setsnow", setSnowingCommand, "<falling snow> <ground snow>", getStaffFlagValue("manageServer"), true, true),
commandData("setlogo", toggleServerLogoCommand, "<0/1 state>", getStaffFlagValue("manageServer"), true, true),
commandData("setgui", toggleServerGUICommand, "<0/1 state>", getStaffFlagValue("manageServer"), true, true),
commandData("newcharspawn", setNewCharacterSpawnPositionCommand, "", getStaffFlagValue("manageServer"), true, true),
commandData("newcharcash", setNewCharacterMoneyCommand, "<amount>", getStaffFlagValue("manageServer"), true, true),
commandData("newcharskin", setNewCharacterSkinCommand, "[skin id]", getStaffFlagValue("manageServer"), true, true),
commandData("jobinfo", getJobInfoCommand, "", getStaffFlagValue("none"), true, true),
commandData("joblocinfo", getJobLocationInfoCommand, "", getStaffFlagValue("none"), true, true),
],
core: [],
database: [],
developer: [
commandData("scode", executeServerCodeCommand, "<code>", getStaffFlagValue("developer"), true, true),
commandData("ccode", executeClientCodeCommand, "<code>", getStaffFlagValue("developer"), true, true),
commandData("gmx", restartGameModeCommand, "", getStaffFlagValue("developer"), true, true),
commandData("saveall", saveAllServerDataCommand, "", getStaffFlagValue("developer"), true, true),
commandData("docmd", simulateCommandForPlayer, "<player name/id> <command> [params]", getStaffFlagValue("developer"), true, true),
commandData("docmdall", simulateCommandForAllPlayers, "<command> [params]", getStaffFlagValue("developer"), true, true),
],
discord: [],
faction: [],
help: [
commandData("help", helpCommand, "", getStaffFlagValue("none"), false, false),
],
house: [
commandData("addhouse", createHouseCommand, "<description>", getStaffFlagValue("manageHouses"), true, false),
commandData("delhouse", deleteHouseCommand, "", getStaffFlagValue("manageHouses"), true, false),
commandData("housereloadall", reloadAllHousesCommand, "", getStaffFlagValue("manageHouses"), true, false),
commandData("houseinfo", getHouseInfoCommand, "", getStaffFlagValue("none"), true, false),
commandData("housedesc", setHouseDescriptionCommand, "", getStaffFlagValue("none"), true, false),
commandData("houselock", lockUnlockHouseCommand, "", getStaffFlagValue("none"), true, false),
commandData("houseowner", setHouseOwnerCommand, "", getStaffFlagValue("none"), true, false),
commandData("houseblip", setHouseBlipCommand, "<type name/model id>", getStaffFlagValue("manageHouses"), true, true),
commandData("housepickup", setHousePickupCommand, "<type name/model id>", getStaffFlagValue("manageHouses"), true, true),
commandData("houseinfo", getHouseInfoCommand, "[id]", getStaffFlagValue("none"), true, true),
commandData("houseentrance", moveHouseEntranceCommand, "", getStaffFlagValue("manageHouses"), true, true),
commandData("houseexit", moveHouseExitCommand, "", getStaffFlagValue("manageHouses"), true, true),
commandData("houseinttype", setHouseInteriorTypeCommand, "<interior template name/business id>", getStaffFlagValue("manageHouses"), true, true),
],
item: [],
job: [
commandData("takejob", takeJobCommand, "", getStaffFlagValue("none"), true, false),
commandData("startwork", startWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("stopwork", stopWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("startjob", startWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("stopjob", stopWorkingCommand, "", getStaffFlagValue("none"), true, false),
commandData("quitjob", quitJobCommand, "", getStaffFlagValue("none"), true, false),
commandData("uniform", jobUniformCommand, "[uniform]", getStaffFlagValue("none"), true, false),
commandData("equip", jobEquipmentCommand, "[equipment]", getStaffFlagValue("none"), true, false),
commandData("radio", jobRadioCommand, "", getStaffFlagValue("none"), true, false),
commandData("r", jobRadioCommand, "", getStaffFlagValue("none"), true, false),
commandData("department", jobDepartmentRadioCommand, "", getStaffFlagValue("none"), true, false),
commandData("d", jobDepartmentRadioCommand, "", getStaffFlagValue("none"), true, false),
// Taxi
commandData("fare", taxiSetFareCommand, "", getStaffFlagValue("none"), true, false),
// Police
commandData("tazer", policeTazerCommand, "", getStaffFlagValue("none"), true, false),
commandData("cuff", policeCuffCommand, "", getStaffFlagValue("none"), true, false),
commandData("detain", policeDetainCommand, "", getStaffFlagValue("none"), true, false),
commandData("drag", policeDragCommand, "", getStaffFlagValue("none"), true, false),
commandData("search", policeSearchCommand, "", getStaffFlagValue("none"), true, false),
// Bus/Garbage
commandData("startroute", jobStartRouteCommand, "", getStaffFlagValue("none"), true, false),
commandData("stoproute", jobStopRouteCommand, "", getStaffFlagValue("none"), true, false),
// Admin Job Stuff
commandData("addjobloc", createJobLocationCommand, "<job name/id>", getStaffFlagValue("manageJobs"), true, false),
commandData("deljobloc", deleteJobLocationCommand, "", getStaffFlagValue("manageJobs"), true, false),
//commandData("jobloctoggle", toggleJobLocationCommand, "", getStaffFlagValue("manageJobs"), true, false),
commandData("jobwhitelist", toggleJobWhiteListCommand, "[job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobblacklist", toggleJobBlackListCommand, "[job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobtoggle", toggleJobEnabledCommand, "[job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobaddplayerwl", addPlayerToJobWhiteListCommand, "<player name/id> [job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobaddplayerbl", addPlayerToJobBlackListCommand, "<player name/id> [job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobdelplayerbl", removePlayerFromJobBlackListCommand, "<player name/id> [job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobdelplayerbl", removePlayerFromJobWhiteListCommand, "<player name/id> [job id]", getStaffFlagValue("manageJobs"), true, false),
commandData("jobreloadall", reloadAllJobsCommand, "", getStaffFlagValue("manageJobs"), true, false),
],
keybind: [
commandData("bindkey", addKeyBindCommand, "<key id/name> <command> [params]", getStaffFlagValue("none"), true, false),
commandData("unbindkey", removeKeyBindCommand, "<key id/name>", getStaffFlagValue("none"), true, false),
//commandData("keybinds", showKeyBindCommands, "", getStaffFlagValue("none"), true, false),
],
locale: [],
messaging: [],
misc: [
commandData("pos", getPositionCommand, "", getStaffFlagValue("basicModeration"), true, false),
commandData("idea", submitIdeaCommand, "<message>", getStaffFlagValue("none"), true, true),
commandData("bug", submitBugReportCommand, "<message>", getStaffFlagValue("none"), true, true),
commandData("enter", enterExitPropertyCommand, "", getStaffFlagValue("none"), true, true),
commandData("exit", enterExitPropertyCommand, "", getStaffFlagValue("none"), true, false),
commandData("cursor", toggleMouseCursorCommand, "", getStaffFlagValue("none"), true, false),
commandData("mousecam", toggleMouseCameraCommand, "", getStaffFlagValue("none"), true, false),
],
moderation: [
commandData("kick", kickClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("mute", muteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("freeze", freezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("unmute", unMuteClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("unfreeze", unFreezeClientCommand, "<player name/id> [reason]", getStaffFlagValue("basicModeration"), true, true),
commandData("goto", gotoPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true),
commandData("gethere", getPlayerCommand, "<player name/id>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotopos", gotoPositionCommand, "<x> <y> <z> [int] [vw]", getStaffFlagValue("basicModeration"), true, true),
commandData("gotoveh", gotoVehicleCommand, "<vehicle id>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotobiz", gotoBusinessCommand, "<business id/name>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotohouse", gotoHouseCommand, "<house id/name>", getStaffFlagValue("basicModeration"), true, true),
commandData("gotojob", gotoJobLocationCommand, "<job id/name> <location id>", getStaffFlagValue("basicModeration"), true, true),
//commandData("gotoloc", gotoLocationCommand, "<location name>", getStaffFlagValue("basicModeration"), true, true),
commandData("fr", teleportForwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("ba", teleportBackwardCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("lt", teleportLeftCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("rt", teleportRightCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("up", teleportUpCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("dn", teleportDownCommand, "<distance in meters>", getStaffFlagValue("basicModeration"), true, true),
commandData("int", playerInteriorCommand, "<interior id>", getStaffFlagValue("basicModeration"), true, true),
commandData("vw", playerVirtualWorldCommand, "<virtual world id>", getStaffFlagValue("basicModeration"), true, true),
commandData("addstaffflag", addStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true),
commandData("delstaffflag", takeStaffFlagCommand, "<player name/id> [flag name]", getStaffFlagValue("manageAdmins"), true, true),
commandData("getstaffflags", getStaffFlagsCommand, "<player name/id>", getStaffFlagValue("manageAdmins"), true, true),
commandData("clearstaffflags", clearStaffFlagsCommand, "<player name/id>", getStaffFlagValue("manageAdmins"), true, true),
commandData("staffflags", allStaffFlagsCommand, "", getStaffFlagValue("manageAdmins"), true, true),
commandData("givemoney", givePlayerMoneyCommand, "<player name/id> <amount>", getStaffFlagValue("giveMoney"), true, true),
],
security: [],
startup: [],
subAccount: [
commandData("switchchar", switchCharacterCommand, "", getStaffFlagValue("none"), true, false),
commandData("newchar", newCharacterCommand, "<first name> <last name>", getStaffFlagValue("none"), true, false),
commandData("usechar", useCharacterCommand, "<character id>", getStaffFlagValue("none"), true, false),
],
translate: [],
utilities: [],
vehicle: [
commandData("addveh", createVehicleCommand, "<model id/name>", getStaffFlagValue("manageVehicles"), true, false),
commandData("tempveh", createTemporaryVehicleCommand, "<model id/name>", getStaffFlagValue("manageVehicles"), true, false),
commandData("delveh", deleteVehicleCommand, "", getStaffFlagValue("manageVehicles"), true, false),
commandData("lock", vehicleLockCommand, "", getStaffFlagValue("none"), true, false),
commandData("unlock", vehicleLockCommand, "", getStaffFlagValue("none"), true, false),
commandData("engine", vehicleEngineCommand, "", getStaffFlagValue("none"), true, false),
commandData("siren", vehicleSirenCommand, "", getStaffFlagValue("none"), true, false),
commandData("lights", vehicleLightsCommand, "", getStaffFlagValue("none"), true, false),
commandData("vehowner", setVehicleOwnerCommand, "<player id/name>", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehclan", setVehicleClanCommand, "<clan id/name>", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehbiz", setVehicleToBusinessCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehjob", setVehicleJobCommand, "[job id/name]", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehdelowner", removeVehicleOwnerCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehrank", setVehicleRankCommand, "<rank id/name>", getStaffFlagValue("none"), true, true),
commandData("vehinfo", getVehicleInfoCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehpark", toggleVehicleSpawnLockCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehrespawnall", respawnAllVehiclesCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehreloadall", reloadAllVehiclesCommand, "", getStaffFlagValue("manageVehicles"), true, true),
commandData("vehrent", rentVehicleCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehrentprice", setVehicleRentPriceCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehbuyprice", setVehicleBuyPriceCommand, "", getStaffFlagValue("none"), true, true),
commandData("stoprent", stopRentingVehicleCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehbuy", buyVehicleCommand, "", getStaffFlagValue("none"), true, true),
commandData("vehcolour", setVehicleColourCommand, "<colour1> <colour2>", getStaffFlagValue("none"), true, true),
commandData("vehrepair", vehicleRepairCommand, "", getStaffFlagValue("none"), true, true),
commandData("passenger", enterVehicleAsPassengerCommand, "", getStaffFlagValue("none"), true, true),
],
}
return tempCommands;
}
// ---------------------------------------------------------------------------
function getCommand(command) { function getCommand(command) {
let commandGroups = getCommands() let commandGroups = getCommands()
for(let i in commandGroups) { for(let i in commandGroups) {
@@ -422,14 +414,25 @@ function enableAllCommandsByType(command, params, client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function onPlayerCommand(event, client, command, params) { function onPlayerCommand(event, client, command, params) {
let commandData = getCommand(command); processPlayerCommand(command, params, client)
}
addEventHandler("OnPlayerCommand", onPlayerCommand);
// ---------------------------------------------------------------------------
function processPlayerCommand(command, params, client) {
if(builtInCommands.indexOf(toLowerCase(command)) != -1) {
return true;
}
let commandData = getCommand(toLowerCase(command));
let paramsDisplay = params; let paramsDisplay = params;
if(areParamsEmpty(params)) { if(areParamsEmpty(params)) {
paramsDisplay = "" paramsDisplay = "";
} }
if(!commandData) { if(!doesCommandExist(toLowerCase(command))) {
console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`); console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
messagePlayerError(client, `The command [#AAAAAA]/${command} [#FFFFFF]does not exist! Use /help for commands and information.`); messagePlayerError(client, `The command [#AAAAAA]/${command} [#FFFFFF]does not exist! Use /help for commands and information.`);
return false; return false;
@@ -441,7 +444,7 @@ function onPlayerCommand(event, client, command, params) {
return false; return false;
} }
if(doesCommandRequireLogin(command)) { if(doesCommandRequireLogin(toLowerCase(command))) {
if(!isPlayerLoggedIn(client)) { if(!isPlayerLoggedIn(client)) {
console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`); console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
messagePlayerError(client, `You must be logged in to use the [#AAAAAA]/${command} [#FFFFFF]command!`); messagePlayerError(client, `You must be logged in to use the [#AAAAAA]/${command} [#FFFFFF]command!`);
@@ -457,16 +460,15 @@ function onPlayerCommand(event, client, command, params) {
// } // }
//} //}
if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(command))) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`); console.warn(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
messagePlayerError(client, `You do not have permission to use the [#AAAAAA]/${command} [#FFFFFF]command!`); messagePlayerError(client, `You do not have permission to use the [#AAAAAA]/${toLowerCase(command)} [#FFFFFF]command!`);
return false; return false;
} }
console.log(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`); console.log(`[Asshat.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
commandData.handlerFunction(command, params, client); commandData.handlerFunction(toLowerCase(command), params, client);
} }
addEventHandler("OnPlayerCommand", onPlayerCommand);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -493,3 +495,13 @@ function listAllCommands() {
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function doesCommandExist(command) {
if(getCommandData(command)) {
return true;
}
return false;
}
// ---------------------------------------------------------------------------

View File

@@ -10,6 +10,13 @@
function initDeveloperScript() { function initDeveloperScript() {
console.log("[Asshat.Developer]: Initializing developer script ..."); console.log("[Asshat.Developer]: Initializing developer script ...");
// Use GTAC command handlers for these since they need to be available on console
addCommandHandler("sc", executeServerCodeCommand);
addCommandHandler("cc", executeServerCodeCommand);
addCommandHandler("docmd", simulateCommandForPlayer);
addCommandHandler("allcmd", simulateCommandForAllPlayers);
console.log("[Asshat.Developer]: Developer script initialized successfully!"); console.log("[Asshat.Developer]: Developer script initialized successfully!");
return true; return true;
} }

View File

@@ -8,6 +8,7 @@
// TYPE: Server (JavaScript) // TYPE: Server (JavaScript)
// =========================================================================== // ===========================================================================
/*
addEventHandler("OnDiscordCommand", function(command, params, discordUser) { addEventHandler("OnDiscordCommand", function(command, params, discordUser) {
let commandData = getCommand(command); let commandData = getCommand(command);
@@ -28,6 +29,7 @@ addEventHandler("OnDiscordCommand", function(command, params, discordUser) {
commandData.handlerFunction(command, params, discordUser); commandData.handlerFunction(command, params, discordUser);
}); });
*/
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -253,7 +253,7 @@ function processPlayerDeath(client, position) {
function processPedSpawn(ped) { function processPedSpawn(ped) {
if(ped.type == ELEMENT_PLAYER) { if(ped.type == ELEMENT_PLAYER) {
setTimeout(processPlayerSpawn, 1000, ped); setTimeout(processPlayerSpawn, 500, ped);
} }
} }
@@ -272,7 +272,7 @@ function processPlayerSpawn(ped) {
return false; return false;
} }
if(!getPlayerData(client).switchingCharacter) { if(!isPlayerSwitchingCharacter(client)) {
return false; return false;
} }
@@ -289,9 +289,7 @@ function processPlayerSpawn(ped) {
setPlayerHeading(client, tempSubAccount.spawnHeading); setPlayerHeading(client, tempSubAccount.spawnHeading);
setPlayerInterior(client, tempSubAccount.interior); setPlayerInterior(client, tempSubAccount.interior);
setPlayerVirtualWorld(client, tempSubAccount.dimension); setPlayerVirtualWorld(client, tempSubAccount.dimension);
setTimeout(function() { updatePlayerCash(client);
updatePlayerCash(client);
}, 1000);
}, 500); }, 500);
updateAllPlayerNameTags(); updateAllPlayerNameTags();
@@ -301,3 +299,9 @@ function processPlayerSpawn(ped) {
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
addEventHandler("OnPedSpawn", function(event, ped) {
processPedSpawn(ped);
});
// ---------------------------------------------------------------------------

View File

@@ -13,6 +13,8 @@ function initHouseScript() {
getServerData().houses = loadHousesFromDatabase(); getServerData().houses = loadHousesFromDatabase();
createAllHousePickups(); createAllHousePickups();
createAllHouseBlips(); createAllHouseBlips();
setAllHouseIndexes();
console.log("[Asshat.House]: House script initialized successfully!"); console.log("[Asshat.House]: House script initialized successfully!");
return true; return true;
} }
@@ -698,3 +700,11 @@ function exitHouse(client) {
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function setAllHouseIndexes() {
for(let i in getServerData().houses) {
getServerData().houses[i].index = i;
}
}
// ---------------------------------------------------------------------------

View File

@@ -709,18 +709,19 @@ function takeJob(client, jobId) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function reloadAllJobsCommand(command, params, client) { function reloadAllJobsCommand(command, params, client) {
for(let i in getServerData().jobs) { forceAllPlayersToStopWorking();
for(let j in getServerData().jobs[i].locations) {
destroyElement(getServerData().jobs[i].locations[j].blip);
destroyElement(getServerData().jobs[i].locations[j].pickup);
}
}
//forceAllPlayersToStopWorking();
getServerData().jobs = null; getServerData().jobs = null;
getServerData().jobs = loadJobsFromDatabase(); getServerData().jobs = loadJobsFromDatabase();
createAllJobPickups();
createAllJobBlips(); for(let i in getServerData().jobs) {
for(let j in getServerData().jobs[i].locations) {
deleteJobLocationPickup(i, j);
deleteJobLocationBlip(i, j);
createJobLocationPickup(i, j);
createJobLocationBlip(i, j);
}
}
messageAdminAction(`All server jobs have been reloaded by an admin!`); messageAdminAction(`All server jobs have been reloaded by an admin!`);
} }
@@ -753,6 +754,7 @@ function deleteJobLocationCommand(command, params, client) {
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]deleted location [#AAAAAA]${closestJobLocation.databaseId} [#FFFFFF]for the [#AAAAAA]${jobData.name} [#FFFFFF]job`); messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]deleted location [#AAAAAA]${closestJobLocation.databaseId} [#FFFFFF]for the [#AAAAAA]${jobData.name} [#FFFFFF]job`);
quickDatabaseQuery(`DELETE FROM job_loc WHERE job_loc_id = ${closestJobLocation.databaseId}`);
deleteJobLocation(closestJobLocation); deleteJobLocation(closestJobLocation);
getJobData(closestJobLocation.job).locations.splice(getClosestJobLocation.index, 1); getJobData(closestJobLocation.job).locations.splice(getClosestJobLocation.index, 1);
} }
@@ -1237,7 +1239,7 @@ function setAllJobDataIndexes() {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function createJobLocation(job, position, interior, dimension) { function createJobLocation(job, position, interior, dimension) {
let jobLocationData = serverClasses.jobLocationData(false); let jobLocationData = new serverClasses.jobLocationData(false);
jobLocationData.position = position; jobLocationData.position = position;
jobLocationData.job = job; jobLocationData.job = job;
jobLocationData.interior = interior; jobLocationData.interior = interior;
@@ -1417,3 +1419,60 @@ function saveAllJobsToDatabase() {
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function deleteJobLocationBlip(jobId, locationId) {
if(getJobData(jobId).locations[locationId].blip != null) {
removeFromWorld(getJobData(jobId).locations[locationId].blip);
destroyElement(getJobData(jobId).locations[locationId].blip);
getJobData(jobId).locations[locationId].blip = null;
}
}
// ---------------------------------------------------------------------------
function deleteJobLocationPickup(jobId, locationId) {
if(getJobData(jobId).locations[locationId].pickup != null) {
removeFromWorld(getJobData(jobId).locations[locationId].pickup);
destroyElement(getJobData(jobId).locations[locationId].pickup);
getJobData(jobId).locations[locationId].pickup = null;
}
}
// ---------------------------------------------------------------------------
function createJobLocationPickup(jobId, locationId) {
if(getJobData(jobId).pickupModel != -1) {
let pickupModelId = getGameConfig().pickupModels[getServerGame()].job;
if(getJobData(jobId).pickupModel != 0) {
pickupModelId = getJobData(jobId).pickupModel;
}
getJobData(jobId).locations[locationId].pickup = gta.createPickup(pickupModelId, getJobData(jobId).locations[locationId].position);
getJobData(jobId).locations[locationId].pickup.onAllDimensions = false;
getJobData(jobId).locations[locationId].pickup.dimension = getJobData(jobId).locations[locationId].dimension;
getJobData(jobId).locations[locationId].pickup.setData("ag.owner.type", AG_PICKUP_JOB, false);
getJobData(jobId).locations[locationId].pickup.setData("ag.owner.id", jobId, false);
getJobData(jobId).locations[locationId].pickup.setData("ag.label.type", AG_LABEL_JOB, true);
addToWorld(getJobData(jobId).locations[locationId].pickup);
}
}
// ---------------------------------------------------------------------------
function createJobLocationBlip(jobId, locationId) {
if(getJobData(jobId).blipModel != -1) {
let blipModelId = getGameConfig().blipSprites[getServerGame()].job;
if(getJobData(jobId).blipModel != 0) {
blipModelId = getJobData(jobId).blipModel;
}
getJobData(jobId).locations[locationId].blip = gta.createBlip(getJobData(jobId).locations[locationId].position, blipModelId, getColourByType("job"));
getJobData(jobId).locations[locationId].pickup.onAllDimensions = false;
getJobData(jobId).locations[locationId].pickup.dimension = getJobData(jobId).locations[locationId].dimension;
addToWorld(getJobData(jobId).locations[locationId].pickup);
}
}
// ---------------------------------------------------------------------------

View File

@@ -406,11 +406,13 @@ function showCurrentBusStop(client) {
function arrivedAtBusStop(client) { function arrivedAtBusStop(client) {
if(isLastStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) { if(isLastStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
respawnVehicle(getPlayerData(client).jobRouteVehicle); respawnVehicle(getPlayerData(client).jobRouteVehicle);
messagePlayerNormal(client, `You finished the ${getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} bus route! Your bus has been returned to the bus depot.`, getColourByName("yellow")); messagePlayerNormal(client, `You finished the ${getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} bus route! You earned $${getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout} and your bus has been returned to the bus depot.`, getColourByName("yellow"));
getPlayerCurrentSubAccount(client).cash += getBusRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout;
updatePlayerCash(client);
getPlayerData(client).jobRouteVehicle = false; getPlayerData(client).jobRouteVehicle = false;
getPlayerData(client).jobRoute = 0; getPlayerData(client).jobRoute = 0;
getPlayerData(client).jobRouteStop = 0; getPlayerData(client).jobRouteStop = 0;
getPlayerData(client).jobRouteIsland = 0; getPlayerData(client).jobRouteIsland = 0;
return false; return false;
} }

View File

@@ -116,7 +116,9 @@ function showCurrentGarbageStop(client) {
function arrivedAtGarbageStop(client) { function arrivedAtGarbageStop(client) {
if(isLastStopOnGarbageRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) { if(isLastStopOnGarbageRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
respawnVehicle(getPlayerData(client).jobRouteVehicle); respawnVehicle(getPlayerData(client).jobRouteVehicle);
messagePlayerNormal(client, `You finished the ${getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} garbage route! Your trashmaster has been returned to the garbage depot.`, getColourByName("yellow")); messagePlayerNormal(client, `You finished the ${getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).name} garbage route! You earned $${getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout} and your trashmaster has been returned to the garbage depot.`, getColourByName("yellow"));
getPlayerCurrentSubAccount(client).cash += getGarbageRouteData(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute).payout;
updatePlayerCash(client);
getPlayerData(client).jobRouteVehicle = false; getPlayerData(client).jobRouteVehicle = false;
getPlayerData(client).jobRoute = 0; getPlayerData(client).jobRoute = 0;
getPlayerData(client).jobRouteStop = 0; getPlayerData(client).jobRouteStop = 0;

View File

@@ -136,9 +136,14 @@ function enterExitPropertyCommand(command, params, client) {
setPlayerInterior(client, inHouse.entranceInterior); setPlayerInterior(client, inHouse.entranceInterior);
setTimeout(function() { setTimeout(function() {
fadeCamera(client, true, 1.0); fadeCamera(client, true, 1.0);
setTimeout(function() {
enableCityAmbienceForPlayer(client);
clearPlayerOwnedPeds(client);
}, 2000);
}, 1000); }, 1000);
}, 1100); }, 1100);
removeEntityData(client, "ag.inHouse"); removeEntityData(client, "ag.inHouse");
} }
return true; return true;
} }
@@ -159,9 +164,14 @@ function enterExitPropertyCommand(command, params, client) {
setPlayerInterior(client, inBusiness.entranceInterior); setPlayerInterior(client, inBusiness.entranceInterior);
setTimeout(function() { setTimeout(function() {
fadeCamera(client, true, 1.0); fadeCamera(client, true, 1.0);
setTimeout(function() {
enableCityAmbienceForPlayer(client);
clearPlayerOwnedPeds(client);
}, 2000);
}, 1000); }, 1000);
}, 1100); }, 1100);
removeEntityData(client, "ag.inBusiness"); removeEntityData(client, "ag.inBusiness");
console.log(`[Asshat.Misc] ${getPlayerDisplayForConsole(client)} entered business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
} }
return true; return true;
} }
@@ -184,6 +194,7 @@ function enterExitPropertyCommand(command, params, client) {
meActionToNearbyPlayers(client, "opens the door and enters the business"); meActionToNearbyPlayers(client, "opens the door and enters the business");
fadeCamera(client, false, 1.0); fadeCamera(client, false, 1.0);
disableCityAmbienceForPlayer(client);
setTimeout(function() { setTimeout(function() {
setPlayerPosition(client, closestBusiness.exitPosition); setPlayerPosition(client, closestBusiness.exitPosition);
setPlayerHeading(client, closestBusiness.exitRotation); setPlayerHeading(client, closestBusiness.exitRotation);
@@ -218,6 +229,7 @@ function enterExitPropertyCommand(command, params, client) {
fadeCamera(client, false, 1.0); fadeCamera(client, false, 1.0);
disableCityAmbienceForPlayer(client);
setTimeout(function() { setTimeout(function() {
setPlayerPosition(client, closestHouse.exitPosition); setPlayerPosition(client, closestHouse.exitPosition);
setPlayerHeading(client, closestHouse.exitRotation); setPlayerHeading(client, closestHouse.exitRotation);
@@ -228,7 +240,6 @@ function enterExitPropertyCommand(command, params, client) {
}, 1000); }, 1000);
}, 1100); }, 1100);
setEntityData(client, "ag.inHouse", closestHouseId); setEntityData(client, "ag.inHouse", closestHouseId);
return true; return true;
} }
} }

View File

@@ -315,3 +315,9 @@ function getCharacterFullName(client) {
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function isPlayerSwitchingCharacter(client) {
return getPlayerData(client).switchingCharacter;
}
// ---------------------------------------------------------------------------

View File

@@ -37,6 +37,7 @@ function initTimers() {
serverTimers.updateTimeRuleTimer = setInterval(updateTimeRule, 1000); serverTimers.updateTimeRuleTimer = setInterval(updateTimeRule, 1000);
serverTimers.updatePingsTimer = setInterval(updatePings, 5000); serverTimers.updatePingsTimer = setInterval(updatePings, 5000);
serverTimers.vehicleRentTimer = setInterval(vehicleRentCheck, 60000); serverTimers.vehicleRentTimer = setInterval(vehicleRentCheck, 60000);
serverTimers.garbageCollectorTimer = setInterval(collectAllGarbage, 60000);
} }
} }

View File

@@ -1668,6 +1668,27 @@ function updatePlayerCash(client) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function setPlayerCash(client, amount) {
getPlayerCurrentSubAccount(client).cash = amount;
updatePlayerCash(client);
}
// ---------------------------------------------------------------------------
function givePlayerCash(client, amount) {
getPlayerCurrentSubAccount(client).cash += amount;
updatePlayerCash(client);
}
// ---------------------------------------------------------------------------
function takePlayerCash(client, amount) {
getPlayerCurrentSubAccount(client).cash -= amount;
updatePlayerCash(client);
}
// ---------------------------------------------------------------------------
function clearChatBox(client) { function clearChatBox(client) {
//gta.messages.clear(); //gta.messages.clear();
for(let i = 0; i <= 20; i++) { for(let i = 0; i <= 20; i++) {
@@ -1834,6 +1855,12 @@ async function waitUntil(condition) {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
function resetClientStuff(client) { function resetClientStuff(client) {
console.log(`[Asshat.Utilities] Resetting client data for ${getPlayerDisplayForConsole(client)}`);
if(!getPlayerData(client)) {
return false;
}
if(isPlayerOnJobRoute(client)) { if(isPlayerOnJobRoute(client)) {
stopJobRoute(client); stopJobRoute(client);
} }

View File

@@ -8,6 +8,9 @@
// TYPE: Shared (JavaScript) // TYPE: Shared (JavaScript)
// =========================================================================== // ===========================================================================
"use strict";
setErrorMode(RESOURCEERRORMODE_STRICT);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
function toInteger(val) { function toInteger(val) {