├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.md │ └── feature_request.md └── issue-close-app.yml ├── LICENSE ├── README.md ├── client ├── RichPresence.lua ├── anticheat │ └── anticheat_client.lua ├── db │ ├── dbClient.lua │ └── dbClientSafes.lua ├── gameplay │ ├── binoculars_and_goggles.lua │ ├── dropc.lua │ ├── environment.lua │ ├── humanity_c.lua │ ├── hunted_c.lua │ ├── itemtasks.lua │ ├── newplayer.lua │ ├── nopeds.lua │ ├── noreticle.lua │ ├── savezones_c.lua │ ├── temperature.lua │ └── weather_c.lua ├── gui │ ├── gui.lua │ ├── hud.lua │ ├── notifications.lua │ ├── radio.lua │ └── warmenu.lua ├── hub │ ├── gamble_c.lua │ ├── hub_c.lua │ ├── itemshop_c.lua │ ├── locker_c.lua │ ├── questshop_c.lua │ ├── skinshop_c.lua │ └── wepshop_c.lua ├── inventory │ └── food.lua ├── missions │ ├── ai_camps_c.lua │ ├── airdrop_c.lua │ ├── power_c.lua │ └── quests_c.lua ├── pingkick.lua ├── spawners │ ├── animalspawner.lua │ ├── carspawner.lua │ ├── itemspawner.lua │ └── zombiespawner.lua ├── useful │ ├── exports.lua │ ├── killplayer.lua │ ├── reverse_weapon_hashes.lua │ ├── scaleform_wrapper.lua │ └── util.lua └── web │ └── playsound.html ├── config └── config.lua ├── database.sql ├── fxmanifest.lua ├── map.lua ├── server ├── anticheat │ └── anticheat_server.lua ├── db │ ├── dbServer.lua │ └── dbServerSafes.lua ├── gameplay │ ├── hunted_server.lua │ └── weather_server.lua ├── gui │ ├── gui_s.lua │ └── notifications_s.lua ├── handlers │ └── hosthandler.lua ├── hub │ ├── gamble_s.lua │ ├── itemshop_s.lua │ └── questshop_s.lua ├── inventory │ └── inventory_s.lua ├── main.lua ├── missions │ ├── ai_camps_s.lua │ ├── airdrop_s.lua │ └── power_s.lua ├── pingkick.lua ├── prometheus.lua └── spawners │ ├── carspawner_server.lua │ └── itemspawner_server.lua ├── shared ├── gameplay │ └── weatherconfig.lua ├── hub │ └── hubStores.lua ├── inventory │ └── items.lua ├── missions │ └── quests.lua └── useful │ ├── functions.lua │ └── loghandler.lua └── stream ├── def_props.ytyp ├── rottenv.ytd ├── rottenv_daily.ydr ├── rottenv_supplies.ydr ├── rottenv_weapons.ydr └── rottenv_wheelspin.ydr /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Changes done to the Gamemode** 24 | Have you done any changes to the Gamemode? If so list them here. 25 | 26 | **Screenshots/Videos** 27 | If applicable, add screenshots or a Video to help explain your problem. 28 | 29 | **Logs** 30 | Drag&Drop your Server & Client Log Files here 31 | 32 | 33 | **Additional context** 34 | Add any other context about the problem here. 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/issue-close-app.yml: -------------------------------------------------------------------------------- 1 | # Comment that will be sent if an issue is judged to be closed. 2 | comment: "Hi!\nThank you for your issue, please make sure to follow the issue template!\nI will close this issue, please create a new issue following the template!" 3 | issueConfigs: 4 | # There can be several configs for different kind of issues. 5 | - content: 6 | - "Describe the bug" 7 | - "To Reproduce" 8 | - "Expected behavior" 9 | - "Screenshots/Videos" 10 | - "Logs" 11 | - content: 12 | - "Is your feature request related to a problem" 13 | - "Describe the solution" 14 | - "Describe alternatives" 15 | # Optional configuration: 16 | # 17 | # whether the keywords are case-insensitive 18 | # default value is false, which means keywords are case-sensitive 19 | caseInsensitive: false 20 | # the label that will be added when the bot close an issue 21 | # The bot will only add a label if this property is set. 22 | label: "closed by bot" 23 | # The bot will ignore any issues that are opened or reopened by the user names in exception 24 | exception: 25 | - "" 26 | # The issue is judged to be legal if it includes all keywords from any of these two configs. 27 | # Or it will be closed by the app. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Blumlaut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RottenV 2 | RottenV:R is a Community-Driven Zombie Gamemode, originally developed by Scammer, it has been majorly rewritten and expanded by Blü, it has been in development for over 3 years with breaks inbetween, this is the public release of the whole Gamemode, nothing was redacted, everything is here. 3 | 4 | ## Features 5 | - Fully integrated currency system 6 | - Hunger, thirst and morality system with different skins 7 | - over 100 usable items 8 | - Adaptable quest system and random world events 9 | - Dynamic enemies which react to player behaviour 10 | - Persistant player inventories 11 | - Realistic voice chat with a radio system for long-listance chatting 12 | 13 | 14 | Please refer to the [Wiki](https://github.com/Bluethefurry/RottenV/wiki) for a guide on how to install everything. 15 | 16 | Experience an issue or have a suggestion? Feel free to create an [Issue](https://github.com/Bluethefurry/RottenV/issues) 17 | 18 | Made your own changes to the code? Feel free to add it! We're always looking for [Pull Requests](https://github.com/Bluethefurry/RottenV/pulls) 19 | 20 | Discord Server: https://discord.gg/GugyRU8 21 | -------------------------------------------------------------------------------- /client/RichPresence.lua: -------------------------------------------------------------------------------- 1 | local StatusQueue = {} 2 | 3 | if config.enabledrp then 4 | Citizen.CreateThread(function() 5 | while true do 6 | Citizen.Wait(300000) 7 | SetDiscordAppId(config.appid) 8 | end 9 | end) 10 | end 11 | 12 | function SetNextRichPresence(label) 13 | table.insert(StatusQueue,1,label) 14 | end 15 | 16 | function AddRichPresence(label) 17 | table.insert(StatusQueue,label) 18 | end 19 | 20 | Citizen.CreateThread(function() 21 | while true do 22 | Citizen.Wait(30000) 23 | if StatusQueue[1] then 24 | SetRichPresence(StatusQueue[1]) 25 | table.remove(StatusQueue,1) 26 | else 27 | local status = GenerateRichPresence() 28 | SetRichPresence(status) 29 | end 30 | end 31 | end) 32 | 33 | function GenerateRichPresence() 34 | local possibleStates = { 35 | "Exploring the Wastelands", 36 | "Surviving the Apocalypse", 37 | "Thinking about Cheese", 38 | "Thinking about the Old Times", 39 | "Planning their next Move", 40 | "Looking for a Safezone", 41 | "Searching for Loot", 42 | "Searching for Weapons", 43 | } 44 | local PlayerPed = PlayerPedId() 45 | 46 | if IsPedWalking(PlayerPed) then 47 | table.insert(possibleStates, "Walking across San Andreas") 48 | table.insert(possibleStates, "Walking across the Wastelands") 49 | table.insert(possibleStates, "Exploring the Area") 50 | elseif IsPedRunning(PlayerPed) then 51 | table.insert(possibleStates, "Running across San Andreas") 52 | table.insert(possibleStates, "Running across the Wastelands") 53 | table.insert(possibleStates, "Running from the Undead") 54 | elseif IsPedSprinting(PlayerPed) then 55 | table.insert(possibleStates, "Sprinting across San Andreas") 56 | table.insert(possibleStates, "Sprinting across the Wastelands") 57 | table.insert(possibleStates, "Sprinting from the Undead") 58 | end 59 | if IsPedInAnyVehicle(PlayerPed, false) then 60 | table.insert(possibleStates, "Travelling across San Andreas") 61 | end 62 | if possessed then 63 | table.insert(possibleStates, "Having a Nightmare") 64 | end 65 | if isPlayerInSafezone then 66 | table.insert(possibleStates, "In Safety") 67 | table.insert(possibleStates, "Relaxing") 68 | end 69 | if #curSquadMembers > 1 then 70 | table.insert(possibleStates, "Exploring the Wastelands with Friends") 71 | table.insert(possibleStates, "Travelling in a Squad") 72 | end 73 | if GetClockHours() < 5 or GetClockHours() > 22 then 74 | table.insert(possibleStates, "Travelling in the Cold") 75 | table.insert(possibleStates, "Experiencing the Darkness") 76 | end 77 | if LocalPlayer.state.thirst < 20.0 then 78 | table.insert(possibleStates, "Searching for a Drink") 79 | table.insert(possibleStates, "Dying of Thirst") 80 | end 81 | if LocalPlayer.state.hunger < 20.0 then 82 | table.insert(possibleStates, "Starving") 83 | table.insert(possibleStates, "Searching for Food") 84 | end 85 | return possibleStates[math.random(1, #possibleStates)] 86 | end 87 | -------------------------------------------------------------------------------- /client/anticheat/anticheat_client.lua: -------------------------------------------------------------------------------- 1 | -- this should delete peds that are not created by us 2 | Citizen.CreateThread(function() 3 | while true do 4 | local handle, ped = FindFirstPed() 5 | local finished = false -- FindNextPed will turn the first variable to false when it fails to find another ped in the index 6 | repeat 7 | Wait(1) 8 | if not IsPedAPlayer(ped) then 9 | if not Entity(ped).state.C8pE53jw then 10 | NetworkRequestControlOfEntity(ped) 11 | Wait(3000) 12 | SetEntityAsMissionEntity(ped,true,true) 13 | DeletePed(ped) 14 | end 15 | end 16 | finished, ped = FindNextPed(handle) -- first param returns true while entities are found 17 | until not finished 18 | EndFindPed(handle) 19 | Citizen.Wait(2000) 20 | if IsPedInAnyVehicle(PlayerPedId(), false) then 21 | local veh = GetVehiclePedIsIn(PlayerPedId(), false) 22 | if not Entity(veh).state.C8pE53jw then 23 | NetworkRequestControlOfEntity(veh) 24 | SetVehicleOilLevel(veh, 0.0) 25 | for i=0,8 do 26 | SetVehicleTyreBurst(veh, i, true, 1000) 27 | Wait(1) 28 | end 29 | SetVehicleEngineHealth(veh, 1) 30 | SetVehicleNumberPlateText(veh, "CHEATED") 31 | writeLog("\nRemoving Cheated Vehicle.",1) 32 | SetEntityVelocity(veh, 0.0, 0.0, 0.0) 33 | TaskLeaveVehicle(PlayerPedId(), veh, 0) 34 | SetVehicleDoorsLocked(veh, 2) 35 | SetEntityAsNoLongerNeeded(veh) 36 | Wait(4000) 37 | SetEntityVelocity(veh, 0.0, 0.0, 30.0) 38 | Wait(500) 39 | DeleteVehicle(veh) 40 | else 41 | Entity(veh).state:set("C8pE53jw", true, true) 42 | end 43 | end 44 | end 45 | end) 46 | 47 | -- prevent money / safe cheats 48 | Citizen.CreateThread(function() 49 | while true do 50 | Citizen.Wait(3000) 51 | local money = consumableItems.count[17] 52 | consumableItems.count[17] = money 53 | local safes = consumableItems.count[18] 54 | if safes > 30 then 55 | consumableItems.count[18] = 3.0 56 | TriggerServerEvent("AntiCheese:CustomFlag", "Safe Cheating", "had "..safes.." safes.") 57 | end 58 | if money > 200000000 then 59 | consumableItems.count[17] = 0 60 | TriggerServerEvent("AntiCheese:CustomFlag", "Money Cheating", "had $"..money) 61 | end 62 | local money = consumableItems.count[17] 63 | end 64 | end) 65 | 66 | -- prevent hunger/thirst cheats 67 | Citizen.CreateThread(function() 68 | while true do 69 | Citizen.Wait(60000) 70 | local curPed = PlayerPedId() 71 | local curHunger = LocalPlayer.state.hunger 72 | local curThirst = LocalPlayer.state.thirst 73 | LocalPlayer.state.hunger = curHunger-2 74 | LocalPlayer.state.thirst = curThirst-2 75 | 76 | local curWait = math.random(10,50) 77 | 78 | Citizen.Wait(curWait) 79 | 80 | if not IsPlayerDead(PlayerId()) then 81 | if PlayerPedId() == curPed and LocalPlayer.state.hunger == curHunger and GetEntityHealth(curPed) ~= 0 then 82 | TriggerServerEvent("AntiCheese:CustomFlag", "Hunger Cheating", "has regenerated "..LocalPlayer.state.hunger-curHunger.."% Hunger in "..curWait.."ms") 83 | elseif LocalPlayer.state.hunger <= curHunger-2 then 84 | LocalPlayer.state.hunger = LocalPlayer.state.hunger+2 85 | end 86 | 87 | if PlayerPedId() == curPed and LocalPlayer.state.thirst == curThirst and GetEntityHealth(curPed) ~= 0 then 88 | TriggerServerEvent("AntiCheese:CustomFlag", "Thirst Cheating", "has regenerated "..LocalPlayer.state.thirst-curThirst.."% Thirst in "..curWait.."ms") 89 | elseif LocalPlayer.state.thirst <= curThirst-2 then 90 | LocalPlayer.state.thirst = LocalPlayer.state.thirst+2 91 | end 92 | 93 | end 94 | end 95 | end) 96 | 97 | 98 | 99 | 100 | Citizen.CreateThread(function() 101 | function DetectedCheat(eventname,args) 102 | TriggerServerEvent("BaitEvents:DetectedCheat", nil,eventname, "CLIENT", args) 103 | end 104 | 105 | RegisterNetEvent("BaitEvents:RecieveEvents") 106 | AddEventHandler("BaitEvents:RecieveEvents", function(events) 107 | for i,event in pairs(events) do 108 | RegisterNetEvent(event) 109 | AddEventHandler(event, function(...) 110 | local arg = {...} 111 | DetectedCheat(event, arg) 112 | end) 113 | end 114 | end) 115 | TriggerServerEvent("BaitEvents:RequestEvents") 116 | end) -------------------------------------------------------------------------------- /client/db/dbClientSafes.lua: -------------------------------------------------------------------------------- 1 | local safes = {} 2 | safeContents = {} 3 | safeContents.count = {} 4 | currentSafe = {} 5 | for i,Consumable in ipairs(consumableItems) do 6 | safeContents.count[i] = 0.0 7 | end 8 | 9 | RegisterNetEvent("loadSafes") 10 | RegisterNetEvent("loadSafe") 11 | RegisterNetEvent("GetSafeContents") 12 | RegisterNetEvent("removeSafe") 13 | RegisterNetEvent("addSafe") 14 | RegisterNetEvent("addCustomSafe") 15 | 16 | 17 | local isNearSafe = false 18 | 19 | local safemenus = {'safe','safeinventory','safeadditem','safetakeitem'} 20 | 21 | AddEventHandler("loadSafes", function(tt) 22 | safes = tt 23 | updateAllSafes() 24 | writeLog("\nSafes Recieved!\n", 1) 25 | end) 26 | 27 | AddEventHandler("loadSafe", function(t) 28 | table.insert(safes,t) 29 | updateAllSafes() 30 | end) 31 | 32 | 33 | Citizen.CreateThread(function() 34 | if not HasModelLoaded("prop_ld_int_safe_01") then 35 | RequestModel('prop_ld_int_safe_01') 36 | end 37 | function updateAllSafes() 38 | for i,theSafe in pairs(safes) do 39 | if theSafe.visible and not theSafe.blip then 40 | local blip = AddBlipForCoord(theSafe.x,theSafe.y,theSafe.z) -- Creates the name of the blip on the list in the pause menu 41 | SetBlipSprite(blip, theSafe.blipicon or 181) 42 | SetBlipColour(blip, 6) 43 | SetBlipAsShortRange(blip, true) 44 | BeginTextCommandSetBlipName("STRING") 45 | if theSafe.blipicon then 46 | AddTextComponentString("Airdrop") 47 | else 48 | AddTextComponentString("Unlocked Safe. Passcode: 0000") 49 | end 50 | EndTextCommandSetBlipName(blip) 51 | safes[i].blip = blip 52 | end 53 | 54 | if not theSafe.obj then 55 | if not HasModelLoaded(theSafe.model or "prop_ld_int_safe_01") then 56 | RequestModel(theSafe.model or 'prop_ld_int_safe_01') 57 | end 58 | while not HasModelLoaded(theSafe.model or 'prop_ld_int_safe_01') do 59 | Citizen.Wait(1) 60 | end 61 | 62 | local obj = CreateObjectNoOffset(theSafe.model or "prop_ld_int_safe_01", theSafe.x,theSafe.y,theSafe.z,false,true,true) 63 | SetEntityRotation(obj,0.0,0.0,theSafe.r,1,true) 64 | PlaceObjectOnGroundProperly(obj) 65 | FreezeEntityPosition(obj,true) 66 | safes[i].obj = obj 67 | end 68 | end 69 | end 70 | 71 | function SaveCurrentSafe() 72 | TriggerServerEvent("SetSafeContents", currentSafe.id,currentSafe.x, currentSafe.y, currentSafe.z, currentSafe.r, currentSafe.passcode, safeContents) 73 | end 74 | 75 | AddEventHandler("GetSafeContents", function(id,x,y,z,r,passcode,inventory) 76 | if passcode then 77 | currentSafe = {id=id,x=x,y=y,z=z,r=r,passcode=passcode,inventory=inventory } 78 | safeContents = inventory 79 | WarMenu.OpenMenu("safeinventory") 80 | end 81 | end) 82 | 83 | 84 | AddEventHandler("addSafe", function(id,x,y,z,r) 85 | table.insert(safes, {id = id,x = x,y = y,z = z,r = r} ) 86 | updateAllSafes() 87 | end) 88 | 89 | AddEventHandler("addCustomSafe", function(id,x,y,z,r,model,blip) 90 | table.insert(safes, {id = id,x = x,y = y,z = z,r = r, model=model,blipicon=blip,visible=true} ) 91 | updateAllSafes() 92 | end) 93 | 94 | AddEventHandler("removeSafe", function(id) 95 | for i,theSafe in pairs(safes) do 96 | if theSafe.id == id then 97 | if theSafe.obj then 98 | DeleteObject(theSafe.obj) 99 | end 100 | if theSafe.blip then 101 | RemoveBlip(theSafe.blip) 102 | end 103 | table.remove(safes,i) 104 | end 105 | end 106 | end) 107 | 108 | end) 109 | 110 | Citizen.CreateThread(function() -- this thread will loop our local table to see if we are near a safe and then add it to the interaction menu 111 | while true do 112 | Citizen.Wait(1) 113 | isNearSafe = false 114 | local playerCoords = GetEntityCoords(PlayerPedId(), true) 115 | for i,theSafe in pairs(safes) do 116 | if #(playerCoords - vector3(theSafe.x,theSafe.y,theSafe.z)) < 2.5 then 117 | isNearSafe = true 118 | DrawMissonText("Press E to Open. ("..theSafe.id..")",100,true) 119 | if IsControlJustPressed(1, 51) then 120 | WarMenu.OpenMenu('safe') 121 | end 122 | if WarMenu.IsMenuOpened('Interaction') then 123 | if WarMenu.MenuButton('Safe', 'safe') then 124 | 125 | end 126 | elseif WarMenu.IsMenuOpened('safe') then 127 | if WarMenu.Button('Open') then 128 | if not theSafe.visible then 129 | local result, type = CreateAwaitedKeyboardInput("FMMC_KEY_TIP1", "Enter Passcode",4) 130 | if result then 131 | TriggerServerEvent("GetSafeContents", theSafe.id,result) 132 | safeContents = {} 133 | safeContents.count = {} 134 | for i,Consumable in ipairs(consumableItems) do 135 | safeContents.count[i] = 0.0 136 | end 137 | end 138 | else 139 | TriggerServerEvent("GetSafeContents", theSafe.id,"0000") 140 | safeContents = {} 141 | safeContents.count = {} 142 | for i,Consumable in ipairs(consumableItems) do 143 | safeContents.count[i] = 0.0 144 | end 145 | end 146 | elseif not theSafe.visible and WarMenu.Button('Destroy') then 147 | local result, type = CreateAwaitedKeyboardInput("FMMC_KEY_TIP1", "Enter Passcode ( WARNING: THIS WILL DESTROY EVERYTHING INSIDE! )",4) 148 | if result then 149 | TriggerServerEvent("removeSafe", theSafe.id,result) 150 | end 151 | end 152 | end 153 | end 154 | end 155 | if not isNearSafe then 156 | for i,menu in pairs(safemenus) do 157 | if WarMenu.IsMenuOpened(menu) then 158 | WarMenu.CloseMenu(menu) 159 | if currentSafe.id then 160 | TriggerServerEvent("ExitSafe", currentSafe.id) 161 | end 162 | initiateSave(true) 163 | end 164 | end 165 | end 166 | end 167 | end) 168 | 169 | 170 | Citizen.CreateThread(function() 171 | while true do 172 | Wait(1000) 173 | local isInSafeMenu = false 174 | for i,menu in pairs(safemenus) do 175 | if WarMenu.IsMenuOpened(menu) then 176 | isInSafeMenu = true 177 | end 178 | end 179 | 180 | if not isInSafeMenu and currentSafe.id then 181 | TriggerServerEvent("ExitSafe", currentSafe.id) 182 | currentSafe = {} 183 | initiateSave(true) 184 | end 185 | end 186 | end) -------------------------------------------------------------------------------- /client/gameplay/binoculars_and_goggles.lua: -------------------------------------------------------------------------------- 1 | local fov_max = 70.0 2 | local fov_min = 5.0 -- max zoom level (smaller fov is more zoom) 3 | local zoomspeed = 10.0 -- camera zoom speed 4 | local speed_lr = 8.0 -- speed by which the camera pans left-right 5 | local speed_ud = 8.0 -- speed by which the camera pans up-down 6 | 7 | binoculars = false 8 | local fov = (fov_max+fov_min)*0.5 9 | 10 | 11 | local binocularKey = 29 12 | 13 | --THREADS-- 14 | 15 | Citizen.CreateThread(function() 16 | while true do 17 | 18 | Citizen.Wait(0) 19 | 20 | local lPed = GetPlayerPed(-1) 21 | local vehicle = GetVehiclePedIsIn(lPed) 22 | 23 | -- anticheat for NV/ST/Bino 24 | if consumableItems.count[88] == 0 and binoculars then 25 | StopBinocularAnim() 26 | end 27 | 28 | if IsControlJustPressed(1, binocularKey) and consumableItems.count[88] > 0 and not binoculars then 29 | binoculars = true 30 | if not IsPedSittingInAnyVehicle( lPed ) then 31 | Citizen.CreateThread(function() 32 | TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_BINOCULARS", 0, 1) 33 | end) 34 | end 35 | elseif IsControlJustPressed(1, binocularKey) and consumableItems.count[88] == 0 and not binoculars then 36 | TriggerEvent("showNotification", "I don't have any Binoculars.") 37 | end 38 | 39 | if binoculars then 40 | binoculars = true 41 | SetNightvision(false) 42 | SetSeethrough(false) 43 | 44 | 45 | 46 | 47 | Wait(2000) 48 | local scaleform = RequestScaleformMovie("BINOCULARS") 49 | 50 | while not HasScaleformMovieLoaded(scaleform) do 51 | Citizen.Wait(10) 52 | end 53 | 54 | SetTimecycleModifier("default") 55 | 56 | SetTimecycleModifierStrength(0.3) 57 | 58 | 59 | local lPed = GetPlayerPed(-1) 60 | local vehicle = GetVehiclePedIsIn(lPed) 61 | local cam = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true) 62 | 63 | AttachCamToEntity(cam, lPed, 0.0,0.0,1.0, true) 64 | SetCamRot(cam, 0.0,0.0,GetEntityHeading(lPed)) 65 | SetCamFov(cam, fov) 66 | RenderScriptCams(true, false, 0, 1, 0) 67 | PushScaleformMovieFunction(scaleform, "SET_CAM_LOGO") 68 | PushScaleformMovieFunctionParameterInt(0) -- 0 for nothing, 1 for LSPD logo 69 | PopScaleformMovieFunctionVoid() 70 | 71 | while binoculars and not IsEntityDead(lPed) and (GetVehiclePedIsIn(lPed) == vehicle) and true do 72 | if IsControlJustPressed(0, binocularKey) then -- Toggle binoculars 73 | ClearPedTasks(GetPlayerPed(-1)) 74 | binoculars = false 75 | end 76 | 77 | local zoomvalue = (1.0/(fov_max-fov_min))*(fov-fov_min) 78 | CheckInputRotation(cam, zoomvalue) 79 | 80 | HandleZoom(cam) 81 | HideHUDThisFrame() 82 | SetNightvision(false) 83 | SetSeethrough(false) 84 | DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255) 85 | Citizen.Wait(1) 86 | end 87 | 88 | binoculars = false 89 | ClearTimecycleModifier() 90 | fov = (fov_max+fov_min)*0.5 91 | RenderScriptCams(false, false, 0, 1, 0) 92 | SetScaleformMovieAsNoLongerNeeded(scaleform) 93 | DestroyCam(cam, false) 94 | SetNightvision(false) 95 | SetSeethrough(false) 96 | end 97 | end 98 | end) 99 | 100 | --EVENTS-- 101 | 102 | -- Activate binoculars 103 | AddEventHandler('binoculars:Activate', function() 104 | binoculars = not binoculars 105 | end) 106 | 107 | 108 | --FUNCTIONS-- 109 | 110 | function StopBinocularAnim() 111 | binoculars = false 112 | ClearPedTasks(GetPlayerPed(-1)) 113 | ClearTimecycleModifier() 114 | fov = (fov_max+fov_min)*0.5 115 | RenderScriptCams(false, false, 0, 1, 0) 116 | SetScaleformMovieAsNoLongerNeeded(scaleform) 117 | DestroyCam(cam, false) 118 | SetNightvision(false) 119 | SetSeethrough(false) 120 | end 121 | 122 | function CheckInputRotation(cam, zoomvalue) 123 | local rightAxisX = GetDisabledControlNormal(0, 220) 124 | local rightAxisY = GetDisabledControlNormal(0, 221) 125 | local rotation = GetCamRot(cam, 2) 126 | if rightAxisX ~= 0.0 or rightAxisY ~= 0.0 then 127 | new_z = rotation.z + rightAxisX*-1.0*(speed_ud)*(zoomvalue+0.1) 128 | new_x = math.max(math.min(20.0, rotation.x + rightAxisY*-1.0*(speed_lr)*(zoomvalue+0.1)), -89.5) 129 | SetCamRot(cam, new_x, 0.0, new_z, 2) 130 | end 131 | end 132 | 133 | function HandleZoom(cam) 134 | local lPed = GetPlayerPed(-1) 135 | if not ( IsPedSittingInAnyVehicle( lPed ) ) then 136 | 137 | if IsControlJustPressed(0,241) then -- Scrollup 138 | fov = math.max(fov - zoomspeed, fov_min) 139 | end 140 | if IsControlJustPressed(0,242) then 141 | fov = math.min(fov + zoomspeed, fov_max) -- ScrollDown 142 | end 143 | local current_fov = GetCamFov(cam) 144 | if math.abs(fov-current_fov) < 0.1 then 145 | fov = current_fov 146 | end 147 | SetCamFov(cam, current_fov + (fov - current_fov)*0.05) 148 | else 149 | if IsControlJustPressed(0,17) then -- Scrollup 150 | fov = math.max(fov - zoomspeed, fov_min) 151 | end 152 | if IsControlJustPressed(0,16) then 153 | fov = math.min(fov + zoomspeed, fov_max) -- ScrollDown 154 | end 155 | local current_fov = GetCamFov(cam) 156 | if math.abs(fov-current_fov) < 0.1 then -- the difference is too small, just set the value directly to avoid unneeded updates to FOV of order 10^-5 157 | fov = current_fov 158 | end 159 | SetCamFov(cam, current_fov + (fov - current_fov)*0.05) -- Smoothing of camera zoom 160 | end 161 | end -------------------------------------------------------------------------------- /client/gameplay/dropc.lua: -------------------------------------------------------------------------------- 1 | RegisterNetEvent("dropweapon") 2 | AddEventHandler('dropweapon', function() 3 | local ped = PlayerPedId() 4 | if DoesEntityExist(ped) and not IsEntityDead(ped) then 5 | local x,y,z = table.unpack(GetEntityCoords(ped,true)) 6 | local weaponHash = GetSelectedPedWeapon(ped) 7 | local ammo = GetAmmoInPedWeapon(ped, weapon) 8 | local _,clipammo = GetAmmoInClip(ped, weapon) 9 | --RemoveWeaponFromPed(ped, weapon) 10 | local weapon = tostring(weaponHash) 11 | local weapon = reverseWeaponHash(weapon,2) 12 | if weapon then 13 | RemoveWeaponFromPed(ped, weaponHash) 14 | ForceCreateWeaponPickupAtCoord(x+4,y,z, weapon, ammo-(clipammo*2)) 15 | end 16 | end 17 | end) 18 | -------------------------------------------------------------------------------- /client/gameplay/environment.lua: -------------------------------------------------------------------------------- 1 | -- CONFIG -- 2 | 3 | -- Allows you to set if time should be frozen and what time 4 | local freezeTime = false 5 | local hours = 1 6 | local minutes = 0 7 | 8 | -- Set if first person should be forced 9 | local forceFirstPerson = false 10 | 11 | -- CODE -- 12 | 13 | Citizen.CreateThread(function() 14 | while true do 15 | Citizen.Wait(0) 16 | _,pw = GetCurrentPedWeapon(PlayerPedId(), true) 17 | if GetWeaponDamageType(pw) ~= 2 then 18 | DisableControlAction(0, 140, true) 19 | DisableControlAction(0, 142, true) 20 | end 21 | SetFlashLightFadeDistance(30.0) 22 | end 23 | end) 24 | 25 | Citizen.CreateThread(function() 26 | SetBlackout(true) 27 | while true do 28 | Wait(1) 29 | 30 | SetPlayerWantedLevel(PlayerId(), 0, false) 31 | SetPlayerWantedLevelNow(PlayerId(), false) 32 | end 33 | end) 34 | 35 | local leapYear = 1 36 | 37 | 38 | Citizen.CreateThread( function() 39 | RegisterNetEvent("tads:timeanddatesync") 40 | AddEventHandler("tads:timeanddatesync", function(time,date) 41 | NetworkOverrideClockTime(time.hour,time.minute,0) 42 | SetClockDate(date.day,date.month,date.year) 43 | end) 44 | TriggerServerEvent("tads:newplayer") 45 | 46 | end) -------------------------------------------------------------------------------- /client/gameplay/humanity_c.lua: -------------------------------------------------------------------------------- 1 | 2 | -- humanity regenerative code, there are no handlers for PlayerPed skins yet as that would require some coding magic, maybe 3 | humanity = 500 -- make sure humanity is defined so other scripts dont break 4 | infectionchance = { 5 | {humanitystart = 900, humanitystop = 9999, chance = 1}, 6 | {humanitystart = 800, humanitystop = 900, chance = 3}, 7 | {humanitystart = 700, humanitystop = 800, chance = 6}, 8 | {humanitystart = 600, humanitystop = 700, chance = 8}, 9 | {humanitystart = 400, humanitystop = 600, chance = 12}, 10 | {humanitystart = 300, humanitystop = 400, chance = 16}, 11 | {humanitystart = 200, humanitystop = 300, chance = 18}, 12 | {humanitystart = 100, humanitystop = 200, chance = 23}, 13 | {humanitystart = -9999, humanitystop = 100, chance = 26} 14 | } 15 | 16 | -- actually, maybe only the hunger/thirst things. 17 | -- also weapons need to be transfered between skin changes. 18 | 19 | possessed = false 20 | 21 | Citizen.CreateThread(function () 22 | while true do 23 | Citizen.Wait(300000) 24 | local PlayerPed = PlayerPedId() 25 | if humanity < 1300 then 26 | if #curSquadMembers > 1 and #curSquadMembers <= 4 then 27 | humanity = humanity+5.0 28 | elseif #curSquadMembers > 4 and #curSquadMembers <= 6 then 29 | humanity = humanity+7.0 30 | elseif #curSquadMembers > 6 then 31 | humanity = humanity+10.0 32 | else 33 | humanity = humanity+3.0 34 | end 35 | end 36 | end 37 | end) 38 | 39 | 40 | Citizen.CreateThread(function() 41 | Citizen.Wait(30000) 42 | while true do 43 | Citizen.Wait(0) 44 | local oldPed = PlayerPedId() 45 | local oldHealth = GetEntityHealth(oldPed) 46 | 47 | Wait(100) 48 | local newPed = PlayerPedId() 49 | local newHealth = GetEntityHealth(newPed) 50 | 51 | if oldHealth - newHealth > 20 and newPed == oldPed then 52 | local c = math.random(0,100) 53 | for i, infection in ipairs(infectionchance) do 54 | if humanity >= infection.humanitystart and humanity < infection.humanitystop then 55 | if c <= infection.chance and not infected then 56 | infected = true 57 | TriggerEvent("showNotification", "You have been ~r~Infected~w~! \nFind ~g~Antibiotics~w~ to Cure it!") 58 | initiateSave(true) 59 | end 60 | end 61 | end 62 | end 63 | end 64 | end) 65 | 66 | Citizen.CreateThread(function() 67 | function PossessPlayer(ped) 68 | possessed = true 69 | local veh = false 70 | local seat = false 71 | local playerped = PlayerPedId() 72 | if IsPedInAnyVehicle(playerped,false) then 73 | veh = GetVehiclePedIsIn(playerped) 74 | for i = -1, 16 do 75 | if GetPedInVehicleSeat(veh,i) == playerped then 76 | seat = i 77 | end 78 | end 79 | end 80 | 81 | 82 | ClearPedTasksImmediately(playerped) 83 | StartScreenEffect("DrugsMichaelAliensFight", 1000,true) 84 | SetPedFleeAttributes(ped, 0, 0) 85 | SetPedCombatAttributes(ped, 16, 1) 86 | SetPedCombatAttributes(ped, 17, 0) 87 | SetPedCombatAttributes(ped, 46, 1) 88 | SetPedCombatAttributes(ped, 1424, 0) 89 | SetPedCombatAttributes(ped, 5, 1) 90 | SetPedCombatRange(ped,2) 91 | SetPedAlertness(ped,3) 92 | SetPedIsDrunk(ped, true) 93 | if veh then 94 | SetPedIntoVehicle(ped,veh,seat) 95 | end 96 | RequestAnimSet("move_m@drunk@verydrunk") 97 | while not HasAnimSetLoaded("move_m@drunk@verydrunk") do 98 | Wait(100) 99 | end 100 | SetPedMovementClipset(ped, "move_m@drunk@verydrunk", 1.0) 101 | TaskWanderStandard(ped, 1.0, 10) 102 | SetPedRelationshipGroupHash(ped, GetHashKey("zombeez")) 103 | SetCurrentPedWeapon(ped, "WEAPON_UNARMED", true) 104 | SetPlayerMeleeWeaponDamageModifier(-1, 3.0) 105 | end 106 | 107 | function unPossessPlayer(ped, oldhunger,oldthirst,oldhumanity) 108 | possessed = false 109 | ClearPedTasksImmediately(PlayerPedId()) 110 | StopScreenEffect("DrugsMichaelAliensFight") 111 | SetPedIsDrunk(ped, false) 112 | ResetPedMovementClipset(ped, 0.0) 113 | SetPedRelationshipGroupHash(ped, GetHashKey("PLAYER")) 114 | SetPlayerMeleeWeaponDamageModifier(-1, 1.0) 115 | if oldhunger then 116 | LocalPlayer.state.hunger = oldhunger 117 | LocalPlayer.state.thirst = oldthirst 118 | humanity = oldhumanity-30.0 119 | end 120 | end 121 | end) 122 | 123 | Citizen.CreateThread(function() 124 | function checkPossession() 125 | local ped = PlayerPedId() 126 | if infected then 127 | if not possessed then 128 | thunger = LocalPlayer.state.hunger 129 | tthirst = LocalPlayer.state.thirst 130 | thumanity = humanity 131 | PossessPlayer(ped) 132 | initiateSave(true) 133 | if WarMenu.IsMenuOpened('Interaction') then 134 | WarMenu.CloseMenu() 135 | end 136 | local wait = math.random(10000, 40000) 137 | SetTimeout(wait,checkPossession) 138 | else 139 | unPossessPlayer(ped, thunger,tthirst,thumanity) 140 | initiateSave(true) 141 | end 142 | end 143 | local wait = math.random(300000, 1200000) 144 | SetTimeout(wait,checkPossession) -- make sure this check repeats itself 145 | end 146 | checkPossession() 147 | end) 148 | 149 | 150 | Citizen.CreateThread(function() 151 | while true do 152 | Citizen.Wait(100) 153 | if infected then 154 | if possessed then 155 | LocalPlayer.state.hunger = math.random(20,100)+.0 156 | LocalPlayer.state.thirst = math.random(20,100)+.0 157 | humanity = math.random(0,999)+.0 158 | end 159 | end 160 | end 161 | end) 162 | -------------------------------------------------------------------------------- /client/gameplay/hunted_c.lua: -------------------------------------------------------------------------------- 1 | local KilledPlayers = {} 2 | local HuntedPlayers = {} 3 | IsPlayerHunted = false 4 | 5 | 6 | RegisterNetEvent("Z:killedPlayer") 7 | AddEventHandler("Z:killedPlayer", function(playerId) 8 | table.insert(KilledPlayers, playerId) 9 | if #KilledPlayers >= config.huntedAmount and not IsPlayerHunted then 10 | local cx,cy,cz = GetEntityCoords(PlayerPedId(), true) 11 | TriggerServerEvent("AddPlayerHunted", cx,cy,cz) 12 | IsPlayerHunted = true 13 | end 14 | end) 15 | 16 | RegisterNetEvent("AddPlayerHunted") 17 | AddEventHandler("AddPlayerHunted", function(player) 18 | if player.id == GetPlayerServerId(PlayerId()) then 19 | TriggerEvent("showNotification", "You are being ~r~Hunted~w~, you are now visible on the Map.") 20 | IsPlayerHunted = true 21 | SetResourceKvpInt("hunted",1) 22 | else 23 | player.blip = AddBlipForCoord(player.x, player.y, player.z) 24 | SetBlipDisplay(player.blip, 2) 25 | SetBlipSprite(player.blip, 303) 26 | SetBlipColour(player.blip, 1) 27 | BeginTextCommandSetBlipName("STRING") 28 | AddTextComponentString(GetPlayerName(GetPlayerFromServerId(player.id))) 29 | EndTextCommandSetBlipName(player.blip) 30 | table.insert(HuntedPlayers, player) 31 | TriggerEvent("showNotification", ""..GetPlayerName(GetPlayerFromServerId(player.id)).." is being ~r~Hunted~w~ and is now visible on the Map.") 32 | end 33 | end) 34 | 35 | 36 | RegisterNetEvent("UpdateHuntedPos") 37 | AddEventHandler("UpdateHuntedPos", function(player) 38 | if player.id == GetPlayerServerId(PlayerId()) then 39 | IsPlayerHunted = true 40 | else 41 | local found = false 42 | for i,hunted in ipairs(HuntedPlayers) do 43 | if player.id == hunted.id then 44 | found = true 45 | SetBlipCoords(hunted.blip, player.x, player.y, player.z) 46 | end 47 | end 48 | if not found then 49 | player.blip = AddBlipForCoord(player.x, player.y, player.z) 50 | SetBlipDisplay(player.blip, 2) 51 | SetBlipSprite(player.blip, 303) 52 | SetBlipColour(player.blip, 1) 53 | BeginTextCommandSetBlipName("STRING") 54 | AddTextComponentString(GetPlayerName(GetPlayerFromServerId(player.id))) 55 | EndTextCommandSetBlipName(player.blip) 56 | table.insert(HuntedPlayers, player) 57 | TriggerEvent("showNotification", ""..GetPlayerName(GetPlayerFromServerId(player.id)).." is being ~r~Hunted~w~ and is now visible on the Map.") 58 | end 59 | end 60 | end) 61 | 62 | RegisterNetEvent("ExpireHunted") 63 | AddEventHandler("ExpireHunted", function(player) 64 | if player.id == GetPlayerServerId(PlayerId()) then 65 | IsPlayerHunted = false 66 | TriggerEvent("showNotification", "Hunt Expired, you are no longer marked on the Map.") 67 | SetResourceKvpInt("hunted",0) 68 | else 69 | for i,hunted in ipairs(HuntedPlayers) do 70 | if player.id == hunted.id then 71 | RemoveBlip(hunted.blip) 72 | table.remove(HuntedPlayers,i) 73 | TriggerEvent("showNotification", "Hunt for "..GetPlayerName(GetPlayerFromServerId(player.id)).." Expired.") 74 | end 75 | end 76 | end 77 | end) 78 | 79 | RegisterNetEvent("DissapearHunted") 80 | AddEventHandler("DissapearHunted", function(player) 81 | for i,hunted in ipairs(HuntedPlayers) do 82 | if player.id == hunted.id then 83 | RemoveBlip(hunted.blip) 84 | table.remove(HuntedPlayers,i) 85 | TriggerEvent("showNotification", "A Hunted Player dissapeared.") 86 | end 87 | end 88 | end) 89 | 90 | Citizen.CreateThread(function() 91 | Wait(20000) 92 | if GetResourceKvpInt("hunted") == 1 then -- fuck ur combat loggin ass lol 93 | local cx,cy,cz = GetEntityCoords(PlayerPedId(), true) 94 | TriggerServerEvent("AddPlayerHunted", cx,cy,cz) 95 | IsPlayerHunted = true 96 | end 97 | end) 98 | 99 | 100 | local thisTick = 0 101 | Citizen.CreateThread(function() 102 | while true do 103 | Wait(10000) 104 | thisTick = thisTick+1 105 | if thisTick == 6 then 106 | if KilledPlayers[1] then 107 | table.remove(KilledPlayers,1) 108 | end 109 | end 110 | if IsPlayerHunted then 111 | local cx,cy,cz = table.unpack(GetEntityCoords(PlayerPedId(), true)) 112 | TriggerServerEvent("UpdateHuntedPos", cx,cy,cz) 113 | end 114 | end 115 | end) -------------------------------------------------------------------------------- /client/gameplay/itemtasks.lua: -------------------------------------------------------------------------------- 1 | Citizen.CreateThread(function() 2 | while true do 3 | Wait(1000) 4 | if LoadedPlayerData then 5 | if IsSeethroughActive() then 6 | if consumableItems[89].charge <= 0 then 7 | consumableItems[89].charge = 0 8 | TriggerEvent("showNotification", "There is no Battery Charge left.") 9 | SetSeethrough(false) 10 | elseif consumableItems[89].charge == 10 then 11 | TriggerEvent("showNotification", "My Infrared Goggles are running out of Charge.") 12 | end 13 | consumableItems[89].charge = math.round(consumableItems[89].charge-0.1,3) 14 | end 15 | if IsNightvisionActive() then 16 | if consumableItems[90].charge <= 0 then 17 | consumableItems[90].charge = 0 18 | TriggerEvent("showNotification", "There is no Battery Charge left.") 19 | SetSeethrough(false) 20 | elseif consumableItems[90].charge == 10 then 21 | TriggerEvent("showNotification", "My Night Vision Goggles are running out of Charge.") 22 | end 23 | consumableItems[90].charge = math.round(consumableItems[90].charge-0.1,3) 24 | end 25 | end 26 | end 27 | end) -------------------------------------------------------------------------------- /client/gameplay/newplayer.lua: -------------------------------------------------------------------------------- 1 | -- CONFIG -- 2 | 3 | local spawnWithFlashlight = true 4 | local displayRadar = true 5 | local bool = true 6 | local firstSpawn = true 7 | -- CODE -- 8 | AddRelationshipGroup("PLAYER") 9 | 10 | Citizen.CreateThread(function() 11 | Wait(1) 12 | if bool then 13 | TriggerServerEvent("Z:newplayer", PlayerId()) 14 | TriggerServerEvent("Z:newplayerID", GetPlayerServerId(PlayerId())) 15 | bool = false 16 | SetBlackout(true) 17 | end 18 | end) 19 | 20 | local welcomed = false 21 | LocalPlayer.state.hunger = 0 22 | LocalPlayer.state.thirst = 0 23 | 24 | Citizen.CreateThread(function() 25 | 26 | AddEventHandler("playerSpawned", function(spawn,pid) 27 | SetPedRelationshipGroupHash(PlayerPedId(), GetHashKey("PLAYER")) 28 | if firstSpawn then 29 | firstSpawn = false 30 | local players = {} 31 | for i,player in pairs(GetPlayers()) do 32 | table.insert(players,"Recieving..") 33 | end 34 | TriggerEvent("gtaoscoreboard:AddColumn", "Player Kills",players) 35 | TriggerEvent("gtaoscoreboard:AddColumn", "Zombie Kills",players) 36 | TriggerEvent("gtaoscoreboard:AddColumn", "Status",players) 37 | TriggerEvent("gtaoscoreboard:AddColumn", "Playtime",players) 38 | end 39 | end) 40 | AddEventHandler('baseevents:onPlayerKilled', function(killerId) 41 | local player = NetworkGetPlayerIndexFromPed(PlayerPedId()) 42 | local attacker = killerId 43 | 44 | if GetPlayerFromServerId(attacker) and attacker ~= GetPlayerServerId(PlayerId()) then 45 | 46 | -- this is concept code for the "dropping loot when dying", no idea if it works, needs testing, hence, it hasn't been implemented yet 47 | -- NEEDS MUTLI ITEM PICKUP SUPPORT 48 | --[[ 49 | for item,Consumable in ipairs(consumableItems) do 50 | if consumableItems.count[item] > 0.0 then 51 | local playerX, playerY, playerZ = table.unpack(GetEntityCoords(PlayerPedId(), not IsEntityDead(PlayerPedId()) )) 52 | ForceCreateFoodPickupAtCoord(playerX + 1, playerY, playerZ, item, consumableItems.count[item]) 53 | end 54 | end 55 | --]] 56 | end 57 | playerkillsthislife = 0 58 | zombiekillsthislife = 0 59 | if possessed then 60 | unPossessPlayer(PlayerPedId()) 61 | possessed = false 62 | end 63 | end) 64 | 65 | AddEventHandler('baseevents:onPlayerWasted', function() 66 | playerkillsthislife = 0 67 | zombiekillsthislife = 0 68 | if possessed then 69 | unPossessPlayer(PlayerPedId()) 70 | possessed = false 71 | end 72 | end) 73 | 74 | AddEventHandler('baseevents:onPlayerDied', function() 75 | playerkillsthislife = 0 76 | zombiekillsthislife = 0 77 | if possessed then 78 | unPossessPlayer(PlayerPedId()) 79 | possessed = false 80 | end 81 | end) 82 | end) 83 | 84 | Citizen.CreateThread(function() 85 | AddEventHandler("playerSpawned", function(spawn,pid) 86 | 87 | if spawnWithFlashlight then 88 | for i,Consumable in ipairs(consumableItems) do 89 | consumableItems.count[i] = 0.0 90 | end 91 | if not humanity then humanity = 500.0 end 92 | playerkillsthislife = 0 93 | zombiekillsthislife = 0 94 | infected = false 95 | for i, count in pairs(config.startItems) do 96 | consumableItems.count[i] = count 97 | end 98 | TriggerServerEvent("SetLegitimateMoney", config.startMoney) 99 | consumableItems.count[17] = config.startMoney 100 | StatSetInt("MP0_STAMINA", 40,1) 101 | consumableItems.count[92] = 1 -- cb radio 102 | -- set CB back to what we were on before dying 103 | VoiceType = true 104 | if cbType == "FM" then 105 | cbType = "AM" 106 | cbChannel = 9 107 | cbChannelIndex = 6 108 | end 109 | NetworkSetVoiceActive(false) 110 | NetworkSetVoiceChannel(cbChannel) 111 | NetworkSetTalkerProximity(GetHighestVoiceProximity()) 112 | NetworkSetVoiceActive(true) 113 | -- 114 | if LoadedPlayerData then 115 | TriggerServerEvent("SetLegitimateMoney", config.startMoney) 116 | end 117 | if possessed then 118 | 119 | unPossessPlayer(PlayerPedId()) 120 | possessed = false 121 | end 122 | 123 | if not customSkin or customSkin == "" then 124 | if humanity > 800 then -- hero skin 125 | currentPlayerModel = config.skins.hero 126 | elseif humanity < 800 and humanity > 200 then -- neutral skin 127 | currentPlayerModel = config.skins.neutral 128 | elseif humanity < 200 then -- bandit skin 129 | currentPlayerModel = config.skins.bandit 130 | end 131 | else 132 | currentPlayerModel = customSkin 133 | end 134 | 135 | if currentPlayerModel then 136 | if not HasModelLoaded(currentPlayerModel) then 137 | RequestModel(currentPlayerModel) 138 | end 139 | while not HasModelLoaded(currentPlayerModel) do 140 | Wait(1) 141 | end 142 | SetPlayerModel(PlayerId(), currentPlayerModel) 143 | end 144 | SetPlayerParachuteTintIndex(PlayerId(), 6) 145 | Wait(300) 146 | LocalPlayer.state.hunger = 100.0 147 | LocalPlayer.state.thirst = 100.0 148 | GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_FLASHLIGHT"), 1, false, false) 149 | GiveWeaponToPed(PlayerPedId(), GetHashKey("WEAPON_BAT"), 1, false, false) 150 | GiveWeaponToPed(PlayerPedId(), 0xFBAB5776, true) 151 | DisplayRadar(displayRadar) 152 | SetPedDropsWeaponsWhenDead(PlayerPedId(),true) 153 | NetworkSetFriendlyFireOption(true) 154 | SetCanAttackFriendly(PlayerPedId(), true, true) 155 | TriggerEvent('showNotification', "Press 'M' to open your Interaction Menu!") 156 | Wait(5000) 157 | if pid == PlayerId() then 158 | initiateSave(true) 159 | end 160 | end 161 | end) 162 | end) 163 | 164 | Citizen.CreateThread(function() 165 | while true do 166 | Citizen.Wait(200) 167 | if GetEntityHeightAboveGround(PlayerPedId()) < 80 and IsPedInParachuteFreeFall(PlayerPedId()) then 168 | ForcePedToOpenParachute(PlayerPedId()) 169 | end 170 | end 171 | end) 172 | -------------------------------------------------------------------------------- /client/gameplay/nopeds.lua: -------------------------------------------------------------------------------- 1 | -- Thanks to @nobody 2 | 3 | Citizen.CreateThread(function() 4 | -- Other stuff normally here, stripped for the sake of only scenario stuff 5 | -- These natives do not have to be called everyframe. 6 | SetGarbageTrucks(0) 7 | SetRandomBoats(0) 8 | 9 | for i=1,15 do 10 | EnableDispatchService(i,false) 11 | end 12 | local SCENARIO_TYPES = { 13 | "DRIVE", 14 | "WORLD_VEHICLE_EMPTY", 15 | "WORLD_VEHICLE_DRIVE_SOLO", 16 | "WORLD_VEHICLE_BOAT_IDLE_ALAMO", 17 | "WORLD_VEHICLE_PARK_PERPENDICULAR_NOSE_IN", 18 | "WORLD_VEHICLE_MILITARY_PLANES_SMALL", 19 | "WORLD_VEHICLE_MILITARY_PLANES_BIG", 20 | } 21 | local SCENARIO_GROUPS = { 22 | 2017590552, -- LSIA planes 23 | 2141866469, -- Sandy Shores planes 24 | "BLIMP", 25 | "ALAMO_PLANES", 26 | "ARMY_HELI", 27 | "GRAPESEED_PLANES", 28 | "SANDY_PLANES", 29 | "ng_planes", 30 | } 31 | local SUPPRESSED_MODELS = { 32 | "SHAMAL", 33 | "LUXOR", 34 | "LUXOR2", 35 | "LAZER", 36 | "TITAN", 37 | "CRUSADER", 38 | "RHINO", 39 | "AIRTUG", 40 | "RIPLEY", 41 | "SUNTRAP", 42 | "BLIMP", 43 | } 44 | 45 | while true do 46 | for _, sctyp in next, SCENARIO_TYPES do 47 | SetScenarioTypeEnabled(sctyp, false) 48 | end 49 | for _, scgrp in next, SCENARIO_GROUPS do 50 | SetScenarioGroupEnabled(scgrp, false) 51 | end 52 | for _, model in next, SUPPRESSED_MODELS do 53 | SetVehicleModelIsSuppressed(GetHashKey(model), true) 54 | end 55 | RemoveVehiclesFromGeneratorsInArea(x - 500.0, y - 500.0, z - 500.0, x + 500.0, y + 500.0, z + 500.0); 56 | Wait(30000) 57 | end 58 | end) 59 | 60 | AddScenarioBlockingArea(-10000.0, -10000.0, -1000.0, 10000.0, 10000.0, 1000.0, false, true, true, true) 61 | Citizen.CreateThread(function() 62 | StartAudioScene("CHARACTER_CHANGE_IN_SKY_SCENE") -- this should disable city sounds 63 | while true do 64 | -- These natives has to be called every frame. 65 | SetVehicleDensityMultiplierThisFrame(0.0) 66 | SetPedDensityMultiplierThisFrame(0.0) 67 | SetRandomVehicleDensityMultiplierThisFrame(0.0) 68 | SetParkedVehicleDensityMultiplierThisFrame(0.0) 69 | SetScenarioPedDensityMultiplierThisFrame(0.0, 0.0) 70 | 71 | local x,y,z = table.unpack(GetEntityCoords(PlayerPedId())) 72 | 73 | Citizen.Wait(1) 74 | end 75 | end) 76 | 77 | Citizen.CreateThread(function() 78 | while true do 79 | local handle, veh = FindFirstVehicle() 80 | local finished = false -- FindNextPed will turn the first variable to false when it fails to find another ped in the index 81 | repeat 82 | if GetVehicleEngineHealth(veh) <= 100 then 83 | SetEntityAsMissionEntity(veh,true,true) 84 | SetEntityAsNoLongerNeeded(veh) 85 | writeLog("\nDeleted Destroyed Vehicle", 1) 86 | end 87 | Wait(1) 88 | finished, veh = FindNextVehicle(handle) -- first param returns true while entities are found 89 | until not finished 90 | EndFindVehicle(handle) 91 | Citizen.Wait(160000) 92 | end 93 | end) 94 | 95 | Citizen.CreateThread(function() 96 | while true do 97 | local handle, ped = FindFirstPed() 98 | local finished = false -- FindNextPed will turn the first variable to false when it fails to find another ped in the index 99 | repeat 100 | Wait(1) 101 | if IsPedDeadOrDying(ped) and not IsPedAPlayer(ped) then 102 | SetEntityAsMissionEntity(ped,true,true) 103 | SetEntityAsNoLongerNeeded(ped) 104 | DeleteEntity(ped) 105 | writeLog("\nDeleted Dead Ped", 1) 106 | end 107 | finished, ped = FindNextPed(handle) -- first param returns true while entities are found 108 | Wait(1) 109 | until not finished 110 | EndFindPed(handle) 111 | Citizen.Wait(60000) 112 | end 113 | end) 114 | -------------------------------------------------------------------------------- /client/gameplay/noreticle.lua: -------------------------------------------------------------------------------- 1 | local whitelistedGuns = { 2 | 100416529, 3 | 205991906, 4 | -952879014, 5 | 1785463520, 6 | 177293209, 7 | } 8 | 9 | local DoesWeaponExist, Weapon, WeaponDamageType = false,0,0 10 | local ped = 0 11 | local currentWeaponHash = 0 12 | Citizen.CreateThread(function() -- slow thread 13 | ped = PlayerPedId() 14 | while true do 15 | Wait(1000) 16 | ped = PlayerPedId() 17 | DoesWeaponExist,Weapon = GetCurrentPedWeapon(ped, true) 18 | WeaponDamageType = GetWeaponDamageType(Weapon) 19 | currentWeaponHash = GetSelectedPedWeapon(ped) 20 | end 21 | end) 22 | 23 | Citizen.CreateThread(function() 24 | local isSniper = false 25 | while config.disableReticle do 26 | Citizen.Wait(0) 27 | if isWeapon and WeaponDamageType ~= 1 then 28 | SetPlayerLockon(ped, false) 29 | SetPlayerLockonRangeOverride(ped, 0.0) 30 | elseif WeaponDamageType == 1 then 31 | SetPlayerLockon(ped, true) 32 | SetPlayerLockonRangeOverride(ped, GetLockonRangeOfCurrentPedWeapon(ped)) 33 | end 34 | local isSniper = false 35 | 36 | for i,hash in ipairs(whitelistedGuns) do 37 | if hash == currentWeaponHash then 38 | isSniper = true 39 | end 40 | end 41 | 42 | if not isSniper then 43 | HideHudComponentThisFrame(14) 44 | end 45 | end 46 | end) -------------------------------------------------------------------------------- /client/gameplay/savezones_c.lua: -------------------------------------------------------------------------------- 1 | local safezones = { 2 | -- sandy shores methlab 3 | {label = "safe1", x = 1396.21 , y = 3613.28, z = 34.98, r = 50.0}, 4 | -- downtown 5 | {label = "safe2", x = 199.2 , y = -934.37, z = 30.0, r = 175.0, xr = 100.0}, 6 | -- Mount Chilliad 7 | {label = "safe3", x = 1487.7 , y = 6348.1, z = 23.0, r = 95.0, xr = 40.0}, 8 | } 9 | 10 | local gracePeriod = 0 11 | isPlayerInSafezone = false 12 | 13 | Citizen.CreateThread(function() 14 | while true do 15 | Citizen.Wait(1000) 16 | if gracePeriod > 0 then 17 | gracePeriod = gracePeriod - 1 18 | end 19 | end 20 | end) 21 | 22 | 23 | Citizen.CreateThread(function() 24 | while true do 25 | Citizen.Wait(20) 26 | for k,v in pairs(safezones) do 27 | local pCoords = GetEntityCoords(PlayerPedId(), true) 28 | local pdist = #(pCoords - vector3(v.x,v.y,v.z)) 29 | if pdist < 180 then 30 | if not v.xr then v.xr = v.r end 31 | local handle, ped = FindFirstPed() 32 | local finished = false -- FindNextPed will turn the first variable to false when it fails to find another ped in the index 33 | repeat 34 | local pCoords = GetEntityCoords(PlayerPedId(), true) 35 | v.zd = #(vector3(0.0,0.0,pCoords.z) - vector3(0.0,0.0,v.z)) 36 | if not IsPedAPlayer(ped) and #(pCoords - vector3(v.x,v.y,v.z)) < v.r-math.pi and v.zd < v.xr then 37 | SetEntityAsMissionEntity(ped,true,true) 38 | SetEntityHealth(ped,0.0) 39 | SetEntityAsNoLongerNeeded(ped) 40 | end 41 | Wait(1) 42 | finished, ped = FindNextPed(handle) -- first param returns true while entities are found 43 | until not finished 44 | EndFindPed(handle) 45 | end 46 | end 47 | end 48 | end) 49 | 50 | function denyveh(veh,toggle) 51 | if toggle then 52 | SetEntityMaxSpeed(veh, 2.0) 53 | else 54 | SetEntityMaxSpeed(veh, 99999.0) 55 | end 56 | end 57 | 58 | 59 | Citizen.CreateThread(function() 60 | 61 | while true do 62 | Citizen.Wait(0) 63 | local playerped = PlayerPedId() 64 | local PedInSeat = GetPedInVehicleSeat(GetVehiclePedIsUsing(playerped), -1) 65 | local IsPedInVeh = IsPedInAnyVehicle(playerped, true) 66 | local VehPedIsUsing = GetVehiclePedIsUsing(playerped) 67 | local pCoords = GetEntityCoords(playerped, true) 68 | for k,v in pairs(safezones) do 69 | v.distance = #(pCoords - vector3(v.x,v.y,v.z)) 70 | 71 | if not v.xr then v.xr = v.r end 72 | 73 | v.heightDistance = #(vector3(0.0,0.0,pCoords.z) - vector3(0.0,0.0,v.z)) 74 | 75 | if v.distance < v.r-math.pi and v.heightDistance < v.xr then 76 | DrawMissonText("You are in a ~g~Safezone!",0.25,0.96) 77 | DisablePlayerFiring(playerped, true) 78 | NetworkSetFriendlyFireOption(false) 79 | 80 | 81 | SetEntityProofs(playerped, true, true, true, true, true, true, 1, true) 82 | gracePeriod = 10 83 | isPlayerInSafezone = true 84 | if IsPedInVeh and not (IsPedInAnyHeli(playerped) or IsPedInAnyPlane(playerped)) and PedInSeat == playerped then 85 | denyveh(VehPedIsUsing,true) 86 | end 87 | break 88 | elseif v.distance > v.r-math.pi and (v.distance < v.r or v.heightDistance > v.xr) then 89 | NetworkSetFriendlyFireOption(true) 90 | 91 | isPlayerInSafezone = false 92 | if IsPedInVeh and PedInSeat == playerped then 93 | denyveh(VehPedIsUsing,false) 94 | end 95 | SetEntityProofs(playerped, false, false, false, false, false, false, 0, false) 96 | elseif IsEntityDead(playerped) then 97 | NetworkSetFriendlyFireOption(true) 98 | 99 | gracePeriod = 0 100 | isPlayerInSafezone = false 101 | SetEntityProofs(playerped, false, false, false, false, false, false, 0, false) 102 | elseif gracePeriod > 0 and not isPlayerInSafezone then 103 | DrawMissonText("Exited Safezone, grace period lasts for ~r~"..gracePeriod.."~s~ seconds!",100,true) 104 | NetworkSetFriendlyFireOption(false) 105 | 106 | SetEntityProofs(playerped, true, true, true, true, true, true, 1, true) 107 | elseif gracePeriod == 0 and not isPlayerInSafezone then 108 | NetworkSetFriendlyFireOption(true) 109 | 110 | SetEntityProofs(playerped, false, false, false, false, false, false, 0, false) 111 | end 112 | end 113 | end 114 | end) 115 | 116 | 117 | 118 | function DrawMissonText(text, duration, drawImmediately) 119 | BeginTextCommandPrint("STRING") 120 | AddTextComponentString(text) 121 | EndTextCommandPrint(duration, drawImmediately) 122 | end 123 | 124 | Citizen.CreateThread(function() 125 | for k,v in pairs(safezones) do 126 | local blip = AddBlipForRadius(v.x, v.y, v.z, v.r) --Creates the circle on the map 127 | local blip2 = AddBlipForCoord(v.x, v.y, v.z) -- Creates the name of the blip on the list in the pause menu 128 | SetBlipSprite(blip, 9) 129 | SetBlipAlpha(blip, 100) 130 | SetBlipColour(blip, 2) 131 | SetBlipSprite(blip2, 305) 132 | SetBlipColour(blip2, 3) 133 | SetBlipAlpha(blip2, 255) 134 | BeginTextCommandSetBlipName("STRING") 135 | AddTextComponentString("Safezone") 136 | EndTextCommandSetBlipName(blip2) 137 | end 138 | end) 139 | -------------------------------------------------------------------------------- /client/gameplay/temperature.lua: -------------------------------------------------------------------------------- 1 | local baseTemp = 37.0 -- base body heat 2 | local isLosingBlood = false 3 | local curWeatherTemp = 37.0 4 | local curWeather, curWeatherTemp = 0, 0 5 | 6 | local weatherTemps = { 7 | {weather = "CLEAR", temp = 37.0}, -- weather name and avg body temp 8 | {weather = "EXTRASUNNY", temp = 37.3}, 9 | {weather = "CLOUDS", temp = 37.0}, 10 | {weather = "OVERCAST", temp = 37.0}, 11 | {weather = "RAIN", temp = 36.6}, 12 | {weather = "CLEARING", temp = 37.0}, 13 | {weather = "THUNDER", temp = 36.6}, 14 | {weather = "SMOG", temp = 37.0}, 15 | {weather = "FOGGY", temp = 36.5}, 16 | {weather = "XMAS", temp = 34.0}, 17 | {weather = "XMAS", temp = 34.0}, 18 | {weather = "SNOWLIGHT", temp = 34.0}, 19 | {weather = "BLIZZARD", temp = 34.0}, 20 | } 21 | 22 | Citizen.CreateThread(function() 23 | while true do 24 | local playerPed = PlayerPedId() 25 | if IsPedSprinting(playerPed) then 26 | baseTemp = baseTemp+0.02 27 | elseif IsPedInVehicle(playerPed) then 28 | curWeatherTemp = 37.0 29 | end 30 | if baseTemp > curWeatherTemp then 31 | baseTemp = baseTemp-0.01 32 | elseif baseTemp < curWeatherTemp then 33 | baseTemp = baseTemp+0.01 34 | end 35 | Wait(10000) 36 | end 37 | end) 38 | 39 | Citizen.CreateThread(function() 40 | while true do 41 | curWeather = GetPrevWeatherTypeHashName() 42 | for i,e in pairs(weatherTemps) do 43 | if GetHashKey(e.weather) == curWeather then 44 | curWeatherTemp = e.temp 45 | end 46 | end 47 | Wait(20000) 48 | end 49 | end) -------------------------------------------------------------------------------- /client/gameplay/weather_c.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | _____ _ __ __ _ _ 3 | | __ \(_) \ \ / / | | | | 4 | | | | |_ _ __ __\ \ /\ / /__ __ _| |_| |__ ___ _ __ 5 | | | | | | '_ \ / _ \ \/ \/ / _ \/ _` | __| '_ \ / _ \ '__| 6 | | |__| | | | | | (_) \ /\ / __/ (_| | |_| | | | __/ | 7 | |_____/|_|_| |_|\___/ \/ \/ \___|\__,_|\__|_| |_|\___|_| 8 | 9 | FiveM-DinoWeather 10 | A Weather System that enhances realism by using GTA Natives relating to Zones. 11 | Copyright (C) 2019 Jarrett Boice 12 | 13 | This program is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU Affero General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | This program is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU Affero General Public License for more details. 22 | 23 | You should have received a copy of the GNU Affero General Public License 24 | along with this program. If not, see . 25 | 26 | ]] 27 | 28 | local activeWeather = {} 29 | local lastZone = 0 30 | 31 | RegisterNetEvent("dinoweather:syncWeather") 32 | AddEventHandler("dinoweather:syncWeather", function(activeWeathers) 33 | activeWeather = activeWeathers 34 | end) 35 | 36 | AddEventHandler("playerSpawned", function(spawnInfo) 37 | TriggerServerEvent("dinoweather:syncWeather") 38 | end) 39 | 40 | Citizen.CreateThread(function() 41 | while config.enableDynoWeather do 42 | Citizen.Wait(1000 * 60) 43 | TriggerServerEvent("dinoweather:syncWeather") 44 | end 45 | end) 46 | 47 | Citizen.CreateThread(function() 48 | while true do 49 | Citizen.Wait(1000) 50 | local x, y, z = table.unpack(GetEntityCoords(PlayerPedId(), false)) 51 | local zone = GetNameOfZone(x, y, z) 52 | for i, weatherZone in ipairs(activeWeather) do 53 | if weatherZone[1] == zone and lastZone ~= zone then 54 | Citizen.Wait(15000) 55 | ClearOverrideWeather() 56 | ClearWeatherTypePersist() 57 | SetWeatherTypeOverTime(weatherZone[2], 15.0) 58 | SetWeatherTypePersist(weatherZone[2]) 59 | SetWeatherTypeNow(weatherZone[2]) 60 | SetWeatherTypeNowPersist(weatherZone[2]) 61 | lastZone = zone 62 | end 63 | end 64 | end 65 | end) -------------------------------------------------------------------------------- /client/gui/notifications.lua: -------------------------------------------------------------------------------- 1 | RegisterNetEvent("showNotification") 2 | 3 | Citizen.CreateThread(function() 4 | AddEventHandler("showNotification", function(text) 5 | SetNotificationTextEntry("STRING") 6 | AddTextComponentString(text) 7 | DrawNotification(0,1) 8 | end) 9 | end) 10 | 11 | Citizen.CreateThread(function() 12 | local alreadyDead = false 13 | while true do 14 | Citizen.Wait(200) 15 | local playerPed = PlayerPedId() 16 | 17 | if IsEntityDead(playerPed) and not alreadyDead then 18 | local killer = GetPedSourceOfDeath(playerPed) 19 | local killername = "unknown" 20 | local killerId = false 21 | local killerType = GetEntityType(killer) 22 | local weapon = GetPedCauseOfDeath(playerPed,1) 23 | local killerweapon = reverseWeaponHash( tostring(weapon) ) 24 | if IsEntityAPed(killer) and IsPedAPlayer(killer) then 25 | killerId = NetworkGetPlayerIndexFromPed(killer) 26 | killername = GetPlayerName(NetworkGetPlayerIndexFromPed(killer)) 27 | end 28 | if IsEntityAVehicle(killer) then 29 | local p = GetPedInVehicleSeat(killer, -1) 30 | if IsPedAPlayer(p) then 31 | killerId = NetworkGetPlayerIndexFromPed(p) 32 | killername = GetPlayerName(NetworkGetPlayerIndexFromPed(p)) 33 | killerweapon = "a Vehicle" 34 | weapon = 69 -- doesnt really matter, this needs to be a value though 35 | end 36 | end 37 | 38 | local deathitems = {} 39 | for i,theItem in ipairs(consumableItems) do 40 | if consumableItems.count[i] > 0 then 41 | table.insert(deathitems, {id = i, count = consumableItems.count[i]}) 42 | end 43 | end 44 | local deadx,deady,deadz = table.unpack(GetEntityCoords(PlayerPedId())) 45 | 46 | 47 | if not killerId or killerId == PlayerId() then 48 | local handle, ped = FindFirstPed() 49 | local finished = false -- FindNextPed will turn the first variable to false when it fails to find another ped in the index 50 | repeat 51 | Wait(1) 52 | if IsPedAPlayer(ped) and ped ~= PlayerPedId() then 53 | killerId = NetworkGetPlayerIndexFromPed(ped) 54 | killername = GetPlayerName(NetworkGetPlayerIndexFromPed(ped)) 55 | finished = false 56 | weapon = 0 -- set killer weapon to 0 because this was a suicide 57 | end 58 | finished, ped = FindNextPed(handle) -- first param returns true while entities are found 59 | until not finished 60 | EndFindPed(handle) 61 | end 62 | 63 | local itemInfo = { 64 | x = deadx, 65 | y = deady, 66 | z = deadz, 67 | model = consumableItems[1].model, 68 | pickupItemData = deathitems, 69 | owner = GetPlayerServerId(killerId or PlayerId()), -- ideally, this should never be PlayerId(), but added it just in case. 70 | ownerName = GetPlayerName(killerId or PlayerId()), 71 | deaddrop = true, 72 | spawned = false 73 | } 74 | TriggerServerEvent("RegisterPickup", itemInfo) 75 | for i,Consumable in ipairs(consumableItems) do 76 | consumableItems.count[i] = 0 77 | end 78 | initiateSave(true) 79 | if killer == playerPed or not killerId then 80 | TriggerServerEvent('playerDied',0,0) 81 | writeLog("\nPlayer Died for no reason!", 1) 82 | elseif killername and killername ~= "unknown" and weapon ~= 0 then 83 | TriggerServerEvent('playerDied',killername,1,killerweapon) 84 | writeLog("\nPlayer Died from "..killername.."!", 1) 85 | TriggerServerEvent("registerKill",GetPlayerServerId(killerId), humanity,weapon) 86 | if IsPlayerHunted then 87 | TriggerServerEvent("RemovePlayerHunted") 88 | end 89 | else 90 | TriggerServerEvent('playerDied',0,2) 91 | writeLog("\nPlayer Died for unknown reason!", 1) 92 | end 93 | alreadyDead = true 94 | end 95 | if not IsEntityDead(playerPed) then 96 | alreadyDead = false 97 | end 98 | end 99 | end) -------------------------------------------------------------------------------- /client/gui/radio.lua: -------------------------------------------------------------------------------- 1 | cbChannel = 9 -- 4-19 on AM, 20-40 on FM 2 | cbChannelIndex = 6 -- just a fix for UI 3 | cbType = "AM" -- AM and FM 4 | showRadio = true 5 | VoiceType = true -- true = CB, false = Local 6 | 7 | function GetHighestVoiceProximity() 8 | if VoiceType then 9 | if consumableItems.count[94] >= 1 then 10 | return 3500.0 11 | elseif consumableItems.count[93] >= 1 then 12 | return 2000.0 13 | elseif consumableItems.count[92] >= 1 then 14 | return 850.0 15 | else 16 | return 100.0 17 | end 18 | else 19 | return 30.0 20 | end 21 | end 22 | 23 | function DoesPlayerHaveCBRadio() 24 | if consumableItems.count[94] == 0 and consumableItems.count[93] == 0 and consumableItems.count[92] == 0 then 25 | return false 26 | else 27 | return true 28 | end 29 | end 30 | 31 | function GetPlayerBestCBRadio() 32 | if consumableItems.count[94] >= 1 then 33 | return 94 34 | elseif consumableItems.count[93] >= 1 then 35 | return 93 36 | elseif consumableItems.count[92] >= 1 then 37 | return 92 38 | else 39 | return false 40 | end 41 | end 42 | 43 | 44 | function GetPlayerCurrentRadioData() 45 | return {cbChannel = cbChannel, cbType = cbType, VoiceType = VoiceType} 46 | end 47 | 48 | 49 | 50 | Citizen.CreateThread(function() 51 | Wait(1000) 52 | while true do 53 | Wait(1) 54 | if LoadedPlayerData then 55 | radiotex = "basicradio" 56 | local hasCB = DoesPlayerHaveCBRadio() 57 | local highestProx = GetHighestVoiceProximity() 58 | local bestCB = GetPlayerBestCBRadio() 59 | if not hasCB then 60 | VoiceType = false --player has no cb 61 | NetworkSetVoiceActive(false) 62 | NetworkClearVoiceChannel() 63 | NetworkSetTalkerProximity(75.01) 64 | NetworkSetVoiceActive(true) 65 | end 66 | 67 | if IsControlJustPressed(0, 183) and hasCB then 68 | VoiceType = not VoiceType 69 | if not VoiceType then 70 | NetworkSetVoiceActive(false) 71 | NetworkClearVoiceChannel() 72 | NetworkSetTalkerProximity(75.01) 73 | NetworkSetVoiceActive(true) 74 | writeLog("\nChannel: No, Proximity = 75.01", 1) 75 | else 76 | NetworkSetVoiceActive(false) 77 | NetworkSetVoiceChannel(cbChannel) 78 | NetworkSetTalkerProximity(highestProx) 79 | NetworkSetVoiceActive(true) 80 | writeLog("\nChannel: "..cbChannel..", Proximity = "..highestProx.."", 1) 81 | end 82 | end 83 | if IsControlJustPressed(0, 304) and hasCB then 84 | WarMenu.OpenMenu('useCBAmateur') 85 | if VoiceType then 86 | cii_, sii_ = 1, 1 87 | else 88 | cii_, sii_ = 2, 2 89 | end 90 | end 91 | if WarMenu.IsMenuOpened('useCBAmateur') then 92 | if WarMenu.ComboBox("Type", {"Radio","Local"}, cii_, sii_, function(ci_, si_) 93 | if ci_ ~= cii_ then 94 | if ci_ == 1 then 95 | VoiceType = true 96 | showRadio = true 97 | NetworkSetVoiceActive(false) 98 | NetworkSetVoiceChannel(cbChannel) 99 | NetworkSetTalkerProximity(highestProx) 100 | NetworkSetVoiceActive(true) 101 | else 102 | VoiceType = false 103 | showRadio = false 104 | NetworkSetVoiceActive(false) 105 | NetworkClearVoiceChannel() 106 | NetworkSetTalkerProximity(75.01) 107 | NetworkSetVoiceActive(true) 108 | end 109 | end 110 | cii_ = ci_ 111 | sii_ = si_ 112 | end) then end 113 | 114 | if VoiceType then 115 | showRadio = true 116 | local channels = {} 117 | local modulations = {} 118 | if bestCB == 92 then 119 | table.insert(modulations, "AM") 120 | if cbType == "AM" then 121 | for i = 4, 19 do 122 | table.insert(channels,i) 123 | end 124 | end 125 | elseif bestCB == 94 then 126 | table.insert(modulations, "AM") 127 | table.insert(modulations, "FM") 128 | if cbType == "AM" then 129 | for i = 4, 19 do 130 | table.insert(channels,i) 131 | end 132 | elseif cbType == "FM" then 133 | for i = 20, 60 do 134 | table.insert(channels,i) 135 | end 136 | end 137 | else 138 | table.insert(modulations, "AM") 139 | table.insert(modulations, "FM") 140 | if cbType == "AM" then 141 | for i = 4, 19 do 142 | table.insert(channels,i) 143 | end 144 | elseif cbType == "FM" then 145 | for i = 20, 40 do 146 | table.insert(channels,i) 147 | end 148 | end 149 | end 150 | if WarMenu.ComboBox("Channel", channels, currentChannelItemIndex, selectedChannelItemIndex, function(currentChannelIndex, selectedChannelIndex) 151 | if not currentChannelIndex then currentChannelIndex, selectedChannelIndex = cbChannelIndex, cbChannelIndex end 152 | if currentChannelIndex ~= currentChannelItemIndex then 153 | cbChannel = channels[currentChannelIndex] 154 | cbChannelIndex = currentChannelIndex 155 | NetworkSetVoiceChannel(cbChannel) 156 | NetworkSetTalkerProximity(highestProx) 157 | end 158 | currentChannelItemIndex = currentChannelIndex 159 | selectedChannelItemIndex = selectedChannelIndex 160 | 161 | end) then end 162 | 163 | if WarMenu.ComboBox("Modulation", modulations, cii, sii, function(ci, si) 164 | if not ci then ci, si = 1, 1 end 165 | if ci ~= cii then 166 | if ci == 1 then 167 | cbType = "AM" 168 | elseif ci == 2 then 169 | cbType = "FM" 170 | end 171 | if ci == 1 and cbChannel > 19 then 172 | cbChannel = 9 173 | NetworkSetVoiceChannel(cbChannel) 174 | NetworkSetTalkerProximity(highestProx) 175 | elseif ci == 2 and cbChannel < 20 then 176 | cbChannel = 20 177 | cbChannelIndex = 16 178 | NetworkSetVoiceChannel(cbChannel) 179 | NetworkSetTalkerProximity(highestProx) 180 | end 181 | end 182 | cii = ci 183 | sii = si 184 | end) then end 185 | end 186 | 187 | WarMenu.Display() 188 | else 189 | showRadio = false 190 | end 191 | 192 | 193 | SetTextFont(0) 194 | SetTextProportional(1) 195 | SetTextScale(0.0, 0.35) 196 | SetTextColour(200, 200, 200, 255) 197 | --SetTextDropshadow(0, 0, 0, 0, 255) 198 | --SetTextDropShadow() 199 | --SetTextOutline() 200 | SetTextEntry("STRING") 201 | if VoiceType then 202 | AddTextComponentString("Chat: Radio "..cbType..""..cbChannel) 203 | else 204 | AddTextComponentString("Chat: Local") 205 | end 206 | DrawText(0.90, 0.95) 207 | 208 | 209 | --[[ 210 | if NetworkIsPlayerTalking(PlayerId()) then 211 | DrawSprite("rottenv", "speakerloud", 0.95-safeZoneOffset, 0.88+safeZoneOffset,0.05,0.1, 0.0, 255,255,255, 255) 212 | end 213 | ]] 214 | 215 | 216 | if NetworkIsPlayerTalking(PlayerId()) and hasCB then 217 | showRadio = true 218 | end 219 | 220 | if showRadio and bestCB then 221 | if bestCB == 92 then 222 | DrawSprite("rottenv", "basicradio", 0.70-safeZoneOffset, 0.85+safeZoneOffset,0.28,0.33, 0.0, 255,255,255, 255) 223 | 224 | SetTextFont(2) 225 | SetTextProportional(1) 226 | SetTextScale(0.0, 0.6) 227 | SetTextColour(10, 10, 10, 255) 228 | --SetTextDropshadow(0, 0, 0, 0, 255) 229 | --SetTextDropShadow() 230 | --SetTextOutline() 231 | SetTextEntry("STRING") 232 | AddTextComponentString(cbType..""..cbChannel) 233 | DrawText(0.755, 0.872) 234 | --elseif GetPlayerBestCBRadio() == 93 then 235 | elseif bestCB == 93 then 236 | DrawSprite("rottenv", "medradio", 0.70-safeZoneOffset, 0.85+safeZoneOffset,0.28,0.33, 0.0, 255,255,255, 255) 237 | 238 | SetTextFont(2) 239 | SetTextProportional(1) 240 | SetTextScale(0.0, 0.6) 241 | SetTextColour(10, 10, 10, 255) 242 | --SetTextDropshadow(0, 0, 0, 0, 255) 243 | --SetTextDropShadow() 244 | --SetTextOutline() 245 | SetTextEntry("STRING") 246 | AddTextComponentString(cbType..""..cbChannel) 247 | DrawText(0.76, 0.885) 248 | elseif bestCB == 94 then 249 | DrawSprite("rottenv", "highradio", 0.70-safeZoneOffset, 0.85+safeZoneOffset,0.26,0.33, 0.0, 255,255,255, 255) 250 | 251 | SetTextFont(2) 252 | SetTextProportional(1) 253 | SetTextScale(0.0, 0.6) 254 | SetTextColour(10, 10, 10, 255) 255 | --SetTextDropshadow(0, 0, 0, 0, 255) 256 | --SetTextDropShadow() 257 | --SetTextOutline() 258 | SetTextEntry("STRING") 259 | AddTextComponentString(cbType..""..cbChannel) 260 | DrawText(0.76, 0.8315) 261 | end 262 | end 263 | end 264 | end 265 | end) -------------------------------------------------------------------------------- /client/hub/gamble_c.lua: -------------------------------------------------------------------------------- 1 | 2 | Wheel = { 3 | Active = false, 4 | Config = {WheelType=1, SegmentCount=5, SpectatorWheel=false}, 5 | SegmentInfo = {} 6 | } 7 | 8 | Citizen.CreateThread(function() 9 | function startRewardTimeout(result,segments,wintext) 10 | local result = result 11 | local segments = segments 12 | SetTimeout(12000, function() 13 | TriggerEvent("showNotification", wintext) 14 | if segments[result].type == "money" then 15 | consumableItems.count[17]=consumableItems.count[17]+segments[result].value 16 | TriggerServerEvent("AddLegitimateMoney", segments[result].value) 17 | elseif segments[result].type == "item" then 18 | consumableItems.count[segments[result].item]=consumableItems.count[segments[result].item]+1 19 | elseif segments[result].type == "health" then 20 | SetEntityHealth(PlayerPedId(), 200) 21 | elseif segments[result].type == "armor" then 22 | SetPedArmour(PlayerPedId(), 100) 23 | elseif segments[result].type == "weapon" then 24 | GiveWeaponToPed(PlayerPedId(), segments[result].hash, GetWeaponClipSize(segments[result].hash), false, true) 25 | elseif segments[result].type == "spin" then 26 | wheelspins = wheelspins+segments[result].value 27 | end 28 | end) 29 | SetTimeout(15000, function() 30 | Wheel.Hide() 31 | if segments[result].type ~= "spin" and oldwheelspins <= wheelspins then 32 | TriggerServerEvent("Z:kickme", "Segment Data Incorrect, Please Report this at discord.gg/2SdrPFF ( DEBUG DATA: "..segments[result].type.." "..oldwheelspins.." "..wheelspins.." "..segments[result].value) 33 | TriggerServerEvent("SentryIO_Error", "Wheelspin Segment Data Incorrect", "Segment Data Incorrect, DEBUG DATA: Type:"..segments[result].type.." Old:"..oldwheelspins.." New:"..wheelspins.." Reward:"..segments[result].value) 34 | end 35 | end) 36 | end 37 | end) 38 | 39 | 40 | Citizen.CreateThread(function() 41 | 42 | RegisterNetEvent("RequestWheelspinResult") 43 | AddEventHandler("RequestWheelspinResult", function(result, winicon, wintext, type, segments) 44 | Wheel.SetStyle(type,#segments,false) 45 | for i,segment in ipairs(segments) do 46 | Wheel.SetSegment(i-1, segment.id, segment.value) 47 | end 48 | local segments = segments 49 | TriggerEvent("showNotification", "Wheelspin Request Granted!") 50 | Wheel.Running = true 51 | Wheel.Show() 52 | Wheel.Spin(result, 5, 10, 10, winicon+1, wintext) 53 | local result = result+1 54 | startRewardTimeout(result,segments,wintext) 55 | while Wheel.Active do 56 | Citizen.Wait(0) 57 | Wheel.Scaleform:Draw2D() 58 | end 59 | end) 60 | end) 61 | 62 | --[[ 63 | RegisterCommand("spin", function() 64 | if Wheel.Running == true then 65 | TriggerEvent("showNotification", "Wheelspin Already in Progress!") 66 | return false 67 | end 68 | oldwheelspins = wheelspins 69 | wheelspins = wheelspins-1 70 | Wheel.Init() 71 | TriggerEvent("showNotification", "Requesting Wheelspin...") 72 | TriggerServerEvent("RequestWheelspinResult") 73 | 74 | end, false) 75 | ]] 76 | 77 | Citizen.CreateThread(function() 78 | WarMenu.CreateMenu('gamble', 'Wheel of Fortune') 79 | WarMenu.SetSubTitle('gamble', 'Wheel of Fortune') 80 | while true do 81 | if WarMenu.IsMenuOpened('gamble') then 82 | WarMenu.SetSubTitle('locker', 'Current Balance: $'..locker_money) 83 | 84 | if WarMenu.Button('Spin the Wheel!', wheelspins..' Spins Left!') then 85 | if wheelspins < 1 then 86 | TriggerEvent("showNotification", "No Wheelspins available!") 87 | elseif Wheel.Running then 88 | TriggerEvent("showNotification", "Wheelspin already in Progress!") 89 | else 90 | oldwheelspins = wheelspins 91 | wheelspins = wheelspins-1 92 | 93 | Wheel.Init() 94 | TriggerEvent("showNotification", "Requesting Wheelspin...") 95 | TriggerServerEvent("RequestWheelspinResult") 96 | end 97 | 98 | --[[ elseif WarMenu.Button('Buy Spin', "$loadsamone") then 99 | TriggerEvent("showNotification", "Not Yet.")]] 100 | end 101 | WarMenu.Display() 102 | end 103 | Citizen.Wait(0) 104 | end 105 | end) 106 | 107 | function Wheel.Init() 108 | Wheel.Scaleform = Scaleform.Request("SPIN_THE_WHEEL") --if u dont get this u dumb 109 | end 110 | 111 | function Wheel.Show() 112 | Wheel.Active = true -- the fuck would you really expect this to do tbf 113 | end 114 | 115 | function Wheel.Hide() 116 | Wheel.Active = false 117 | Wheel.Scaleform:Dispose() -- fucking self explanatory okay cunt 118 | Wheel.Scaleform = nil 119 | Wheel.Running = false 120 | end 121 | 122 | local function UpdateWheelStyle() -- dont touch bitch 123 | if Wheel.Scaleform then 124 | Wheel.Scaleform:CallFunction("SET_WHEEL_STYLE", Wheel.Config.WheelType, Wheel.Config.SegmentCount, Wheel.Config.SpectatorWheel) 125 | Wheel.SegmentInfo = {} 126 | 127 | for i=1, Wheel.Config.SegmentCount do 128 | Wheel.SegmentInfo[i] = {Type=1, Value=""} 129 | end 130 | end 131 | end 132 | 133 | function Wheel.SetStyle(WheelType, SegmentCount, SpectatorWheel) -- WheelType: fuck knows, SegmentCount: Amount of options or whatever you call it, SpectatorWheel: dunno 134 | Wheel.Config.WheelType = WheelType 135 | Wheel.Config.SegmentCount = SegmentCount 136 | Wheel.Config.SpectatorWheel = SpectatorWheel 137 | UpdateWheelStyle() 138 | end 139 | 140 | local function RefreshSegments() -- no touchy 141 | for i=1, #Wheel.SegmentInfo do 142 | Wheel.Scaleform:CallFunction("SET_SEGMENT", i-1, Wheel.SegmentInfo[i].Type, Wheel.SegmentInfo[i].Value) 143 | end 144 | end 145 | 146 | function Wheel.SetSegment(index, type, value) -- index start at 0 okay, type: icon and text if preset exists, value: sets a value for EG. money/rp reward 147 | Wheel.SegmentInfo[index + 1].Type = type 148 | Wheel.SegmentInfo[index + 1].Value = value 149 | RefreshSegments() 150 | end 151 | 152 | function Wheel.Spin(WinningIndex, FullSpinCount, Duration, WinnerDuration, WinIcon, WinMessage) -- index of the segment which will win, how many spins will it do before stopping, duration in seconds, how long to show message in seconds, icon of winning, text to display under the icon 153 | Wheel.Scaleform:CallFunction("SPIN_WHEEL", WinningIndex, FullSpinCount, Duration, WinnerDuration, WinIcon, WinMessage) 154 | end 155 | -------------------------------------------------------------------------------- /client/hub/hub_c.lua: -------------------------------------------------------------------------------- 1 | local menus = {"itemstore", "gamble", "wepstore", "buyitem", "sellitem", "buywep","buyattach", "sellwep","quests","skinstore","buyskin","locker"} 2 | 3 | 4 | function DrawText3D(x,y,z,drawdist,text) 5 | SetDrawOrigin(x, y, z, 0) 6 | SetTextFont(0) 7 | SetTextProportional(0) 8 | SetTextScale(0.0, 0.53) 9 | SetTextColour(19, 232, 46, 240) 10 | SetTextDropshadow(0, 0, 0, 0, 255) 11 | SetTextEdge(2, 0, 0, 0, 150) 12 | SetTextDropShadow() 13 | SetTextOutline() 14 | SetTextEntry("STRING") 15 | SetTextCentre(1) 16 | AddTextComponentString(text) 17 | DrawText(0.0, 0.0) 18 | ClearDrawOrigin() 19 | end 20 | 21 | function HelpText(text) 22 | SetTextComponentFormat("STRING") 23 | AddTextComponentString(text) 24 | DisplayHelpTextFromStringLabel(0, 0, 0, -1) 25 | end 26 | 27 | Citizen.CreateThread(function() 28 | 29 | for i,quest in ipairs(Quests) do 30 | table.insert(menus, quest.name) 31 | end 32 | 33 | for i,Stall in pairs(Stores) do 34 | if Stall.model then 35 | Stall.model = GetHashKey(Stall.model) 36 | else 37 | Stall.model = GetHashKey("prop_protest_table_01") 38 | end 39 | local StallObj = CreateObject(Stall.model, Stall.location[1], Stall.location[2], Stall.location[3], false, false, false) 40 | FreezeEntityPosition(StallObj, true) 41 | SetEntityHeading(StallObj, Stall.location[4]) 42 | 43 | 44 | local blip = AddBlipForCoord(Stall.location[1], Stall.location[2], Stall.location[3]) -- blip creation 45 | SetBlipSprite(blip, Stall.blip) 46 | SetBlipColour(blip, 4) 47 | BeginTextCommandSetBlipName("STRING") 48 | AddTextComponentString(Stall.name) 49 | EndTextCommandSetBlipName(blip) 50 | 51 | end 52 | InStore = false 53 | NearStore = false 54 | CurrentStore = 0 55 | while true do 56 | Citizen.Wait(0) 57 | NearStore = false 58 | for i,Stall in pairs(Stores) do 59 | DistanceToStall = #(GetEntityCoords(PlayerPedId(), true) - vector3(Stall.location[1], Stall.location[2], Stall.location[3])) 60 | if DistanceToStall <= 10 then 61 | if not InStore then 62 | DrawText3D(Stall.location[1], Stall.location[2], Stall.location[3]+1.3, 10.0, Stall.name) 63 | end 64 | end 65 | if DistanceToStall <= 2 then 66 | NearStore = true 67 | if not InStore then 68 | HelpText("Press ~INPUT_CONTEXT~ to enter the ~g~"..Stall.name) 69 | end 70 | if IsControlJustPressed(0, 51) and not InStore then 71 | InStore = true 72 | CurrentStore = i 73 | Wait(100) 74 | WarMenu.OpenMenu(Stall.wmid) 75 | elseif WarMenu.IsMenuOpened(Stall.wmid) and not InStore then 76 | WarMenu.CloseMenu() 77 | end 78 | end 79 | end 80 | local MenuFound = false 81 | for i,Menu in pairs(menus) do 82 | if WarMenu.IsMenuOpened(Menu) then 83 | MenuFound = true 84 | end 85 | if not NearStore and WarMenu.IsMenuOpened(Menu) then 86 | writeLog("\nClosing", 1) 87 | WarMenu.CloseMenu() 88 | end 89 | end 90 | if not MenuFound and InStore then 91 | writeLog("\nmenu not found, but player is in store, exiting", 1) 92 | InStore = false 93 | CurrentStore = 0 94 | end 95 | end 96 | end) 97 | -------------------------------------------------------------------------------- /client/hub/itemshop_c.lua: -------------------------------------------------------------------------------- 1 | 2 | 3 | local itemStock = {} 4 | 5 | RegisterNetEvent("recieveHubStock") 6 | AddEventHandler("recieveHubStock", function(stockType, stock) 7 | if stockType == "weapons" then 8 | -- do nothing 9 | else 10 | itemStock = stock 11 | end 12 | end) 13 | 14 | Citizen.CreateThread(function() 15 | 16 | WarMenu.CreateMenu('itemstore', 'Store') 17 | WarMenu.SetSubTitle('itemstore', 'Item Store') 18 | WarMenu.CreateSubMenu('buyitem', 'itemstore', 'The best items around!') 19 | WarMenu.CreateSubMenu('sellitem', 'itemstore', 'Sell your stuff!') 20 | while true do 21 | if WarMenu.IsMenuOpened('itemstore') then 22 | 23 | if WarMenu.MenuButton('Purchase Items', 'buyitem') then 24 | itemStock = {} -- clear itemstock table so we can check if it's filled later 25 | TriggerServerEvent("requestHubStock", CurrentStore, "items") 26 | 27 | elseif WarMenu.MenuButton('Sell Items', 'sellitem') then 28 | end 29 | WarMenu.Display() 30 | 31 | elseif WarMenu.IsMenuOpened('buyitem') then 32 | for item,Consumable in ipairs(consumableItems) do 33 | if Consumable.price and itemStock[1] and itemStock[item] > 0 and not Consumable.isWeapon and WarMenu.Button(Consumable.name, "$"..math.floor(Consumable.price*(1+calculateBonuses(humanity)/100)).." x"..itemStock[item]) then 34 | local cPrice = math.floor(Consumable.price*(1+calculateBonuses(humanity)/100)) 35 | local money = consumableItems.count[17] 36 | if cPrice <= money then 37 | TriggerServerEvent("BuyItem", item,consumableItems.count[17],humanity) 38 | consumableItems.count[17] = math.round(money-cPrice) 39 | consumableItems.count[item] = consumableItems.count[item] + 1 40 | TriggerServerEvent("adjustHubStock", CurrentStore, "items", item, -1 ) 41 | TriggerEvent('showNotification', "Successfully purchased:~n~Item: ~g~"..Consumable.name.."~s~~n~For: ~r~$"..cPrice.."~n~~s~You now have: ~y~"..math.floor(consumableItems.count[item])) 42 | TriggerServerEvent("requestHubStock", CurrentStore,"items") 43 | else 44 | TriggerEvent('showNotification', "Cannot purchase:~n~Item: ~g~"..Consumable.name.."~s~~n~Missing: ~r~$"..cPrice-money) 45 | end 46 | end 47 | end 48 | WarMenu.Display() 49 | 50 | elseif WarMenu.IsMenuOpened('sellitem') then 51 | for item,Consumable in ipairs(consumableItems) do 52 | if Consumable.price and consumableItems.count[item] > 0.0 and not Consumable.isWeapon and WarMenu.Button(Consumable.name, "$"..math.floor(Consumable.price * (Consumable.sellloss or 0.35)).." x"..math.floor(consumableItems.count[item])) then 53 | local Percentage = math.floor(Consumable.price * (Consumable.sellloss or 0.35)) 54 | local money = consumableItems.count[17] 55 | if consumableItems.count[item] >= 1 then 56 | consumableItems.count[item] = consumableItems.count[item] - 1 57 | TriggerServerEvent("adjustHubStock", CurrentStore,"items", item, 1 ) 58 | consumableItems.count[17] = math.round(money+Percentage) 59 | TriggerServerEvent("AddLegitimateMoney", Percentage) 60 | TriggerEvent('showNotification', "Successfully sold:~n~Item: "..Consumable.name.."~s~~n~For: ~g~$"..Percentage) 61 | else 62 | TriggerEvent('showNotification', "Cannot Sell:~n~Item: ~r~"..Consumable.name.."~s~~n~Missing: ~y~"..math.floor(consumableItems.count[item])) 63 | end 64 | end 65 | end 66 | WarMenu.Display() 67 | end 68 | 69 | Citizen.Wait(0) 70 | end 71 | end) -------------------------------------------------------------------------------- /client/hub/locker_c.lua: -------------------------------------------------------------------------------- 1 | 2 | 3 | Citizen.CreateThread(function() 4 | WarMenu.CreateMenu('locker', 'Money Locker') 5 | WarMenu.SetSubTitle('locker', 'Money Locker') 6 | while true do 7 | if WarMenu.IsMenuOpened('locker') then 8 | WarMenu.SetSubTitle('locker', 'Current Balance: $'..locker_money) 9 | 10 | if WarMenu.Button('Deposit Money') then 11 | 12 | local maxMoney = 10000 13 | if consumableItems.count[17] > maxMoney then 14 | maxMoney = maxMoney-locker_money 15 | elseif consumableItems.count[17] < maxMoney then 16 | if (maxMoney-locker_money) < consumableItems.count[17] then 17 | maxMoney = maxMoney-locker_money 18 | else 19 | maxMoney = consumableItems.count[17] 20 | end 21 | end 22 | 23 | -- new 24 | local result, type = CreateAwaitedKeyboardInput("DEPOSIT_MONEY", "Deposit Money ( Up to $"..maxMoney.." )",6) 25 | 26 | if not tonumber(result) then 27 | TriggerEvent("showNotification", "Please Enter a Correct Number.") 28 | elseif tonumber(result) > consumableItems.count[17] then 29 | TriggerEvent("showNotification", "You cannot deposit more than you have, silly!") 30 | elseif tonumber(result) > 10000 then 31 | TriggerEvent("showNotification", "You cannot deposit more than $10000!") 32 | elseif locker_money + tonumber(result) > 10000 then 33 | TriggerEvent("showNotification", "You cannot deposit more than $"..10000-locker_money.."!") 34 | elseif tonumber(result) < 1 then 35 | TriggerEvent("showNotification", "Nice Try, but you gotta try harder.") 36 | else 37 | result = math.round(tonumber(result)) 38 | locker_money = locker_money+tonumber(result) 39 | consumableItems.count[17] = consumableItems.count[17]-result 40 | TriggerServerEvent("AddLegitimateMoney", -result) 41 | TriggerEvent("showNotification", "Successfully Deposited $"..result.."!") 42 | initiateSave(true) 43 | end 44 | 45 | 46 | elseif WarMenu.Button('Withdraw Money') then 47 | 48 | local result, type = CreateAwaitedKeyboardInput("WITHDRAW_MONEY", "Withdraw Money ( Up to $"..locker_money.." )",6) 49 | 50 | if not tonumber(result) then 51 | TriggerEvent("showNotification", "Please Enter a Correct Number.") 52 | elseif tonumber(result) > locker_money then 53 | TriggerEvent("showNotification", "You cannot withdraw more than $"..locker_money.."!") 54 | elseif tonumber(result) > 10000 then 55 | TriggerEvent("showNotification", "You cannot withdraw more than $"..locker_money.."!") 56 | elseif tonumber(result) < 1 then 57 | TriggerEvent("showNotification", "Well that just sounds plain silly.") 58 | else 59 | result = math.round(tonumber(result)) 60 | locker_money = locker_money-result 61 | consumableItems.count[17] = consumableItems.count[17]+result 62 | TriggerServerEvent("AddLegitimateMoney", result) 63 | TriggerEvent("showNotification", "Successfully Withdrawed $"..result.."!") 64 | initiateSave(true) 65 | end 66 | 67 | 68 | end 69 | WarMenu.Display() 70 | end 71 | Citizen.Wait(0) 72 | end 73 | end) -------------------------------------------------------------------------------- /client/hub/questshop_c.lua: -------------------------------------------------------------------------------- 1 | 2 | function GenerateQuestDescriptions() 3 | for i,quest in pairs(Quests) do 4 | WarMenu.CreateSubMenu(quest.name, 'quests', quest.name) 5 | AddTextEntry(GetHashKey(quest.name), quest.name) 6 | AddTextEntry(GetHashKey(quest.desc), quest.desc) 7 | AddTextEntry(GetHashKey(quest.finishmessage), quest.finishmessage) 8 | 9 | local reqt = "Requirements:" 10 | for i,req in pairs(quest.finishrequirements) do 11 | if i == "banditkills" and req > 0 then 12 | reqt=reqt.."\nBandit Kills: "..req 13 | end 14 | if i == "zombiekills" and req > 0 then 15 | reqt=reqt.."\nZombie Kills: "..req 16 | end 17 | if i == "herokills" and req > 0 then 18 | reqt=reqt.."\nHero Kills: "..req 19 | end 20 | if i == "stopCamps" and req > 0 then 21 | reqt=reqt.."\nStop "..req.." Mercenary Camps" 22 | end 23 | if i == "withweapon" then 24 | reqt=reqt.." with "..WEAPON_HASHES_STRINGS[""..req..""] 25 | end 26 | 27 | if i == "items" and #req ~= 0 then 28 | for index,item in pairs(req) do 29 | reqt=reqt.."\n"..item.count.."x "..consumableItems[item.id].name 30 | end 31 | end 32 | end 33 | AddTextEntry(GetHashKey(quest.name.."_required"), reqt) 34 | end 35 | writeLog("\nQuest Data Loaded", 1) 36 | end 37 | Citizen.CreateThread(function() 38 | 39 | WarMenu.CreateMenu('quests', 'Quests') 40 | WarMenu.SetSubTitle('quests', 'Quests') 41 | 42 | 43 | while true do 44 | if WarMenu.IsMenuOpened('quests') then 45 | 46 | for i,quest in pairs(Quests) do 47 | if (not CanPlayerStartQuest(quest.id) and quest.hide and currentQuest.id ~= quest.id) then 48 | 49 | elseif WarMenu.MenuButton(quest.name, quest.name) then 50 | 51 | end 52 | end 53 | WarMenu.Display() 54 | 55 | end 56 | for i,quest in pairs(Quests) do 57 | if WarMenu.IsMenuOpened(quest.name) then 58 | DrawQuestText(quest.id,0.25,0.96) 59 | if IsQuestFinished(quest.id) then 60 | if WarMenu.Button("~h~[FINISHED]~h~ Accept Mission") then 61 | ActivateQuest(quest.id) 62 | end 63 | elseif currentQuest.active and currentQuest.id ~= quest.id then 64 | if WarMenu.Button("~h~[UNAVAIL]~h~ Accept Mission") then 65 | ActivateQuest(quest.id) 66 | end 67 | elseif currentQuest.active and currentQuest.id == quest.id then 68 | if WarMenu.Button("~h~[ACTIVE]~h~ Accept Mission") then 69 | ActivateQuest(quest.id) 70 | end 71 | if WarMenu.Button("Finish Mission") then 72 | FinishQuest(quest.id) 73 | DrawQuestText(quest.finishmessage,10000,true) 74 | end 75 | if WarMenu.Button("Abort Mission") then 76 | AbortQuest(quest.id) 77 | end 78 | else 79 | if WarMenu.Button("Accept Mission") then 80 | ActivateQuest(quest.id) 81 | end 82 | end 83 | WarMenu.Display() 84 | end 85 | end 86 | Citizen.Wait(0) 87 | end 88 | end) 89 | 90 | function DrawQuestText(id) 91 | if id and Quests[id] then 92 | DrawRect(0.5, 0.5, 0.5, 0.5, 50, 50, 50, 210) 93 | 94 | SetTextFont(0) 95 | SetTextProportional(1) 96 | SetTextScale(0.0, 0.6) 97 | 98 | SetTextColour(255, 255, 255, 255) 99 | 100 | SetTextDropshadow(0, 0, 0, 0, 255) 101 | SetTextEdge(1, 0, 0, 0, 255) 102 | SetTextDropShadow() 103 | SetTextOutline() 104 | BeginTextCommandDisplayText(GetHashKey(Quests[id].name)) 105 | DrawText(0.30, 0.25) 106 | 107 | 108 | SetTextFont(0) 109 | SetTextProportional(1) 110 | SetTextScale(0.0, 0.4) 111 | 112 | SetTextColour(255, 255, 255, 255) 113 | 114 | SetTextDropshadow(0, 0, 0, 0, 255) 115 | SetTextEdge(1, 0, 0, 0, 255) 116 | SetTextDropShadow() 117 | SetTextOutline() 118 | BeginTextCommandDisplayText(GetHashKey(Quests[id].desc)) 119 | DrawText(0.30, 0.3) 120 | 121 | SetTextFont(0) 122 | SetTextProportional(1) 123 | SetTextScale(0.0, 0.4) 124 | 125 | SetTextColour(255, 255, 255, 255) 126 | 127 | SetTextDropshadow(0, 0, 0, 0, 255) 128 | SetTextEdge(1, 0, 0, 0, 255) 129 | SetTextDropShadow() 130 | SetTextOutline() 131 | BeginTextCommandDisplayText(GetHashKey(Quests[id].name.."_required")) 132 | DrawText(0.30, 0.5) 133 | 134 | 135 | if IsQuestFinished(id) then 136 | SetTextFont(0) 137 | SetTextProportional(1) 138 | SetTextScale(0.0, 0.4) 139 | 140 | SetTextColour(255, 255, 255, 255) 141 | 142 | SetTextDropshadow(0, 0, 0, 0, 255) 143 | SetTextEdge(1, 0, 0, 0, 255) 144 | SetTextDropShadow() 145 | SetTextOutline() 146 | BeginTextCommandDisplayText(GetHashKey(Quests[id].finishmessage)) 147 | DrawText(0.30, 0.6) 148 | end 149 | end 150 | end 151 | -------------------------------------------------------------------------------- /client/hub/skinshop_c.lua: -------------------------------------------------------------------------------- 1 | 2 | local clickedAmount = 0 3 | local clickedButton = 0 4 | local SelectionScreen = false 5 | local ped = nil 6 | local savedHunger,savedThirst,savedWeapons = 0.0,0.0,{} 7 | Citizen.CreateThread(function() 8 | while true do 9 | Citizen.Wait(0) 10 | if SelectionScreen and ped ~= nil then 11 | local rot = GetEntityHeading(ped) 12 | SetEntityHeading(ped, rot + 1.0) 13 | HideHudAndRadarThisFrame() 14 | end 15 | end 16 | end) 17 | 18 | 19 | 20 | 21 | Citizen.CreateThread(function() 22 | local function SwitchSkin(skin,coords) 23 | RequestModel(skin) 24 | while not HasModelLoaded(skin) do 25 | Wait(250) 26 | end 27 | if ped ~= nil then 28 | SetEntityAsMissionEntity(ped, 1, 1) 29 | DeleteEntity(ped) 30 | ped = nil 31 | end 32 | ped = CreatePed(1, GetHashKey(skin), coords[1], coords[2], coords[3], coords[4], true, true) 33 | SetEntityInvincible(ped, true) 34 | SetEntityProofs(ped, true, true, true, true, true, true, true, true) 35 | Entity(ped).state:set("C8pE53jw", true, true) 36 | SetPedRandomComponentVariation(ped, true) 37 | SetPedRandomProps(ped) 38 | end 39 | 40 | local function ExitSkinCam() 41 | if ped ~= nil then 42 | SetEntityAsMissionEntity(ped, 1, 1) 43 | DeleteEntity(ped) 44 | ped = nil 45 | end 46 | SetFollowPedCamViewMode(1) 47 | RenderScriptCams(false, 0, 0, true, true) 48 | EnableAllControlActions(0) 49 | FreezeEntityPosition(PlayerPedId(), false) 50 | SelectionScreen = false 51 | end 52 | 53 | local function init(coords) 54 | CreationCam = CreateCam("DEFAULT_SCRIPTED_CAMERA", 1) 55 | SetCamCoord(CreationCam, coords[1], coords[2], coords[3]) 56 | SetCamRot(CreationCam, 0.0, 0.0, coords[4]) 57 | SetCamFov(CreationCam, 60.0) 58 | end 59 | 60 | function ButtonMessage(text) 61 | BeginTextCommandScaleformString("STRING") 62 | AddTextComponentScaleform(text) 63 | EndTextCommandScaleformString() 64 | end 65 | 66 | function Button(ControlButton) 67 | N_0xe83a3e3557a56640(ControlButton) 68 | end 69 | 70 | 71 | local function BeginCameraIn(model,camcoords,pedcoords) 72 | loadingSkin = true 73 | DoScreenFadeOut(1500) 74 | Wait(2500) 75 | init(camcoords) 76 | FreezeEntityPosition(PlayerPedId(), true) 77 | DisableAllControlActions(0) 78 | SetGameplayCamRelativeHeading(80.0) 79 | SetFollowPedCamViewMode(4) 80 | Wait(1000) 81 | SwitchSkin(model,pedcoords) 82 | DoScreenFadeIn(2500) 83 | RenderScriptCams(true, 1, 5000, true, true) 84 | SelectionScreen = true 85 | loadingSkin = false 86 | end 87 | 88 | 89 | 90 | WarMenu.CreateMenu('skinstore', 'Clothing Store') 91 | WarMenu.SetSubTitle('skinstore', 'Clothing Store') 92 | WarMenu.CreateSubMenu('buyskin', 'skinstore', "DOWNLOAD CLOTHING") 93 | 94 | while true do 95 | if WarMenu.IsMenuOpened('skinstore') then 96 | ExitSkinCam() 97 | if WarMenu.MenuButton('Purchase Skins', 'buyskin') then 98 | end 99 | WarMenu.Display() 100 | 101 | elseif SelectionScreen and ped and not WarMenu.IsMenuOpened('buyskin') then 102 | ExitSkinCam() 103 | 104 | elseif WarMenu.IsMenuOpened('buyskin') then 105 | 106 | if not SelectionScreen then 107 | loadingSkin = true 108 | BeginCameraIn("s_m_y_armymech_01", Stores[CurrentStore].camcoords, Stores[CurrentStore].pedcoords) 109 | repeat 110 | Wait(1) 111 | until SelectionScreen 112 | end 113 | 114 | for item,Ped in ipairs(BuyablePeds) do 115 | if Ped.price then 116 | local AlreadyOwned = (GetEntityModel(PlayerPedId()) == Ped.model) 117 | local ExtraText = IfTrueDraw(AlreadyOwned, " ~g~[OWNED]", "x%s") 118 | local ModelPrice = math.floor(Ped.price * (1+(calculateBonuses(humanity)/100) )) 119 | if Ped.price < 1 then 120 | DisplayPrice = "UNAVAILABLE" 121 | else 122 | if clickedAmount == 1 and clickedButton == item then 123 | DisplayPrice = "[PREVIEW] $"..math.floor(Ped.price * (1+(calculateBonuses(humanity)/100) )) 124 | else 125 | DisplayPrice = "$"..math.floor(Ped.price * (1+(calculateBonuses(humanity)/100) )) 126 | end 127 | end 128 | 129 | if WarMenu.Button(Ped.name, DisplayPrice) then 130 | savedHunger,savedThirst,savedWeapons,attaches = LocalPlayer.state.hunger,LocalPlayer.state.thirst,{},{} 131 | for i,theItem in ipairs(consumableItems) do 132 | local ammocount = consumableItems.count[i] 133 | local attaches = {} 134 | if consumableItems[i].isWeapon then 135 | if HasPedGotWeapon(PlayerPedId(), consumableItems[i].hash, false) then 136 | ammocount = GetAmmoInPedWeapon(PlayerPedId(), consumableItems[i].hash) 137 | for _,attachment in ipairs(weaponComponents) do 138 | if DoesWeaponTakeWeaponComponent(consumableItems[i].hash, GetHashKey(attachment.hash)) and HasPedGotWeaponComponent(PlayerPedId(), consumableItems[i].hash, GetHashKey(attachment.hash)) then 139 | table.insert(attaches, attachment.hash) 140 | end 141 | end 142 | else 143 | count = 0 144 | end 145 | end 146 | if #attaches == 0 then 147 | attaches = nil 148 | end 149 | 150 | table.insert(savedWeapons, {item = theItem.name, count = ammocount, attachments = attaches}) 151 | end 152 | 153 | if clickedButton ~= item then 154 | clickedButton = item 155 | clickedAmount = 1 156 | SwitchSkin(Ped.model, Stores[CurrentStore].pedcoords) 157 | elseif clickedButton == item then 158 | if clickedAmount == 1 then 159 | clickedAmount = 2 160 | end 161 | 162 | if Ped.price < 1 then 163 | TriggerEvent('showNotification', "This Item is Unavailable at this time, please try again later.") 164 | clickedAmount = 0 165 | else 166 | local money = consumableItems.count[17] 167 | if ModelPrice <= money and not AlreadyOwned then 168 | TriggerEvent('showNotification', "Successfully purchased!") 169 | consumableItems.count[17] = math.round(money-ModelPrice) 170 | TriggerServerEvent("AddLegitimateMoney", -ModelPrice) 171 | TriggerServerEvent("SetPlayerSkin", item) 172 | SetPlayerModel(PlayerId(), Ped.model) 173 | SetPedRandomComponentVariation(PlayerPedId(), true) 174 | Wait(200) 175 | LocalPlayer.state.hunger = savedHunger 176 | LocalPlayer.state.thirst = savedThirst 177 | for i,w in ipairs(savedWeapons) do 178 | consumableItems.count[i] = w.count 179 | if consumableItems[i].isWeapon and w.count ~= 0 then 180 | GiveWeaponToPed(PlayerPedId(), consumableItems[i].hash, w.count, false, false) 181 | if w.attachments then 182 | for _,attachment in pairs(w.attachments) do 183 | if DoesWeaponTakeWeaponComponent(consumableItems[i].hash, GetHashKey(attachment)) then 184 | GiveWeaponComponentToPed(PlayerPedId(), consumableItems[i].hash, GetHashKey(attachment)) 185 | end 186 | end 187 | end 188 | end 189 | end 190 | 191 | elseif ModelPrice >= money and not AlreadyOwned then 192 | TriggerEvent('showNotification', "Cannot purchase:~n~Missing: ~r~$"..ModelPrice-money) 193 | end 194 | clickedAmount = 0 195 | end 196 | end 197 | end 198 | end 199 | end 200 | WarMenu.Display() 201 | end 202 | Citizen.Wait(0) 203 | end 204 | end) -------------------------------------------------------------------------------- /client/hub/wepshop_c.lua: -------------------------------------------------------------------------------- 1 | function IfTrueDraw(var, iftrue, iffalse) 2 | if var then 3 | return iftrue 4 | else 5 | return iffalse 6 | end 7 | end 8 | 9 | 10 | local weaponStock = {} 11 | 12 | RegisterNetEvent("recieveHubStock") 13 | AddEventHandler("recieveHubStock", function(stockType, stock) 14 | if stockType == "weapons" then 15 | weaponStock = stock 16 | end 17 | end) 18 | 19 | Citizen.CreateThread(function() 20 | 21 | WarMenu.CreateMenu('wepstore', 'Weapon Store') 22 | WarMenu.SetSubTitle('wepstore', 'Item Store') 23 | WarMenu.CreateSubMenu('buywep', 'wepstore', 'The best weapons around!') 24 | WarMenu.CreateSubMenu('buyattach', 'wepstore', 'Find your Combination!') 25 | WarMenu.CreateSubMenu('sellwep', 'wepstore', 'Sell your stuff!') 26 | while true do 27 | if WarMenu.IsMenuOpened('wepstore') then 28 | if WarMenu.MenuButton('Purchase Items', 'buywep') then 29 | weaponStock = {} -- clear itemstock table so we can check if it's filled later 30 | TriggerServerEvent("requestHubStock", CurrentStore,"weapons") 31 | 32 | elseif WarMenu.MenuButton('Buy Attachments', 'buyattach') then 33 | 34 | elseif WarMenu.MenuButton('Sell Items', 'sellwep') then 35 | 36 | end 37 | WarMenu.Display() 38 | elseif WarMenu.IsMenuOpened('buywep') then 39 | for item,Weapon in ipairs(consumableItems) do 40 | if Weapon.isWeapon and Weapon.price then 41 | local AlreadyOwned = HasPedGotWeapon(PlayerPedId(),GetHashKey(Weapon.hash),false) 42 | local ExtraText = IfTrueDraw(AlreadyOwned, " ~g~[OWNED]", "x%s") 43 | local AmmoPrice = math.floor(Weapon.price * (0.25 + (calculateAmmoBonuses(humanity)/100) )) 44 | local WeaponPrice = math.floor(Weapon.price * (1+(calculateBonuses(humanity)/100) )) 45 | local Price = IfTrueDraw(AlreadyOwned and Weapon.hasammo, "Ammo: $"..AmmoPrice, "$"..WeaponPrice) 46 | if weaponStock[item] and weaponStock[item] > 0 and WarMenu.Button(Weapon.name, Price.. string.format(ExtraText, weaponStock[item])) then 47 | local money = consumableItems.count[17] 48 | if WeaponPrice <= money and not AlreadyOwned then 49 | TriggerEvent('showNotification', "Successfully purchased:~n~Weapon: ~g~"..Weapon.name.."~s~~n~For: ~r~$"..WeaponPrice) 50 | TriggerServerEvent("BuyItem", item,consumableItems.count[17],humanity) 51 | consumableItems.count[17] = math.round(money-WeaponPrice) 52 | consumableItems.count[item] = GetMaxAmmoInClip(PlayerPedId(), Weapon.hash, false) 53 | TriggerServerEvent("adjustHubStock", CurrentStore,"weapons", item, -1 ) 54 | GiveWeaponToPed(PlayerPedId(), GetHashKey(Weapon.hash), GetMaxAmmoInClip(PlayerPedId(), Weapon.hash, false), false, false) 55 | TriggerServerEvent("requestHubStock", CurrentStore,"weapons") 56 | elseif WeaponPrice >= money and not AlreadyOwned then 57 | TriggerEvent('showNotification', "Cannot purchase:~n~Weapon: ~g~"..Weapon.name.."~s~~n~Missing: ~r~$"..WeaponPrice-money) 58 | end 59 | -- Ammo purchasing (Yes, its a different statement, BuuuUuuUut it looked nicer!) -- 60 | local HasAmmo, MaxAmmo = GetMaxAmmo(PlayerPedId(), Weapon.hash, MaxAmmo) 61 | local CurAmmo = GetAmmoInPedWeapon(PlayerPedId(), Weapon.hash) 62 | if Weapon.price and AmmoPrice <= money and CurAmmo < MaxAmmo and Weapon.hasammo and AlreadyOwned then 63 | TriggerEvent('showNotification', "Successfully purchased:~n~Ammo For: ~g~"..Weapon.name.."~s~~n~For: ~r~$"..AmmoPrice) 64 | consumableItems.count[17] = math.round(money-AmmoPrice) 65 | TriggerServerEvent("AddLegitimateMoney", -AmmoPrice) 66 | consumableItems.count[item] = GetAmmoInPedWeapon(PlayerPedId(), Weapon.hash)+GetMaxAmmoInClip(PlayerPedId(), Weapon.hash, false) 67 | AddAmmoToPed(PlayerPedId(), Weapon.hash, GetMaxAmmoInClip(PlayerPedId(), Weapon.hash, false)) 68 | elseif AmmoPrice >= money and AlreadyOwned then 69 | TriggerEvent('showNotification', "Cannot purchase:~n~Ammo For: ~g~"..Weapon.name.."~s~~n~Missing: ~r~$"..AmmoPrice) 70 | elseif CurAmmo == MaxAmmo and Weapon.hasammo and AlreadyOwned then 71 | TriggerEvent('showNotification', "Cannot purchase:~n~Ammo For: ~g~"..Weapon.name.."~s~~n~Ammo already ~r~Full!") 72 | end 73 | end 74 | end 75 | end 76 | WarMenu.Display() 77 | 78 | elseif WarMenu.IsMenuOpened('buyattach') then 79 | local dh,cw = GetCurrentPedWeapon(PlayerPedId(), "lol meme") 80 | for i,attachment in ipairs(weaponComponents) do 81 | if attachment.price then 82 | local AlreadyOwned = HasPedGotWeaponComponent(PlayerPedId(), cw, attachment.hash) 83 | local ExtraText = IfTrueDraw(AlreadyOwned, " ~g~[OWNED] ~c~$%s", "$%s") 84 | local ItemPrice = math.floor(attachment.price * (1+(calculateBonuses(humanity)/100) )) 85 | if dh and attachment.price and DoesWeaponTakeWeaponComponent(cw, attachment.hash) and WarMenu.Button(attachment.name, string.format(ExtraText, tostring(ItemPrice))) then 86 | local money = consumableItems.count[17] 87 | if HasPedGotWeaponComponent(PlayerPedId(), cw, attachment.hash) then 88 | RemoveWeaponComponentFromPed(PlayerPedId(), cw, attachment.hash) 89 | local Percentage = math.floor(attachment.price * 5 / 10) 90 | consumableItems.count[17] = math.round(money+Percentage) 91 | TriggerServerEvent("AddLegitimateMoney", Percentage) 92 | TriggerEvent('showNotification', "Successfully sold:~n~Attachment: ~r~"..attachment.name.."~s~~n~For: ~g~$"..Percentage) 93 | elseif ItemPrice <= money and not HasPedGotWeaponComponent(PlayerPedId(), cw, attachment.hash) then 94 | GiveWeaponComponentToPed(PlayerPedId(), cw, attachment.hash) 95 | consumableItems.count[17] = consumableItems.count[17]-math.round(ItemPrice) 96 | TriggerServerEvent("AddLegitimateMoney", -math.round(ItemPrice)) 97 | TriggerEvent('showNotification', "Successfully purchased:~n~Attachment: ~g~"..attachment.name.."~s~~n~For: ~r~$"..ItemPrice) 98 | else 99 | TriggerEvent('showNotification', "Cannot purchase:~n~Attachment: ~g~"..attachment.name.."~s~~n~Missing: ~r~$"..ItemPrice-money) 100 | end 101 | end 102 | end 103 | end 104 | 105 | WarMenu.Display() 106 | 107 | elseif WarMenu.IsMenuOpened('sellwep') then 108 | for item,Weapon in ipairs(consumableItems) do 109 | if Weapon.isWeapon and Weapon.price and HasPedGotWeapon(PlayerPedId(),GetHashKey(Weapon.hash),false) then 110 | local Percentage = math.floor(Weapon.price * 5 / 10) 111 | if Weapon.price and WarMenu.Button(Weapon.name, "$"..Percentage) then 112 | local money = consumableItems.count[17] 113 | RemoveWeaponFromPed(PlayerPedId(), Weapon.hash) 114 | consumableItems.count[item] = 0 115 | TriggerEvent('showNotification', "Successfully sold:~n~Weapon: ~r~"..Weapon.name.."~s~~n~For: ~g~$"..Percentage) 116 | TriggerServerEvent("adjustHubStock", CurrentStore,"weapons", item, 1 ) 117 | consumableItems.count[17] = math.round(money+Percentage) 118 | TriggerServerEvent("AddLegitimateMoney", Percentage) 119 | end 120 | end 121 | end 122 | WarMenu.Display() 123 | end 124 | 125 | 126 | Citizen.Wait(0) 127 | end 128 | end) -------------------------------------------------------------------------------- /client/inventory/food.lua: -------------------------------------------------------------------------------- 1 | Citizen.CreateThread(function() 2 | -- these were never local since they are unique anyway, but you do you i guess 3 | local defaultHungerLoss = 0.0003 4 | local defaultThirstLoss = 0.00044 5 | local SprintingHungerLoss = 0.0005 6 | local SprintingThirstLoss = 0.00064 7 | local drivingHungerLoss = 0.0002 8 | local drivingThirstLoss = 0.0003 9 | local Saturation = 0 -- hey, this is a thing i wanted to implement, but never did, horayy 10 | while true do 11 | Citizen.Wait(0) 12 | local pid = PlayerId() 13 | local ppid = PlayerPedId() 14 | local thirst = LocalPlayer.state.thirst 15 | local hunger = LocalPlayer.state.hunger 16 | 17 | if infected then 18 | SetPlayerHealthRechargeMultiplier(pid, 0.01) 19 | else 20 | SetPlayerHealthRechargeMultiplier(pid, 0.3) 21 | end 22 | if hunger > 100.0 then 23 | LocalPlayer.state.hunger = 100.0 24 | hunger = LocalPlayer.state.hunger 25 | end 26 | if thirst > 100.0 then 27 | LocalPlayer.state.thirst = 100.0 28 | thirst = LocalPlayer.state.thirst 29 | end 30 | if IsPedSprinting(ppid) then 31 | LocalPlayer.state.hunger = hunger-SprintingHungerLoss 32 | LocalPlayer.state.thirst = thirst-SprintingThirstLoss 33 | elseif IsPedInVehicle(ppid) then 34 | LocalPlayer.state.hunger = hunger-drivingHungerLoss 35 | LocalPlayer.state.thirst = thirst-drivingThirstLoss 36 | else 37 | LocalPlayer.state.hunger = hunger-defaultHungerLoss 38 | LocalPlayer.state.thirst = thirst-defaultThirstLoss 39 | end 40 | end 41 | end) 42 | 43 | Citizen.CreateThread(function() 44 | while true do 45 | Citizen.Wait(5000) 46 | local localPlayerPed = PlayerPedId() 47 | local health = GetEntityHealth(localPlayerPed) 48 | local thirst = LocalPlayer.state.thirst 49 | local hunger = LocalPlayer.state.hunger 50 | if hunger < 15.0 and hunger > 2.0 then 51 | SetEntityHealth(localPlayerPed,health-4) 52 | end 53 | if thirst < 15.0 and thirst > 2.0 then 54 | SetEntityHealth(localPlayerPed,health-4) 55 | end 56 | if hunger < 2.0 then 57 | SetEntityHealth(localPlayerPed, health-15) 58 | end 59 | if thirst < 2.0 then 60 | SetEntityHealth(localPlayerPed, health-15) 61 | end 62 | end 63 | end) -------------------------------------------------------------------------------- /client/missions/ai_camps_c.lua: -------------------------------------------------------------------------------- 1 | local pedWeps = 2 | { 3 | "WEAPON_PISTOL", 4 | "WEAPON_PUMPSHOTGUN", 5 | "WEAPON_SAWNOFFSHOTGUN", 6 | "WEAPON_MICROSMG", 7 | "WEAPON_COMPACTRIFLE", 8 | "WEAPON_COMBATPISTOL", 9 | "WEAPON_BULLPUPRIFLE", 10 | "WEAPON_ASSAULTSHOTGUN", 11 | "WEAPON_REVOLVER", 12 | "WEAPON_COMBATPDW", 13 | "WEAPON_ASSAULTSMG", 14 | "WEAPON_ASSAULTRIFLE", 15 | "weapon_Pistol_Mk2", 16 | "weapon_AssaultRifle_Mk2", 17 | "weapon_SMG_Mk2" 18 | } 19 | 20 | local pedModels = 21 | { 22 | "S_M_Y_BlackOps_01", 23 | "S_M_Y_BlackOps_02", 24 | "S_M_Y_BlackOps_03", 25 | } 26 | -- CODE -- 27 | banditcamps = {} 28 | 29 | bandits = {} 30 | 31 | 32 | Citizen.CreateThread(function() 33 | AddRelationshipGroup("bandit") 34 | SetRelationshipBetweenGroups(5, GetHashKey("bandit"), GetHashKey("PLAYER")) 35 | SetRelationshipBetweenGroups(0, GetHashKey("bandit"), GetHashKey("bandit")) 36 | SetRelationshipBetweenGroups(5, GetHashKey("bandit"), GetHashKey("zombeez")) 37 | SetRelationshipBetweenGroups(5, GetHashKey("PLAYER"), GetHashKey("bandit")) 38 | 39 | while true do 40 | Wait(100) 41 | local px,py,pz = table.unpack(GetEntityCoords(PlayerPedId(),false)) 42 | for i, camp in ipairs(banditcamps) do 43 | for i,ped in ipairs(camp.peds) do 44 | if NetworkHasControlOfEntity(ped) and #(vector3(camp.coords.x, camp.coords.y, camp.coords.z) - vector3(px,py,pz)) > 400 then 45 | DeleteEntity(ped) 46 | table.remove(camp.peds,i) 47 | elseif NetworkHasControlOfEntity(ped) and IsPedDeadOrDying(ped, true) then 48 | local pedX,pedY,pedZ=table.unpack(GetEntityCoords(ped,true) ) 49 | TriggerServerEvent("ForceCreateWeaponPickupAtLocation", pedX,pedY,pedZ) 50 | table.remove(camp.peds,i) 51 | writeLog("ped dead", 1) 52 | local cod = GetPedSourceOfDeath(ped) 53 | local weap = GetPedCauseOfDeath(ped) 54 | if cod ~= 0 and NetworkGetPlayerIndexFromPed(cod) then 55 | TriggerServerEvent("s_killedBanditPed",GetPlayerServerId(NetworkGetPlayerIndexFromPed(cod)),weap) 56 | end 57 | elseif #(vector3(camp.coords.x, camp.coords.y, camp.coords.z) - vector3(px,py,pz)) < 300 and not DoesEntityExist(ped) then 58 | table.remove(camp.peds,i) 59 | end 60 | Wait(1) 61 | end 62 | if #camp.peds == 0 then 63 | TriggerServerEvent("RemoveOldCamp", camp.id) 64 | end 65 | end 66 | end 67 | end) 68 | 69 | 70 | function GenerateBanditCamp(campinfo) 71 | x, y, z = table.unpack(GetEntityCoords(PlayerPedId(), true)) 72 | 73 | local campx,campy,campz = campinfo.coords.x, campinfo.coords.y, campinfo.coords.z 74 | _,campz = GetGroundZFor_3dCoord(campx+.0,campy+.0,9999.0, 0) 75 | 76 | for i, model in ipairs(pedModels) do 77 | RequestModel(model) 78 | while not HasModelLoaded(model) or not HasCollisionForModelLoaded(model) do 79 | Wait(200) 80 | end 81 | end 82 | campinfo.peds = {} 83 | for i=1, campinfo.pedcount do 84 | choosenPed1 = pedModels[math.random(1, #pedModels)] 85 | choosenPed1 = string.upper(choosenPed1) 86 | ped = CreatePed(4, GetHashKey(choosenPed1), campx+math.random(-3,3),campy+math.random(-3,3),campz, 0.0, true, false) 87 | Entity(ped).state:set("C8pE53jw", true, true) 88 | Entity(ped).state:set("bandit", true, true) 89 | SetPedArmour(ped, 20.0) 90 | local health = math.random(200,600) 91 | SetPedMaxHealth(ped, health) 92 | SetEntityHealth(ped, health) 93 | --SetPedAccuracy(ped, 25) 94 | SetPedSeeingRange(ped, 80.0) 95 | SetPedHearingRange(ped, 30.0) 96 | 97 | SetPedFleeAttributes(ped, 0, 0) 98 | SetPedCombatAttributes(ped, 0, 1) 99 | SetPedCombatAttributes(ped, 16, 1) 100 | SetPedCombatAttributes(ped, 46, 1) 101 | SetPedCombatAttributes(ped, 1424, 1) 102 | SetPedCombatAttributes(ped, 5, 1) 103 | SetPedCombatMovement(ped, 3) 104 | --SetPedCombatRange(ped,1) 105 | --SetPedDiesInstantlyInWater(ped,true) 106 | SetPedDropsWeaponsWhenDead(ped, false) 107 | SetPedRelationshipGroupHash(ped, GetHashKey("bandit")) 108 | TaskGuardCurrentPosition(ped, 35.0, 35.0, 1) 109 | randomWep = math.random(1, #pedWeps) 110 | GiveWeaponToPed(ped, GetHashKey(pedWeps[randomWep]), 9999, true, true) 111 | 112 | repeat 113 | Wait(500) 114 | if not NetworkGetEntityIsNetworked(ped) then 115 | NetworkRegisterEntityAsNetworked(ped) 116 | end 117 | netid = NetworkGetNetworkIdFromEntity(ped) 118 | until (netid and NetworkGetEntityFromNetworkId(netid) == ped) 119 | table.insert(campinfo.peds, NetworkGetNetworkIdFromEntity(ped)) 120 | end 121 | 122 | TriggerServerEvent("RegisterNewBanditCamp", campinfo) 123 | writeLog("\nGenerated New Bandit Camp", 1) 124 | end 125 | RegisterNetEvent("GenerateBanditCamp") 126 | AddEventHandler("GenerateBanditCamp", GenerateBanditCamp) 127 | 128 | RegisterNetEvent("RegisterNewBanditCamp") 129 | AddEventHandler("RegisterNewBanditCamp", function(data) 130 | -- {netid = netid, id = #spawnedCars+1} 131 | for i, ped in ipairs(data.peds) do 132 | data.peds[i] = NetworkGetEntityFromNetworkId(ped) 133 | writeLog("netid:"..ped, 1) 134 | end 135 | data.blip = AddBlipForRadius(data.coords.x, data.coords.y, data.coords.z, 30.0) 136 | SetBlipAsShortRange(data.blip, true) 137 | SetBlipColour(data.blip, 1) 138 | SetBlipDisplay(data.blip, 2) 139 | SetBlipAlpha(data.blip, 180) 140 | data.blip2 = AddBlipForCoord(data.coords.x, data.coords.y, data.coords.z) 141 | SetBlipAsShortRange(data.blip2, true) 142 | SetBlipColour(data.blip2, 1) 143 | SetBlipDisplay(data.blip2, 2) 144 | SetBlipSprite(data.blip2, 119) 145 | 146 | BeginTextCommandSetBlipName("STRING") 147 | AddTextComponentString("Enemy Outpost") 148 | EndTextCommandSetBlipName(data.blip2) 149 | 150 | table.insert(banditcamps, data) 151 | end) 152 | 153 | 154 | RegisterNetEvent("LoadCamps") 155 | AddEventHandler("LoadCamps", function(data) 156 | banditcamps = data 157 | end) 158 | 159 | 160 | 161 | RegisterNetEvent("RemoveOldCamp") 162 | AddEventHandler("RemoveOldCamp", function(campid) 163 | for i,camp in pairs(banditcamps) do 164 | if camp.id == campid then 165 | local playerCoords = GetEntityCoords(PlayerPedId(), false) 166 | if #(playerCoords - vector3(camp.coords.x, camp.coords.y, camp.coords.z)) < 100 then 167 | if currentQuest.active then 168 | if Quests[currentQuest.id].finishrequirements.stopCamps and not IsPlayerDead(PlayerId()) then 169 | currentQuest.progress.stopCamps = currentQuest.progress.stopCamps+1 170 | end 171 | end 172 | end 173 | RemoveBlip(camp.blip) 174 | RemoveBlip(camp.blip2) 175 | table.remove(banditcamps,i) 176 | writeLog("camp removed", 1) 177 | end 178 | end 179 | end) 180 | 181 | 182 | -- ped assignment 183 | Citizen.CreateThread(function() 184 | while true do 185 | Wait(1500) 186 | local handle, ped = FindFirstPed() 187 | local finished = false -- FindNextPed will turn the first variable to false when it fails to find another ped in the index 188 | repeat 189 | Wait(20) 190 | if not IsPedAPlayer(ped) and NetworkHasControlOfEntity(ped) and not Entity(ped).state.zombie and not Entity(ped).state.MissionPed then 191 | local ownedByMe = false 192 | local CanNotControl = false 193 | for i,camp in pairs(banditcamps) do 194 | for i,bandit in pairs(camp.peds) do 195 | if ped == bandit then 196 | ownedByMe = true 197 | end 198 | end 199 | end 200 | for i,animal in pairs(animals) do 201 | if ped == animal then 202 | CanNotControl = true 203 | end 204 | end 205 | for i,zombie in pairs(zombies) do 206 | if ped == zombie then 207 | CanNotControl = true 208 | end 209 | end 210 | 211 | if NetworkHasControlOfEntity(ped) and not ownedByMe and not CanNotControl then 212 | TaskGuardCurrentPosition(ped, 35.0, 35.0, 1) 213 | end 214 | end 215 | finished, ped = FindNextPed(handle) -- first param returns true while entities are found 216 | until not finished 217 | EndFindPed(handle) 218 | end 219 | end) 220 | 221 | -------------------------------------------------------------------------------- /client/missions/power_c.lua: -------------------------------------------------------------------------------- 1 | powerareas = { 2 | {disabled = false, name = "Palmer Taylor Power Station", x = 2834.53, y = 1568.78, z = 23.68, heading = 251.64, actionX = 2834.74, actionY = 1568.78, actionZ = 24.00}, 3 | {disabled = false, name = "Power Plant", x = 534.07, y = -1598.01, z = 28.14, heading = 228.47, actionX = 534.02, actionY = -1598.01, actionZ = 29.14}, 4 | } 5 | 6 | repairing = false 7 | time = math.floor(math.random(5, 180)) -- Repair time 8 | cooldown = 0 9 | blackout = true 10 | firstspawn = true 11 | stationIAmRepairing = "" 12 | 13 | Citizen.CreateThread(function() 14 | while true do 15 | Citizen.Wait(0) 16 | if repairing and time > 0 then 17 | Citizen.Wait(1000) 18 | time = time - 1 19 | end 20 | if not repairing and cooldown > 0 then 21 | Citizen.Wait(1000) 22 | cooldown = cooldown - 1 23 | end 24 | end 25 | end) 26 | 27 | Citizen.CreateThread(function() 28 | for k,v in pairs(powerareas) do 29 | blip = AddBlipForCoord(v.x, v.y, v.z) 30 | SetBlipSprite(blip, 402) 31 | SetBlipColour(blip, 1) 32 | BeginTextCommandSetBlipName("STRING") 33 | AddTextComponentString(v.name) 34 | EndTextCommandSetBlipName(blip) 35 | end 36 | while true do 37 | Citizen.Wait(0) 38 | for k,v in pairs(powerareas) do 39 | if blackout and not v.disabled then 40 | DrawMarker(1, v.x, v.y, v.z, 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, 25, 200, 25, 150, false, false, 0, false, 0, 0, false) 41 | end 42 | playerCoords = GetEntityCoords(PlayerPedId(), true) 43 | if #(playerCoords - vector3(v.x, v.y, v.z)) < 2.0 and not repairing and blackout and stationIAmRepairing == "" then 44 | if cooldown == 0 and not v.disabled and not IsPedInAnyVehicle(PlayerPedId(), true) then 45 | HelpText("Press ~INPUT_CONTEXT~ to begin repairing the transformer") 46 | if IsControlJustPressed(1, 51) then -- BEGIN 47 | repairing = true 48 | stationIAmRepairing = v.name 49 | TriggerServerEvent("disableRepairAction", true, stationIAmRepairing) 50 | AddRichPresence("Repairing the Power Station") 51 | end 52 | elseif cooldown > 0 then 53 | HelpText("You must wait ~r~"..cooldown.."~s~ seconds before attempting to repair again") 54 | elseif IsPedInAnyVehicle(PlayerPedId(), true) then 55 | HelpText("You cannot repair the transformer while in a vehicle") 56 | end 57 | end 58 | if repairing and time > 0 and v.name == stationIAmRepairing then 59 | HelpText("Press ~INPUT_VEH_EXIT~ to cancel repair") 60 | DrawMissionText("Hold off the transformer for ~g~"..time.."~s~ Seconds!",200,true) 61 | if IsControlJustPressed(1, 75) and repairing then -- CANCEL 62 | repairing = false 63 | time = math.floor(math.random(60, 180)) 64 | cooldown = 10 65 | ClearPedTasks(PlayerPedId()) 66 | TriggerServerEvent("disableRepairAction", false, stationIAmRepairing) 67 | stationIAmRepairing = "" 68 | end 69 | if not IsPedActiveInScenario(PlayerPedId()) and repairing then 70 | TaskStartScenarioAtPosition(PlayerPedId(), "WORLD_HUMAN_WELDING", v.actionX, v.actionY, v.actionZ, v.heading, 0, false, true) 71 | end 72 | elseif repairing and time == 0 and v.name == stationIAmRepairing then 73 | ClearPedTasks(PlayerPedId()) 74 | HelpText("Successfully repaired the transformer! ~n~Power: ~g~Online~s~!") 75 | TriggerServerEvent("ActivatePower", GetPlayerName(PlayerId()) ) -- Trigger the event to activate power for everyone 76 | Wait(500) 77 | humanity = humanity+100.0 78 | repairing = false 79 | TriggerServerEvent("disableRepairAction", false, stationIAmRepairing) 80 | stationIAmRepairing = "" 81 | end 82 | end 83 | if repairing and GetEntityHealth(PlayerPedId()) <= 0 then 84 | repairing = false 85 | TriggerServerEvent("disableRepairAction", false, stationIAmRepairing) 86 | stationIAmRepairing = "" 87 | ClearPedTasks(PlayerPedId()) 88 | end 89 | end 90 | end) 91 | 92 | RegisterNetEvent("togglePower") 93 | AddEventHandler("togglePower", function(state) 94 | SetBlackout(not state) 95 | blackout = not state 96 | if state == true then 97 | time = 5 98 | else 99 | repairing = false 100 | end 101 | end) 102 | 103 | RegisterNetEvent("disableRepairAction") 104 | AddEventHandler("disableRepairAction", function(disabled, station) 105 | for i,j in pairs(powerareas) do 106 | if j.name == station then 107 | j.disabled = disabled 108 | powerareas[i] = j 109 | break 110 | end 111 | end 112 | end) 113 | 114 | function HelpText(text, state) 115 | SetTextComponentFormat("STRING") 116 | AddTextComponentString(text) 117 | DisplayHelpTextFromStringLabel(0, state, 0, -1) 118 | end 119 | 120 | function DrawMissionText(text,displaytime,drawimmdeiately) 121 | BeginTextCommandPrint("STRING") 122 | AddTextComponentString(text) 123 | EndTextCommandPrint(displaytime,drawimmdeiately) 124 | end 125 | 126 | AddEventHandler('playerSpawned', function(spawn) -- Sync up newcomers so that they see the blackout/no blackout too 127 | if firstspawn then 128 | if blackout then 129 | SetBlackout(true) 130 | else 131 | SetBlackout(false) 132 | end 133 | firstspawn = false 134 | end 135 | if repairing then 136 | repairing = false 137 | TriggerServerEvent("disableRepairAction", false, stationIAmRepairing) 138 | stationIAmRepairing = "" 139 | ClearPedTasks(PlayerPedId()) 140 | end 141 | end) 142 | -------------------------------------------------------------------------------- /client/missions/quests_c.lua: -------------------------------------------------------------------------------- 1 | currentQuest = {} 2 | finishedQuests = {} 3 | -- we will store our progress in there, same structure as "finishrequirements", except that loot will get calculated once you actually get to the trader. 4 | 5 | 6 | function ActivateQuest(id) 7 | if Quests[id] and CanPlayerStartQuest(id) and not IsQuestFinished(id) and not currentQuest.active then 8 | currentQuest.active = true 9 | currentQuest.id = id 10 | currentQuest.progress = {banditkills = 0, herokills = 0, zombiekills = 0, stopCamps = 0} 11 | elseif IsQuestFinished(id) then 12 | TriggerEvent('showNotification', "You have already completed this Quest.") 13 | elseif currentQuest.active then 14 | TriggerEvent('showNotification', "You are already in Quest: "..Quests[currentQuest.id].name) 15 | elseif not CanPlayerStartQuest(id) then 16 | TriggerEvent('showNotification', "You do not meet the requirements to start this Quest.") 17 | end 18 | end 19 | 20 | function CanPlayerStartQuest(id) 21 | if Quests[id] then 22 | local startRequirements = Quests[id].startRequirements 23 | local failedQuest = false 24 | if startRequirements.humanityMin then 25 | if humanity < startRequirements.humanityMin then 26 | failedQuest = true 27 | end 28 | end 29 | if startRequirements.humanityMax then 30 | if humanity > startRequirements.humanityMax then 31 | failedQuest = true 32 | end 33 | end 34 | if startRequirements.zombiekills then 35 | if zombiekills < startRequirements.zombiekills then 36 | failedQuest = true 37 | end 38 | end 39 | if startRequirements.stopCamps then 40 | if stopCamps < startRequirements.stopCamps then 41 | failedQuest = true 42 | end 43 | end 44 | if startRequirements.items then 45 | for i,item in pairs(startRequirements.items) do 46 | if consumableItems.count[item.id] < item.count then 47 | failedQuest = true 48 | end 49 | end 50 | end 51 | 52 | return not failedQuest 53 | end 54 | end 55 | 56 | function IsQuestFinished(id) 57 | for i,quest in ipairs(finishedQuests) do 58 | if quest == id then 59 | return true 60 | end 61 | end 62 | return false 63 | end 64 | 65 | function FinishQuest(id) 66 | if currentQuest.active and currentQuest.id == id then 67 | 68 | 69 | local failedQuest = false 70 | -- check if all requirements are met 71 | local requirements = Quests[id].finishrequirements 72 | if requirements.banditkills and currentQuest.progress.banditkills < requirements.banditkills then 73 | failedQuest = true 74 | elseif requirements.herokills and currentQuest.progress.herokills < requirements.herokills then 75 | failedQuest = true 76 | elseif requirements.zombiekills and currentQuest.progress.zombiekills < requirements.zombiekills then 77 | failedQuest = true 78 | elseif requirements.stopCamps and currentQuest.progress.stopCamps < requirements.stopCamps then 79 | failedQuest = true 80 | end 81 | 82 | if requirements.items then 83 | for i,item in ipairs(requirements.items) do 84 | if consumableItems.count[item.id] < item.count then 85 | failedQuest = true 86 | writeLog(consumableItems[item.id].name.." "..consumableItems.count[item.id], 1) 87 | end 88 | end 89 | end 90 | 91 | if failedQuest then 92 | TriggerEvent('showNotification', "You are not meeting the requirements to finish this Quest.") 93 | return false 94 | else 95 | 96 | if requirements.items then 97 | for i,item in ipairs(requirements.items) do 98 | consumableItems.count[item.id] = math.round(consumableItems.count[item.id]-item.count) 99 | if item.id == 17 then 100 | TriggerServerEvent("AddLegitimateMoney", math.round(-item.count)) 101 | end 102 | if consumableItems[item.id].isWeapon then 103 | RemoveWeaponFromPed(PlayerPedId(), consumableItems[item.id].hash) 104 | end 105 | end 106 | end 107 | 108 | local loot = Quests[id].finishloot 109 | 110 | if loot.humanity then 111 | humanity=humanity+loot.humanity 112 | elseif loot.health then 113 | local newhealth = GetEntityHealth(PlayerPedId()) + loot.health 114 | if newhealth > 200 then 115 | SetEntityHealth(PlayerPedId(), 200.0) 116 | else 117 | SetEntityHealth(PlayerPedId(), newhealth) 118 | end 119 | end 120 | 121 | local pickupString = "You Got:" 122 | for i,item in pairs(loot.loot) do 123 | item.count = math.round(item.count) 124 | consumableItems.count[item.id] = math.round(consumableItems.count[item.id]+item.count) 125 | if item.id == 17 then 126 | TriggerServerEvent("AddLegitimateMoney", item.count) 127 | end 128 | if consumableItems[item.id].isWeapon then 129 | GiveWeaponToPed(PlayerPedId(), consumableItems[item.id].hash, math.round(item.count), false, false) 130 | end 131 | if item.count > 1 and not consumableItems[item.id].isWeapon then 132 | pickupString = pickupString.."\n~g~" .. item.count .." " .. consumableItems[item.id].multipleCase 133 | elseif item.count == 1 and not consumableItems[item.id].isWeapon then 134 | pickupString = pickupString.."\n~g~" .. item.count .." " .. consumableItems[item.id].name 135 | elseif item.count >= 1 and consumableItems[item.id].isWeapon then 136 | pickupString = pickupString.."\n~g~" .. consumableItems[item.id].name .. " (x"..item.count..")" 137 | end 138 | end 139 | for i = 0, #pickupString,100 do 140 | TriggerEvent('showNotification', string.sub(pickupString,i,i+99)) 141 | end 142 | table.insert(finishedQuests,id) 143 | if id == 10 or id == 11 or id == 12 then 144 | local _,_,day = GetUtcTime() 145 | SetResourceKvpInt("quest_day", day) 146 | end 147 | currentQuest = {} 148 | return true 149 | end 150 | else 151 | TriggerEvent('showNotification', "You have no active Quest.") 152 | return false 153 | end 154 | end 155 | 156 | function AbortQuest(id) 157 | if currentQuest.active then 158 | TriggerEvent('showNotification', "Quest Aborted.") 159 | currentQuest = {} 160 | end 161 | end 162 | -------------------------------------------------------------------------------- /client/pingkick.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | Citizen.CreateThread(function() 4 | while true do 5 | Wait(60000) 6 | TriggerServerEvent("CheckMyPing") 7 | end 8 | end) 9 | ]] -------------------------------------------------------------------------------- /client/spawners/animalspawner.lua: -------------------------------------------------------------------------------- 1 | -- animal = animal name 2 | -- flags = 3 | -- 1 = SET_PED_PATH_AVOID_FIRE 4 | -- 2 = SET_PED_PATH_PREFER_TO_AVOID_WATER 5 | -- 3 = BF_CanFightArmedPedsWhenNotArmed 6 | -- 4 = BF_AlwaysFight 7 | -- 5 = BF_PlayerCanUseFiringWeapons 8 | -- 9 | 10 | local animaltable = { 11 | {animal="Mountain Lion", model="a_c_mtlion", flags={1,2,3}, relationship="predator" }, 12 | {animal="Boar", model="a_c_boar", flags={1}, relationship="prey" }, 13 | {animal="Cat", model="a_c_cat_01", flags={1,2,3}, relationship="predatordom" }, 14 | {animal="Chop", model="a_c_chop", flags={3}, relationship="predatordom" }, 15 | {animal="Cormorant", model="a_c_cormorant", flags={1}, relationship="prey" }, 16 | {animal="Cow", model="a_c_cow", flags={1}, relationship="prey"}, 17 | {animal="Coyote", model="a_c_coyote", flags={1,3}, relationship="predator"}, 18 | {animal="Deer", model="a_c_deer", flags={1}, relationship="prey" }, 19 | {animal="Hen", model="a_c_hen", flags={1}, relationship="preydom" }, 20 | {animal="Husky", model="a_c_husky", flags={1,3}, relationship="predatordom" }, 21 | {animal="Pig", model="a_c_pig", flags={1}, relationship="dom" }, 22 | {animal="Pigeon", model="a_c_pigeon", flags={1}, relationship="prey" }, 23 | {animal="Poodle", model="a_c_poodle", flags={1}, relationship="predatordom" }, 24 | {animal="Pug", model="a_c_pug", flags={1}, relationship="prey" }, 25 | {animal="Rabbit", model="a_c_rabbit_01", flags={1}, relationship="prey" }, 26 | {animal="Rat", model="a_c_rat", flags={1}, relationship="prey" }, 27 | {animal="Retriever", model="a_c_retriever", flags={1,3}, relationship="predatordom" }, 28 | {animal="Rottweiler", model="a_c_rottweiler", flags={1,3}, relationship="predatordom" }, 29 | {animal="Seagull", model="a_c_seagull", flags={1,3}, relationship="prey" }, 30 | {animal="Shepherd", model="a_c_shepherd", flags={1,3}, relationship="predatordom" }, 31 | } 32 | 33 | 34 | animals = {} 35 | 36 | 37 | Citizen.CreateThread(function() 38 | AddRelationshipGroup("prey") 39 | AddRelationshipGroup("preydom") 40 | 41 | AddRelationshipGroup("pedator") 42 | AddRelationshipGroup("predatordom") 43 | 44 | SetRelationshipBetweenGroups(5, GetHashKey("zombeez"), GetHashKey("prey")) 45 | SetRelationshipBetweenGroups(5, GetHashKey("zombeez"), GetHashKey("predator")) 46 | SetRelationshipBetweenGroups(5, GetHashKey("predator"), GetHashKey("zombeez")) 47 | 48 | SetRelationshipBetweenGroups(5, GetHashKey("predatordom"), GetHashKey("zombeez")) 49 | SetRelationshipBetweenGroups(1, GetHashKey("predatordom"), GetHashKey("PLAYER")) 50 | SetRelationshipBetweenGroups(1, GetHashKey("PLAYER"), GetHashKey("predatordom")) 51 | SetRelationshipBetweenGroups(5, GetHashKey("zombeez"), GetHashKey("predatordom")) 52 | 53 | SetRelationshipBetweenGroups(5, GetHashKey("zombeez"), GetHashKey("preydom")) 54 | 55 | SetRelationshipBetweenGroups(255, GetHashKey("prey"), GetHashKey("PLAYER")) 56 | SetRelationshipBetweenGroups(4, GetHashKey("predator"), GetHashKey("PLAYER")) 57 | SetRelationshipBetweenGroups(4, GetHashKey("PLAYER"), GetHashKey("predator")) 58 | 59 | 60 | while true do 61 | Wait(100) 62 | local x, y, z = table.unpack(GetEntityCoords(PlayerPedId(), true)) 63 | local pedAmount = zombieZones[ GetNameOfZone(x,y,z) ] 64 | if type(pedAmount) ~= "number" then 65 | pedAmount = 1 66 | end 67 | animalAmount = pedAmount 68 | local pedAmount = math.round(pedAmount/6) 69 | if not isPlayerInSafezone and #animals < pedAmount then 70 | 71 | choosenAnimalTable = animaltable[math.random(1, #animaltable)] 72 | choosenAnimal = string.upper(choosenAnimalTable.model) 73 | RequestModel(choosenAnimal) 74 | while not HasModelLoaded(choosenAnimal) do 75 | Wait(500) 76 | end 77 | 78 | local newX = x 79 | local newY = y 80 | local newZ = z + 999.0 81 | 82 | repeat 83 | Wait(100) 84 | 85 | newX = x + math.random(-400, 400) 86 | newY = y + math.random(-400 , 400) 87 | _,newZ = GetGroundZFor_3dCoord(newX+.0,newY+.0,z, 1) 88 | 89 | for _, player in pairs(players) do 90 | Wait(10) 91 | playerX, playerY = table.unpack(GetEntityCoords(GetPlayerPed(-1), true)) 92 | if newX > playerX - 35 and newX < playerX + 35 or newY > playerY - 35 and newY < playerY + 35 then 93 | canSpawn = false 94 | break 95 | else 96 | canSpawn = true 97 | end 98 | end 99 | until canSpawn 100 | ped = CreatePed(4, choosenAnimal, newX, newY, newZ, 0.0, true, false) 101 | Entity(ped).state:set("C8pE53jw", true, true) 102 | 103 | for i,theFlag in ipairs(choosenAnimalTable.flags) do 104 | 105 | if theFlag == 1 then 106 | SetPedPathAvoidFire(ped, true) 107 | elseif theFlag == 2 then 108 | SetPedPathPreferToAvoidWater(ped, true) 109 | elseif theFlag == 3 then 110 | SetPedCombatAttributes(ped, 5, true) 111 | elseif theFlag == 4 then 112 | SetPedCombatAttributes(ped, 46, true) 113 | elseif theFlag == 5 then 114 | SetPedCombatAttributes(ped, 1424, true) 115 | end 116 | end 117 | SetPedRelationshipGroupDefaultHash(ped, choosenAnimalTable.relationship) 118 | SetPedRelationshipGroupHash(ped, choosenAnimalTable.relationship) 119 | 120 | TaskWanderStandard(ped, 10.0, 10) 121 | 122 | if not NetworkGetEntityIsNetworked(ped) then 123 | NetworkRegisterEntityAsNetworked(ped) 124 | end 125 | 126 | table.insert(animals, ped) 127 | end 128 | 129 | for i, ped in pairs(animals) do 130 | if DoesEntityExist(ped) == false then 131 | table.remove(animals, i) 132 | end 133 | pedX, pedY, pedZ = table.unpack(GetEntityCoords(ped, true)) 134 | if IsPedDeadOrDying(ped, 1) == 1 then 135 | -- Set ped as no longer needed for despawning 136 | SetEntityAsNoLongerNeeded(ped) 137 | table.remove(animals, i) 138 | else 139 | playerX, playerY = table.unpack(GetEntityCoords(GetPlayerPed(-1), true)) 140 | 141 | if pedX < playerX - 500 or pedX > playerX + 500 or pedY < playerY - 500 or pedY > playerY + 500 then 142 | -- Set ped as no longer needed for despawning 143 | local model = GetEntityModel(ped) 144 | SetEntityAsNoLongerNeeded(ped) 145 | SetModelAsNoLongerNeeded(model) 146 | table.remove(animals, i) 147 | end 148 | end 149 | end 150 | end 151 | end) 152 | 153 | 154 | -- ped assignment 155 | Citizen.CreateThread(function() 156 | while true do 157 | Wait(1500) 158 | local handle, ped = FindFirstPed() 159 | local finished = false -- FindNextPed will turn the first variable to false when it fails to find another ped in the index 160 | repeat 161 | Wait(20) 162 | if not IsPedAPlayer(ped) and NetworkHasControlOfEntity(ped) and GetPedType(ped) == 28 then 163 | local ownedByMe = false 164 | local CanNotControl = false 165 | for i,animal in pairs(animals) do 166 | if ped == animal then 167 | ownedByMe = true 168 | end 169 | end 170 | for i,bandit in pairs(bandits) do 171 | if ped == bandit then 172 | CanNotControl = true 173 | end 174 | end 175 | for i,zombie in pairs(zombies) do 176 | if ped == zombie then 177 | CanNotControl = true 178 | end 179 | end 180 | 181 | if NetworkHasControlOfEntity(ped) and not ownedByMe and not CanNotControl then 182 | DeleteEntity(ped) -- delete entity as fuck reassigning this one 183 | end 184 | end 185 | finished, ped = FindNextPed(handle) -- first param returns true while entities are found 186 | until not finished 187 | EndFindPed(handle) 188 | end 189 | end) -------------------------------------------------------------------------------- /client/spawners/carspawner.lua: -------------------------------------------------------------------------------- 1 | RegisterNetEvent("spawnNewVehicle") 2 | 3 | cars = {} 4 | 5 | Citizen.CreateThread(function() 6 | while true do 7 | Wait(1) 8 | 9 | --[[ 10 | if #cars < 2 then 11 | x, y, z = table.unpack(GetEntityCoords(PlayerPedId(), true)) 12 | 13 | local newVehicleX = x 14 | local NewVehicleY = y 15 | local NewVehicleZ = 0 16 | 17 | repeat 18 | Wait(1) 19 | newVehicleX = x + math.random(-1000, 1000) 20 | NewVehicleY = y + math.random(-1000, 1000) 21 | _,NewVehicleZ = GetGroundZFor_3dCoord(newVehicleX+.0,NewVehicleY+.0,z+999.0, 1) 22 | until NewVehicleZ ~= 0 23 | 24 | choosenCar = spawnableCars[carChances[ math.random( #carChances ) ] ].model 25 | RequestModel(choosenCar) 26 | while not HasModelLoaded(choosenCar) or not HasCollisionForModelLoaded(choosenCar) do 27 | Wait(200) 28 | end 29 | 30 | car = CreateVehicle(choosenCar, newVehicleX, NewVehicleY, NewVehicleZ, math.random(0,360)+.0, true, false) 31 | DecorSetBool(car, "C8pE53jw", true) 32 | SetVehicleFuelLevel(car, math.random() + math.random(10, 80)) 33 | SetVehicleEngineHealth(car, math.random(400,1000)+0.0) 34 | PlaceObjectOnGroundProperly(car) 35 | if not NetworkGetEntityIsNetworked(car) then 36 | NetworkRegisterEntityAsNetworked(car) 37 | end 38 | TriggerServerEvent("registerNewVehicle", NetworkGetNetworkIdFromEntity(car)) 39 | Wait(5000) 40 | end 41 | 42 | 43 | for i, car in pairs(cars) do 44 | if GetEntityHealth(car.id) < 10.0 then 45 | SetEntityAsNoLongerNeeded(car.localid) 46 | writeLog("\ndeleting car", 1) 47 | TriggerServerEvent("removeOldVehicle", car.id) 48 | Wait(5000) 49 | end 50 | end 51 | --]] 52 | end 53 | end) 54 | 55 | 56 | function GenerateRandomVehicle(maxVehicles) 57 | if #cars < maxVehicles then --make sure we dont spawn too many cars for some reason 58 | x, y, z = table.unpack(GetEntityCoords(PlayerPedId(), true)) 59 | 60 | local newVehicleX = x 61 | local NewVehicleY = y 62 | local NewVehicleZ = 0 63 | 64 | repeat 65 | newVehicleX = x + math.random(-1000, 1000) 66 | NewVehicleY = y + math.random(-1000, 1000) 67 | RequestCollisionAtCoord(newVehicleX, NewVehicleY, z) 68 | Wait(500) 69 | _,NewVehicleZ = GetGroundZFor_3dCoord(newVehicleX+.0,NewVehicleY+.0,z+999.0, 1) 70 | until NewVehicleZ ~= 0 71 | 72 | choosenCar = spawnableCars[carChances[ math.random( #carChances ) ]].model 73 | RequestModel(choosenCar) 74 | while not HasModelLoaded(choosenCar) or not HasCollisionForModelLoaded(choosenCar) do 75 | Wait(200) 76 | end 77 | 78 | car = CreateVehicle(choosenCar, newVehicleX, NewVehicleY, NewVehicleZ, math.random(0,360)+.0, true, false) 79 | Entity(car).state:set("C8pE53jw", true, true) 80 | SetVehicleFuelLevel(car, math.random() + math.random(10, 80)) 81 | SetVehicleEngineHealth(car, math.random(300,1000)+0.0) 82 | PlaceObjectOnGroundProperly(car) 83 | Wait(500) 84 | if not NetworkGetEntityIsNetworked(car) then 85 | NetworkRegisterEntityAsNetworked(car) 86 | Wait(500) 87 | end 88 | 89 | TriggerServerEvent("registerNewVehicle", NetworkGetNetworkIdFromEntity(car)) 90 | writeLog("\nGenerated New Car, NetId: "..NetworkGetNetworkIdFromEntity(car), 1) 91 | end 92 | end 93 | RegisterNetEvent("GenerateRandomVehicle") 94 | AddEventHandler("GenerateRandomVehicle", GenerateRandomVehicle) 95 | 96 | function isVehicleLocal(vehid) 97 | for i, car in ipairs(cars) do 98 | if car.id == vehid then 99 | return true 100 | end 101 | end 102 | return false 103 | end 104 | 105 | function isVehicleUsable(veh) 106 | if not DoesEntityExist(veh) then 107 | return false 108 | elseif GetEntityHealth(veh) < 10.0 then 109 | return false 110 | end 111 | return IsVehicleDriveable(veh, 0) 112 | end 113 | 114 | RegisterNetEvent("vehiclePoll") 115 | AddEventHandler("vehiclePoll", function() 116 | local pollcars = {} 117 | for i, car in ipairs(cars) do 118 | local t = {id = car.id, exists = isVehicleUsable(car.localid)} 119 | table.insert(pollcars, t) 120 | end 121 | TriggerServerEvent("vehiclePoll", pollcars) 122 | end) 123 | 124 | RegisterNetEvent("registerNewVehicle") 125 | AddEventHandler("registerNewVehicle", function(veh) 126 | -- {netid = netid, id = #spawnedCars+1} 127 | veh.localid = NetworkGetEntityFromNetworkId(veh.netid) 128 | table.insert(cars, veh ) 129 | end) 130 | 131 | RegisterNetEvent("removedOldVehicle") 132 | AddEventHandler("removedOldVehicle", function(veh) 133 | for i, car in ipairs(cars) do 134 | if car.id == veh then 135 | if DoesEntityExist(car.localid) then 136 | DeleteEntity(car.localid) 137 | end 138 | table.remove(cars,i) 139 | break 140 | end 141 | end 142 | end) 143 | 144 | function GetVehicleFromServerId(serverid) 145 | for i,car in ipairs(cars) do 146 | if car.id == serverid then 147 | return car.localid 148 | end 149 | end 150 | return false 151 | end 152 | 153 | --[[ 154 | 155 | Citizen.CreateThread(function() 156 | while true do 157 | Citizen.Wait(0) 158 | for i, car in pairs(cars) do 159 | c = car.localid 160 | playerX, playerY, playerZ = table.unpack(GetEntityCoords(PlayerPedId(), true)) 161 | carX, carY, carZ = table.unpack(GetEntityCoords(c, false)) 162 | DrawLine(playerX,playerY, playerZ, carX, carY, carZ, 255.0,0.0,0.0,255.0) 163 | 164 | SetTextScale(0.2, 0.2) 165 | SetTextFont(0) 166 | SetTextProportional(1) 167 | -- SetTextScale(0.0, 0.55) 168 | SetTextColour(255, 255, 255, 255) 169 | SetTextDropshadow(0, 0, 0, 0, 55) 170 | SetTextEdge(2, 0, 0, 0, 150) 171 | SetTextDropShadow() 172 | SetTextOutline() 173 | SetTextEntry("STRING") 174 | SetTextCentre(1) 175 | AddTextComponentString("CAR INFO: \nHP:"..GetEntityHealth(c).. " \nENG:"..GetVehicleEngineHealth(c).." \nNETID:".. car.netid) 176 | local _,screenx,screeny = World3dToScreen2d(carX,carY,carZ) 177 | DrawText(screenx,screeny) 178 | end 179 | end 180 | end) 181 | 182 | ]] 183 | 184 | RegisterNetEvent("Z:cleanup") 185 | AddEventHandler("Z:cleanup", function() 186 | for i, car in pairs(cars) do 187 | -- Set car as no longer needed for despawning 188 | SetEntityAsNoLongerNeeded(car.localid) 189 | end 190 | cars = {} 191 | end) 192 | 193 | RegisterNetEvent("loadVehicles") 194 | AddEventHandler("loadVehicles", function(servercars) 195 | for i,veh in pairs(servercars) do 196 | veh.localid = NetworkGetEntityFromNetworkId(veh.netid) 197 | table.insert(cars, veh) 198 | end 199 | end) -------------------------------------------------------------------------------- /client/useful/exports.lua: -------------------------------------------------------------------------------- 1 | function isPlayerInfected() 2 | return infected 3 | end 4 | 5 | function isPlayerPossessed() 6 | return possessed 7 | end 8 | 9 | 10 | function GetPlayerUniqueId() 11 | return PlayerUniqueId 12 | end -------------------------------------------------------------------------------- /client/useful/killplayer.lua: -------------------------------------------------------------------------------- 1 | RegisterNetEvent("Z:killplayer") 2 | 3 | AddEventHandler("Z:killplayer", function() 4 | SetEntityHealth(PlayerPedId(), 1) 5 | end) -------------------------------------------------------------------------------- /client/useful/scaleform_wrapper.lua: -------------------------------------------------------------------------------- 1 | Scaleform = {} 2 | 3 | local scaleform = {} 4 | scaleform.__index = scaleform 5 | 6 | function Scaleform.Request(Name) 7 | local ScaleformHandle = RequestScaleformMovie(Name) 8 | while not HasScaleformMovieLoaded(ScaleformHandle) do Citizen.Wait(0) end 9 | local data = {name = Name, handle = ScaleformHandle} 10 | return setmetatable(data, scaleform) 11 | end 12 | 13 | function scaleform:CallFunction(theFunction, ...) 14 | BeginScaleformMovieMethod(self.handle, theFunction) 15 | local arg = {...} 16 | if arg ~= nil then 17 | for i=1,#arg do 18 | local sType = type(arg[i]) 19 | if sType == "boolean" then 20 | PushScaleformMovieMethodParameterBool(arg[i]) 21 | elseif sType == "number" then 22 | if math.type(arg[i]) == "integer" then 23 | PushScaleformMovieMethodParameterInt(arg[i]) 24 | else 25 | PushScaleformMovieMethodParameterFloat(arg[i]) 26 | end 27 | elseif sType == "string" then 28 | PushScaleformMovieMethodParameterString(arg[i]) 29 | else 30 | PushScaleformMovieMethodParameterInt() 31 | end 32 | end 33 | end 34 | EndScaleformMovieMethod() 35 | end 36 | 37 | function scaleform:CallFunctionReturn(theFunction, ...) 38 | BeginScaleformMovieMethod(self.handle, theFunction) 39 | local arg = {...} 40 | if arg ~= nil then 41 | for i=1,#arg do 42 | local sType = type(arg[i]) 43 | if sType == "boolean" then 44 | PushScaleformMovieMethodParameterBool(arg[i]) 45 | elseif sType == "number" then 46 | if math.type(arg[i]) == "integer" then 47 | PushScaleformMovieMethodParameterInt(arg[i]) 48 | else 49 | PushScaleformMovieMethodParameterFloat(arg[i]) 50 | end 51 | elseif sType == "string" then 52 | PushScaleformMovieMethodParameterString(arg[i]) 53 | else 54 | PushScaleformMovieMethodParameterInt() 55 | end 56 | end 57 | end 58 | return EndScaleformMovieMethodReturn() 59 | end 60 | 61 | function scaleform:Draw2D() 62 | DrawScaleformMovieFullscreen(self.handle, 255, 255, 255, 255) 63 | end 64 | 65 | function scaleform:Draw2DNormal(x, y, width, height) 66 | DrawScaleformMovie(self.handle, x, y, width, height, 255, 255, 255, 255) 67 | end 68 | 69 | function scaleform:Draw2DScreenSpace(locx, locy, sizex, sizey) 70 | local Width, Height = GetScreenResolution() 71 | local x = locy / Width 72 | local y = locx / Height 73 | local width = sizex / Width 74 | local height = sizey / Height 75 | DrawScaleformMovie(self.handle, x + (width / 2.0), y + (height / 2.0), width, height, 255, 255, 255, 255) 76 | end 77 | 78 | function scaleform:Render3D(pos, rot, scalex, scaley, scalez) 79 | DrawScaleformMovie_3dNonAdditive(self.handle, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, 2.0, 2.0, 1.0, scalex, scaley, scalez, 2) 80 | end 81 | 82 | function scaleform:Render3DAdditive(pos, rot, scalex, scaley, scalez) 83 | DrawScaleformMovie_3d(self.handle, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, 2.0, 2.0, 1.0, scalex, scaley, scalez, 2) 84 | end 85 | 86 | function scaleform:Dispose() 87 | SetScaleformMovieAsNoLongerNeeded(self.handle) 88 | self = nil 89 | end 90 | 91 | function scaleform:IsValid() 92 | return self and true or false 93 | end -------------------------------------------------------------------------------- /client/useful/util.lua: -------------------------------------------------------------------------------- 1 | function DrawText3D(x, y, z, text) 2 | SetDrawOrigin(x, y, z, 0); 3 | SetTextFont(0) 4 | SetTextProportional(0) 5 | SetTextScale(0.0, 0.2) 6 | SetTextColour(19, 232, 46, 240) 7 | SetTextDropshadow(0, 0, 0, 0, 255) 8 | SetTextEdge(2, 0, 0, 0, 150) 9 | SetTextDropShadow() 10 | SetTextOutline() 11 | SetTextEntry("STRING") 12 | SetTextCentre(1) 13 | AddTextComponentString(text) 14 | DrawText(0.0, 0.0) 15 | ClearDrawOrigin() 16 | end 17 | 18 | players = {} -- global players table 19 | 20 | RegisterNetEvent("Z:playerUpdate") 21 | AddEventHandler("Z:playerUpdate", function(mPlayers) 22 | players = mPlayers 23 | end) 24 | 25 | Citizen.CreateThread(function() 26 | function CreateAwaitedKeyboardInput(textentry,title,maxLen,c,d,e) 27 | if title then 28 | AddTextEntry(textentry, title) 29 | end 30 | DisplayOnscreenKeyboard(1, textentry, "", "", "", "", "", maxLen) 31 | 32 | local kbupdate = UpdateOnscreenKeyboard() 33 | 34 | while kbupdate ~= 1 and kbupdate~= 2 do 35 | kbupdate =UpdateOnscreenKeyboard() 36 | Citizen.Wait( 0 ) 37 | end 38 | 39 | local result = GetOnscreenKeyboardResult() 40 | return result, kbupdate -- return kbupdate to possibly prevent "cancellation" from causing problems 41 | end 42 | end) 43 | 44 | function GetPlayers() 45 | local players = {} 46 | 47 | for i = 0, 255 do 48 | if NetworkIsPlayerActive(i) then 49 | table.insert(players, i) 50 | end 51 | end 52 | return players 53 | end 54 | 55 | 56 | function GetPlayersInRadius(radius) 57 | local plist = GetPlayers() 58 | local pamount = 0 59 | local localx,localy,localz = table.unpack(GetEntityCoords(PlayerPedId(), true)) 60 | for _,player in pairs(plist) do 61 | local pedx,pedy,pedz = table.unpack(GetEntityCoords(GetPlayerPed(player), true)) 62 | if #(vector3(localx, localy, localz) - vector3(pedx,pedy,pedz)) < (radius or 300) then 63 | pamount=pamount+1 64 | end 65 | end 66 | return pamount 67 | end 68 | 69 | function table.val_to_str ( v ) 70 | if "string" == type( v ) then 71 | v = string.gsub( v, "\n", "\\n" ) 72 | if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then 73 | return "'" .. v .. "'" 74 | end 75 | return '"' .. string.gsub(v,'"', '\\"' ) .. '"' 76 | else 77 | return "table" == type( v ) and table.tostring( v ) or 78 | tostring( v ) 79 | end 80 | end 81 | 82 | function table.key_to_str ( k ) 83 | if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then 84 | return k 85 | else 86 | return "[" .. table.val_to_str( k ) .. "]" 87 | end 88 | end 89 | 90 | function table.tostring( tbl ) 91 | local result, done = {}, {} 92 | for k, v in ipairs( tbl ) do 93 | table.insert( result, table.val_to_str( v ) ) 94 | done[ k ] = true 95 | end 96 | 97 | for k, v in pairs( tbl ) do 98 | if not done[ k ] then 99 | table.insert( result, 100 | table.key_to_str( k ) .. "=" .. table.val_to_str( v ) ) 101 | end 102 | end 103 | return "{" .. table.concat( result, "," ) .. "}" 104 | end -------------------------------------------------------------------------------- /client/web/playsound.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 27 | 28 | -------------------------------------------------------------------------------- /config/config.lua: -------------------------------------------------------------------------------- 1 | -- define config 2 | config = {} 3 | 4 | -- find item IDs in shared/inventory/items.lua 5 | config.startItems = { 6 | [1]=1, 7 | [2]=1, 8 | } 9 | 10 | -- Start Money, don't set this too high, or the Anticheat will kick in. 11 | config.startMoney = 0 12 | 13 | -- how many vehicles can spawn, as a total. 14 | config.maxVehicles = 60 15 | 16 | -- How many Food items can be spawned, per player. 17 | config.maxSpawnedFood = 6 18 | 19 | -- How many Weapon Items can be spawned, per player. 20 | config.maxSpawnedWeapons = 4 21 | 22 | -- Skin Types for different humanity levels. 23 | config.skins = { 24 | hero = "s_m_m_chemsec_01", 25 | neutral = "s_m_y_armymech_01", 26 | bandit = "s_m_y_xmech_02" 27 | } 28 | 29 | -- Amount of kills needed to become "hunted" 30 | config.huntedAmount = 5 31 | 32 | -- Weither or not to disable the weapon reticle 33 | config.disableReticle = true 34 | 35 | -- Do we want DynoWeather? 36 | config.enableDynoWeather = true 37 | 38 | -- Do we want Discord Rich Presence 39 | config.enabledrp = false 40 | config.appid = 0 --https://discord.com/developers/applications 41 | 42 | -- Time in Days, how long should it take for safes to expire if they haven't been opened? 43 | config.SafeExpirationTime = 7 44 | 45 | -- How many days the server should unlock the safes for, until it gets deleted ( added ONTOP of SafeExpirationTime ) 46 | config.SafeUnlockTime = 1 47 | 48 | config.LogLevel = 0 -- 0 = Errors Only, 1 = Verbose 49 | -------------------------------------------------------------------------------- /database.sql: -------------------------------------------------------------------------------- 1 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 2 | 3 | SET AUTOCOMMIT = 0; 4 | 5 | START TRANSACTION; 6 | SET time_zone = "+00:00"; 7 | 8 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 9 | 10 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 11 | 12 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 13 | 14 | CREATE TABLE `players` ( 15 | `ids` int(10) UNSIGNED NOT NULL, 16 | `name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, 17 | `steamid` varchar(300) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL, 18 | `license` varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL, 19 | `discord` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL, 20 | `x` text CHARACTER SET latin1 COLLATE latin1_swedish_ci, 21 | `y` text CHARACTER SET latin1 COLLATE latin1_swedish_ci, 22 | `z` text CHARACTER SET latin1 COLLATE latin1_swedish_ci, 23 | `hunger` float NOT NULL DEFAULT '100', 24 | `thirst` float NOT NULL DEFAULT '100', 25 | `inv` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL, 26 | `health` bigint(20) NOT NULL DEFAULT '200', 27 | `playerkillsthislife` bigint(20) DEFAULT '0', 28 | `zombiekillsthislife` bigint(20) NOT NULL DEFAULT '0', 29 | `playerkills` bigint(20) NOT NULL DEFAULT '0', 30 | `zombiekills` bigint(20) NOT NULL DEFAULT '0', 31 | `humanity` bigint(20) NOT NULL DEFAULT '500', 32 | `infected` varchar(8) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'false', 33 | `money` bigint(20) NOT NULL DEFAULT '0', 34 | `locker_money` int(11) NOT NULL DEFAULT '0', 35 | `wheelspins` int(11) DEFAULT '0', 36 | `playtime` varchar(32) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '0:0', 37 | `currentQuest` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL, 38 | `finishedQuests` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL, 39 | `customskin` char(65) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' 40 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPACT; 41 | 42 | CREATE TABLE `safes` ( 43 | `id` int(11) NOT NULL, 44 | `inv` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, 45 | `creationTime` text CHARACTER SET latin1 COLLATE latin1_swedish_ci, 46 | `owner` text CHARACTER SET latin1 COLLATE latin1_swedish_ci, 47 | `passcode` varchar(4) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT '0000', 48 | `x` text CHARACTER SET latin1 COLLATE latin1_swedish_ci, 49 | `y` text CHARACTER SET latin1 COLLATE latin1_swedish_ci, 50 | `z` text CHARACTER SET latin1 COLLATE latin1_swedish_ci, 51 | `r` text CHARACTER SET latin1 COLLATE latin1_swedish_ci 52 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPACT; 53 | 54 | ALTER TABLE `players` 55 | ADD PRIMARY KEY (`ids`), 56 | ADD UNIQUE KEY `ids` (`ids`), 57 | ADD KEY `steamid` (`steamid`), 58 | ADD KEY `discord` (`discord`); 59 | 60 | ALTER TABLE `safes` 61 | ADD UNIQUE KEY `id` (`id`); 62 | 63 | ALTER TABLE `players` 64 | MODIFY `ids` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=744895; 65 | 66 | ALTER TABLE `safes` 67 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1222; 68 | 69 | 70 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 71 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 72 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 73 | 74 | -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | games { 'gta5' } 3 | dependency 'oxmysql' 4 | dependency 'pogressBar' 5 | 6 | shared_scripts { 7 | "config/config.lua", 8 | "shared/**.lua" 9 | } 10 | 11 | server_scripts { 12 | "@oxmysql/lib/MySQL.lua", 13 | "server/**.lua" 14 | } 15 | 16 | client_scripts { 17 | "client/**.lua" 18 | } 19 | 20 | resource_type 'map' { gameTypes = { ['basic-gamemode'] = true } } 21 | map 'map.lua' 22 | 23 | --[[ 24 | ui_page('client/web/playsound.html') 25 | files({ 26 | 'client/web/cb1_on.ogg', 27 | 'client/web/cb1_off.ogg', 28 | 'client/web/cb2_on.ogg', 29 | 'client/web/cb2_off.ogg', 30 | 'client/web/cb3_on.ogg', 31 | 'client/web/cb3_off.ogg', 32 | }) 33 | ]] 34 | exports { 35 | 'isPlayerInfected', 36 | 'GetPlayerUniqueId', 37 | 'GetHighestVoiceProximity', 38 | 'DoesPlayerHaveCBRadio', 39 | 'GetPlayerCurrentRadioData' 40 | } 41 | 42 | files { 43 | 'stream/def_props.ytyp' 44 | } 45 | 46 | data_file 'DLC_ITYP_REQUEST' 'stream/def_props.ytyp' 47 | 48 | loadscreen_manual_shutdown 'yes' 49 | -------------------------------------------------------------------------------- /map.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | spawnpoint 'random' { x = -68.113265991211, y = 6312.3955078125, z = 1031.302978515625} 4 | spawnpoint 'random' { x = -845.99456787109, y = -1028.9202880859, z = 1012.493828773499} 5 | spawnpoint 'random' { x = 341.16436767578, y = -429.74771118164, z = 1044.443321228027} 6 | spawnpoint 'random' { x = -1034.0723876953, y = -564.31909179688, z = 1054.91204833984} 7 | spawnpoint 'random' { x = -2178.1726074219, y = 354.1813659668, z = 1089.19964599609} 8 | spawnpoint 'random' { x = -1857.1040039063, y = 2904.8295898438, z = 1058.78713989258} 9 | spawnpoint 'random' { x = 1025.9948730469, y = 2592.3962402344, z = 1082.84854125977} 10 | spawnpoint 'random' { x = 1866.3579101563, y = 3708.2141113281, z = 1010.45379638672} 11 | spawnpoint 'random' { x = 2038.3901367188, y = 4749.3818359375, z = 1017.90783691406} 12 | spawnpoint 'random' { x = -1472.2982177734, y = 2010.4838867188, z = 1065.43569946289} 13 | spawnpoint 'random' { x = -1652.764038086, y = 998.6650390625, z = 1051.96047973632} 14 | spawnpoint 'random' { x = -1100.451538086, y = 1144.889038086, z = 1011.87991333008} 15 | spawnpoint 'random' { x = -369.27606201172, y = 948.32733154296, z = 1032.7440032959} 16 | spawnpoint 'random' { x = 2806.9106445312, y = 4430.646484375, z = 1048.138259887696} 17 | spawnpoint 'random' { x = 2543.7685546875, y = 2070.9477539062, z = 1019.761896133422} 18 | spawnpoint 'random' { x = -1302.7845458984, y = 736.19970703125, z = 1009.77642822266} 19 | spawnpoint 'random' { x = -267.30654907226, y = 1261.0859375, z = 1030.90878295898} 20 | spawnpoint 'random' { x = 183.33595275878, y = 1317.1964111328, z = 1055.34965515136} 21 | spawnpoint 'random' { x = 2395.7678222656, y = 3358.3752441406, z = 1080.4898071289} 22 | spawnpoint 'random' { x = -1536.1928710938, y = 4955.1586914062, z = 1000.035934448242} 23 | spawnpoint 'random' { x = -219.85664367676, y = -918.7925415039, z = 1031.990562438964} 24 | 25 | --]] 26 | -- we dont need those atm as they break spawnmanager 27 | 28 | 29 | spawnpoint 's_m_y_armymech_01' { x = -68.113265991211, y = 6312.3955078125, z = 1031.302978515625} 30 | spawnpoint 's_m_y_armymech_01' { x = -845.99456787109, y = -1028.9202880859, z = 1012.493828773499} 31 | spawnpoint 's_m_y_armymech_01' { x = 341.16436767578, y = -429.74771118164, z = 1044.443321228027} 32 | spawnpoint 's_m_y_armymech_01' { x = -1034.0723876953, y = -564.31909179688, z = 1054.91204833984} 33 | spawnpoint 's_m_y_armymech_01' { x = -2178.1726074219, y = 354.1813659668, z = 1089.19964599609} 34 | spawnpoint 's_m_y_armymech_01' { x = -1857.1040039063, y = 2904.8295898438, z = 1058.78713989258} 35 | spawnpoint 's_m_y_armymech_01' { x = 1025.9948730469, y = 2592.3962402344, z = 1082.84854125977} 36 | spawnpoint 's_m_y_armymech_01' { x = 1866.3579101563, y = 3708.2141113281, z = 1010.45379638672} 37 | spawnpoint 's_m_y_armymech_01' { x = 2038.3901367188, y = 4749.3818359375, z = 1017.90783691406} 38 | spawnpoint 's_m_y_armymech_01' { x = -1472.2982177734, y = 2010.4838867188, z = 1065.43569946289} 39 | spawnpoint 's_m_y_armymech_01' { x = -1652.764038086, y = 998.6650390625, z = 1051.96047973632} 40 | spawnpoint 's_m_y_armymech_01' { x = -1100.451538086, y = 1144.889038086, z = 1011.87991333008} 41 | spawnpoint 's_m_y_armymech_01' { x = -369.27606201172, y = 948.32733154296, z = 1032.7440032959} 42 | spawnpoint 's_m_y_armymech_01' { x = 2806.9106445312, y = 4430.646484375, z = 1048.138259887696} 43 | spawnpoint 's_m_y_armymech_01' { x = 2543.7685546875, y = 2070.9477539062, z = 1019.761896133422} 44 | spawnpoint 's_m_y_armymech_01' { x = -1302.7845458984, y = 736.19970703125, z = 1009.77642822266} 45 | spawnpoint 's_m_y_armymech_01' { x = -267.30654907226, y = 1261.0859375, z = 1030.90878295898} 46 | spawnpoint 's_m_y_armymech_01' { x = 183.33595275878, y = 1317.1964111328, z = 1055.34965515136} 47 | spawnpoint 's_m_y_armymech_01' { x = 2395.7678222656, y = 3358.3752441406, z = 1080.4898071289} 48 | spawnpoint 's_m_y_armymech_01' { x = -1536.1928710938, y = 4955.1586914062, z = 1000.035934448242} 49 | spawnpoint 's_m_y_armymech_01' { x = -219.85664367676, y = -918.7925415039, z = 1031.990562438964} 50 | spawnpoint 's_m_y_armymech_01' { x = -1279.59, y = -1647.43, z = 1031.990562438964} 51 | spawnpoint 's_m_y_armymech_01' { x = 817, y = -2456, z = 1031.990562438964} 52 | spawnpoint 's_m_y_armymech_01' { x = 929, y = -1183, z = 1031.990562438964} 53 | spawnpoint 's_m_y_armymech_01' { x = 990, y = 693, z = 1031.990562438964} 54 | spawnpoint 's_m_y_armymech_01' { x = 2274, y = -1374, z = 1031.990562438964} 55 | spawnpoint 's_m_y_armymech_01' { x = 977, y = 2141, z = 1031.990562438964} 56 | spawnpoint 's_m_y_armymech_01' { x = -1036, y = 1056, z = 1031.990562438964} 57 | spawnpoint 's_m_y_armymech_01' { x = -855, y = -1033, z = 1031.990562438964} 58 | spawnpoint 's_m_y_armymech_01' { x = 245, y = -1547, z = 1031.990562438964} 59 | spawnpoint 's_m_y_armymech_01' { x = 461, y = 19.32, z = 1031.990562438964} 60 | spawnpoint 's_m_y_armymech_01' { x = 233, y = 3301, z = 1031.990562438964} 61 | spawnpoint 's_m_y_armymech_01' { x = 333, y = 2290, z = 1031.990562438964} 62 | -------------------------------------------------------------------------------- /server/db/dbServerSafes.lua: -------------------------------------------------------------------------------- 1 | safes = {} 2 | 3 | 4 | 5 | RegisterServerEvent('createSafe') 6 | RegisterServerEvent('CreateCustomSafe') 7 | RegisterServerEvent('requestSafes') 8 | RegisterServerEvent('removeSafe') 9 | RegisterServerEvent('GetSafeContents') 10 | RegisterServerEvent('SetSafeContents') 11 | RegisterServerEvent('updateSafe') 12 | RegisterServerEvent("ExitSafe") 13 | RegisterServerEvent("Z:newplayerID") 14 | 15 | 16 | Citizen.CreateThread(function() 17 | 18 | function updateAllSafes() 19 | writeLog("\nUpdating all Safes...", 0) 20 | safes = {} 21 | Wait(500) 22 | if not TESTMODE then 23 | MySQL.query('SELECT * FROM safes', {}, function(data) 24 | for i,theSafe in pairs(data) do 25 | Citizen.Wait(10) 26 | theSafe.x = tonumber(theSafe.x) 27 | theSafe.y = tonumber(theSafe.y) 28 | theSafe.z = tonumber(theSafe.z) 29 | theSafe.r = tonumber(theSafe.r) 30 | theSafe.in_use = false 31 | theSafe.usageTime = 0 32 | theSafe.permanent = true 33 | local tempinv = json.decode(theSafe.inv) 34 | theSafe.inv = {} 35 | for i, item in pairs(tempinv) do 36 | if item.id and theSafe.inv[item.id] then 37 | theSafe.inv[item.id].count = theSafe.inv[item.id].count+item.count 38 | elseif item.id then 39 | theSafe.inv[item.id] = item 40 | end 41 | end 42 | local tempinv = nil 43 | 44 | if os.time()-theSafe.creationTime > config.SafeExpirationTime*86400 and os.time()-theSafe.creationTime < ((config.SafeExpirationTime*86400)+(config.SafeUnlockTime*86400)) then 45 | theSafe.passcode = "0000" 46 | theSafe.visible = true 47 | table.insert(safes,theSafe) 48 | elseif os.time()-theSafe.creationTime > ((config.SafeExpirationTime*86400)+(config.SafeUnlockTime*86400)) then 49 | MySQL.query('DELETE FROM safes WHERE id=@id', {id=theSafe.id}, function() end) 50 | else 51 | table.insert(safes,theSafe) 52 | end 53 | end 54 | writeLog("\nUpdated Safes. "..#safes, 0) 55 | end) 56 | SetTimeout(10800000, updateAllSafes) 57 | end 58 | end 59 | updateAllSafes() 60 | end) 61 | 62 | Citizen.CreateThread(function() 63 | 64 | AddEventHandler('createSafe', function(x,y,z,r,passcode,inv) 65 | local client = source 66 | if not GetPlayerIdentifier(client,0) then return end 67 | local inv = {} 68 | local id = -1 69 | MySQL.query('INSERT INTO safes (creationTime,owner,passcode,x,y,z,r,inv) VALUES(@creationTime, @owner, @passcode, @x, @y, @z, @r, @inv) ', { creationTime = os.time(), owner = GetPlayerIdentifier(client,0), passcode = passcode, x = x, y = y, z = z, r = r, inv = json.encode(inv) }, 70 | function(response) 71 | id = response.insertId -- assign an id 72 | end) 73 | repeat 74 | Wait(1) -- wait for response 75 | until id ~= -1 76 | writeLog("\nSafe "..id.." Created!\n", 1) 77 | TriggerClientEvent("addSafe", -1, id,x,y,z,r) 78 | table.insert(safes, {id = id,x = x,y = y,z = z,r = r,passcode = passcode, inv = inv, in_use = false, usageTime = 0, permanent = true} ) 79 | end) 80 | 81 | AddEventHandler("CreateCustomSafe", function(x,y,z,r,model,inv,permanent,passcode,blip) 82 | local client = source 83 | if not GetPlayerIdentifier(client,0) then return end 84 | if not model then model = "prop_ld_int_safe_01" end 85 | 86 | if not inv then 87 | inv = {} 88 | end 89 | if not blip then blip = 181 end 90 | local id = nil 91 | if permanent then 92 | id = #safes+1 -- assign an id 93 | else 94 | id = math.random(1000,1000000) -- assign an id that hasnt been used yet and probably never will, we won't be saving this anyway. 95 | passcode = "0000" 96 | end 97 | writeLog("\nSafe "..id.." Created!\n", 1) 98 | TriggerClientEvent("addCustomSafe", -1, id,x,y,z,r,model,blip) 99 | table.insert(safes, {id=id,x = x,y = y,z = z,r = r,passcode = passcode, inv = inv, in_use = false, usageTime = 0, permanent = permanent,blip=blip,model=model} ) 100 | end) 101 | 102 | AddEventHandler('removeSafe', function(id,passcode) 103 | local client = source 104 | if not GetPlayerIdentifier(client,0) then return end 105 | for i,theSafe in pairs(safes) do 106 | if id == theSafe.id and passcode == theSafe.passcode and passcode ~= "0000" and theSafe.permanent then 107 | MySQL.query('DELETE FROM safes WHERE id=@id LIMIT 1', {id=id}, function() end) 108 | table.remove(safes,i) 109 | writeLog("\nSafe "..id.." Deleted!\n", 1) 110 | TriggerClientEvent("removeSafe", -1, id) 111 | break 112 | end 113 | end 114 | end) 115 | 116 | AddEventHandler("GetSafeContents", function(id,passcode) 117 | local foundSafe = false 118 | local c = source 119 | for i,theSafe in pairs(safes) do 120 | if id == theSafe.id and passcode == theSafe.passcode then 121 | if theSafe.in_use and (theSafe.usageTime < (os.time()-600)) then 122 | safes[i].in_use = false 123 | safes[i].usageTime = 0 124 | elseif theSafe.in_use and (theSafe.usageTime < (os.time()+600)) then 125 | TriggerClientEvent("showNotification", c, "Someone is already accessing this Safe!") 126 | break 127 | end 128 | TriggerClientEvent("GetSafeContents", c, id, theSafe.x, theSafe.y, theSafe.z, theSafe.r, passcode, theSafe.inv) 129 | safes[i].in_use = true 130 | safes[i].usageTime = os.time() 131 | foundSafe = true 132 | if passcode ~= "0000" then 133 | MySQL.query('UPDATE safes SET creationTime=@creationTime WHERE id=@id LIMIT 1', {creationTime = os.time(), id = id}, function() end) 134 | end 135 | writeLog("\nPlayer Opened Safe!\n", 1) 136 | break 137 | end 138 | end 139 | if not foundSafe then 140 | TriggerClientEvent("GetSafeContents", c, false,false, false, false, false, false, "") 141 | writeLog("\nSafe not found but client insists, whats wrong?\n", 1) 142 | end 143 | end) 144 | 145 | AddEventHandler("ExitSafe", function(id) 146 | local foundSafe = false 147 | local c = source 148 | for i,theSafe in pairs(safes) do 149 | if id == theSafe.id then 150 | safes[i].in_use = false 151 | safes[i].usageTime = 0 152 | writeLog("\nPlayer Exited Safe!\n", 1) 153 | break 154 | end 155 | end 156 | end) 157 | 158 | AddEventHandler("SetSafeContents", function(id,x,y,z,r,passcode,inv) 159 | local foundSafe = false 160 | local c = source 161 | for i,theSafe in pairs(safes) do 162 | if id == theSafe.id and passcode == theSafe.passcode then 163 | if theSafe.permanent then 164 | MySQL.query('UPDATE safes SET inv=@inv WHERE id=@id LIMIT 1', { inv = json.encode(inv), id = id }, function() end) 165 | end 166 | foundSafe = true 167 | safes[i].inv = inv 168 | writeLog("\nPlayer Updated Safe!\n", 1) 169 | break 170 | end 171 | end 172 | if not foundSafe then 173 | writeLog("\nSafe not found but client insists, whats wrong?\n", 1) 174 | end 175 | end) 176 | 177 | AddEventHandler("Z:newplayerID", function(src) 178 | --local tt = {} 179 | for i,theSafe in pairs(safes) do 180 | --table.insert(tt, {x = theSafe.x, y = theSafe.y,z = theSafe.z,r = theSafe.r,visible = theSafe.visible } ) 181 | if theSafe.blip then 182 | TriggerClientEvent("addCustomSafe", src, theSafe.id, theSafe.x,theSafe.y,theSafe.z,theSafe.r,theSafe.model,theSafe.blip) 183 | else 184 | TriggerClientEvent("loadSafe", src, {id = theSafe.id, x = theSafe.x, y = theSafe.y,z = theSafe.z,r = theSafe.r,visible = theSafe.visible}) -- send many small events instead of one B I G B O I 185 | end 186 | Citizen.Wait(15) 187 | end 188 | --TriggerClientEvent("loadSafes", src, tt ) 189 | writeLog("\nSending Client Safes!\n", 1) 190 | end) 191 | 192 | end) 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /server/gameplay/hunted_server.lua: -------------------------------------------------------------------------------- 1 | huntedPlayers = {} 2 | 3 | Citizen.CreateThread(function() 4 | RegisterServerEvent("AddPlayerHunted") 5 | AddEventHandler("AddPlayerHunted", function(x,y,z) 6 | local t = {id = source, huntedStart = os.time(), x=x,y=y,z=z} 7 | table.insert(huntedPlayers, t) 8 | TriggerClientEvent("AddPlayerHunted", -1, t) 9 | end) 10 | 11 | 12 | RegisterServerEvent("UpdateHuntedPos") 13 | AddEventHandler("UpdateHuntedPos", function(x,y,z) 14 | for i, player in ipairs(huntedPlayers) do 15 | if player.id == source then 16 | huntedPlayers[i].x = x 17 | huntedPlayers[i].y = y 18 | huntedPlayers[i].z = z 19 | TriggerClientEvent("UpdateHuntedPos", -1, huntedPlayers[i]) 20 | end 21 | end 22 | end) 23 | end) 24 | 25 | AddEventHandler("playerDropped", function(reason) 26 | local s = source 27 | for i, player in pairs(huntedPlayers) do 28 | if s == player.id then 29 | TriggerClientEvent("DissapearHunted", -1, player) 30 | table.remove(huntedPlayers,i) 31 | end 32 | end 33 | end) 34 | 35 | Citizen.CreateThread(function() 36 | while true do 37 | Wait(25000) 38 | for i, player in ipairs(huntedPlayers) do 39 | if os.time()-player.huntedStart > 300 and GetNumPlayerIndices(player.id) > 0 then 40 | TriggerClientEvent("ExpireHunted", -1, player) 41 | table.remove(huntedPlayers,i) 42 | elseif GetNumPlayerIndices(player.id) == 0 then 43 | TriggerClientEvent("DissapearHunted", -1, player) 44 | table.remove(huntedPlayers,i) 45 | end 46 | end 47 | end 48 | end) -------------------------------------------------------------------------------- /server/gameplay/weather_server.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | _____ _ __ __ _ _ 3 | | __ \(_) \ \ / / | | | | 4 | | | | |_ _ __ __\ \ /\ / /__ __ _| |_| |__ ___ _ __ 5 | | | | | | '_ \ / _ \ \/ \/ / _ \/ _` | __| '_ \ / _ \ '__| 6 | | |__| | | | | | (_) \ /\ / __/ (_| | |_| | | | __/ | 7 | |_____/|_|_| |_|\___/ \/ \/ \___|\__,_|\__|_| |_|\___|_| 8 | 9 | FiveM-DinoWeather 10 | A Weather System that enhances realism by using GTA Natives relating to Zones. 11 | Copyright (C) 2019 Jarrett Boice 12 | 13 | This program is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU Affero General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | This program is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU Affero General Public License for more details. 22 | 23 | You should have received a copy of the GNU Affero General Public License 24 | along with this program. If not, see . 25 | 26 | ]] 27 | 28 | Citizen.CreateThread(function() 29 | while config.enableDynoWeather do 30 | Citizen.Wait(0) 31 | randomizeSystems() 32 | Citizen.Wait(WeatherConfig.randomizeTime) 33 | end 34 | end) 35 | 36 | RegisterServerEvent("dinoweather:syncWeather") 37 | AddEventHandler("dinoweather:syncWeather", function() 38 | local _source = source 39 | TriggerClientEvent("dinoweather:syncWeather", _source, activeWeatherSystems) 40 | end) 41 | 42 | RegisterServerEvent("dinoweather:setWeatherInZone") 43 | AddEventHandler("dinoweather:setWeatherInZone", function(zoneName, weatherType) 44 | local _source = source 45 | if IsPlayerAceAllowed(_source, "dinoweather.cmds") then 46 | local zoneArea = findZoneBySubZone(zoneName) 47 | for _, weatherZone in ipairs(WeatherConfig.weatherSystems[zoneArea][1]) do 48 | local foundInterval = nil 49 | for i, activeZone in ipairs(activeWeatherSystems) do 50 | if activeZone[1] == weatherZone then 51 | foundInterval = i 52 | end 53 | end 54 | if foundInterval ~= nil then 55 | activeWeatherSystems[foundInterval] = {zoneName, weatherType} 56 | else 57 | table.insert(activeWeatherSystems, {zoneName, weatherType}) 58 | end 59 | end 60 | TriggerClientEvent("dinoweather:syncWeather", -1, activeWeatherSystems) 61 | TriggerClientEvent("chatMessage", _source, "^2Weather set to ^3" .. weatherType .. "^2.") 62 | else 63 | TriggerClientEvent("chatMessage", _source, "^3No Permission.") 64 | end 65 | end) -------------------------------------------------------------------------------- /server/gui/gui_s.lua: -------------------------------------------------------------------------------- 1 | Squads = {} 2 | RegisterServerEvent("joinsquad") 3 | RegisterServerEvent("leavesquad") 4 | 5 | Citizen.CreateThread(function() 6 | 7 | function IsSquadMemberAdmin(member) 8 | for i,theSquad in pairs(Squads) do 9 | for theRow,theMember in ipairs(theSquad.members) do 10 | if GetPlayerName(member) == theMember.name then 11 | return theMember.admin 12 | end 13 | end 14 | end 15 | end 16 | 17 | AddEventHandler("joinsquad", function(squadName,PlayerName) 18 | jstheSource = source 19 | local squadExists = false 20 | for i,theSquad in ipairs(Squads) do 21 | for theRow,theMember in ipairs(theSquad.members) do 22 | if theMember.name == PlayerName then 23 | squadExists = true 24 | TriggerClientEvent("LeftSquad", theMember.id, Squads[i].name) 25 | table.remove(Squads[i].members, theRow) 26 | writeLog("\nremoved member from old squad\n", 1) 27 | for ti,TM in ipairs(Squads[i].members) do 28 | TriggerClientEvent("SquadMemberLeft", TM.id, theMember.id, theMember.name) 29 | writeLog("\ntelling members their member left\n", 1) 30 | end 31 | writeLog("\nPlayer Joined new Squad\n", 1) 32 | break -- member was found, everything was done, break our loop 33 | end 34 | end 35 | if squadExists then 36 | break -- as we cant break out of multiple loops without breaking the whole event, break this too. 37 | end 38 | end 39 | 40 | local squadExists = false 41 | for i,theSquad in ipairs(Squads) do 42 | if theSquad.name == squadName then 43 | squadExists = true 44 | table.insert(Squads[i].members, {id = jstheSource,name = PlayerName, admin = false}) 45 | TriggerClientEvent("JoinedSquad", jstheSource, Squads[i].members, Squads[i].name) 46 | writeLog("\nPlayer Joined new Squad\n", 1) 47 | for i,theMember in ipairs(Squads[i].members) do 48 | TriggerClientEvent("SquadMemberJoined", theMember.id, PlayerName, jstheSource) 49 | writeLog("\ntelling member they have a new member\n", 1) 50 | end 51 | break 52 | end 53 | end 54 | 55 | if squadExists == false then 56 | local squadtable = {name = squadName, members = { } } 57 | table.insert(Squads, squadtable) 58 | TriggerClientEvent("SquadCreated", jstheSource, squadName) 59 | writeLog("\nnew squad created\n", 1) 60 | PlayerJoinSquad(jstheSource, PlayerName, true, squadName) 61 | end 62 | end) 63 | 64 | AddEventHandler("leavesquad", function(PlayerName,p2,p3) 65 | lstheSource = source 66 | local squadExists = false 67 | for i,theSquad in ipairs(Squads) do 68 | for theRow,theMember in ipairs(theSquad.members) do 69 | if theMember.name == PlayerName and (GetPlayerName(source) == PlayerName or IsSquadMemberAdmin(source)) then 70 | squadExists = true 71 | TriggerClientEvent("LeftSquad", theMember.id, Squads[i].name,p2,p3) 72 | table.remove(Squads[i].members, theRow) 73 | writeLog("\nremoved member from old squad\n", 1) 74 | for ti,TM in ipairs(Squads[i].members) do 75 | TriggerClientEvent("SquadMemberLeft", TM.id, theMember.id, theMember.name,p2) 76 | writeLog("\ntelling members their member left\n", 1) 77 | end 78 | break 79 | end 80 | end 81 | if squadExists then 82 | break 83 | end 84 | end 85 | 86 | for sid,theSquad in ipairs(Squads) do 87 | for row,member in ipairs(theSquad.members) do 88 | local found = false 89 | local ptable = GetPlayers() 90 | for _,player in pairs(GetPlayers()) do 91 | if player == member.id then 92 | found=true 93 | break 94 | end 95 | end 96 | if not found then 97 | table.remove(Squads[sid].members, row) 98 | end 99 | end 100 | 101 | 102 | if #theSquad.members == 0 then 103 | table.remove(Squads, i) 104 | writeLog("\nremoved dead squad", 1) 105 | break 106 | end 107 | end 108 | end) 109 | 110 | function PlayerJoinSquad(PlayerId,PlayerName,admin,SquadName) 111 | for i,theSquad in ipairs(Squads) do 112 | if theSquad.name == SquadName then 113 | table.insert(Squads[i].members, {id = PlayerId, name = PlayerName, admin = admin}) 114 | TriggerClientEvent("JoinedSquad", PlayerId, Squads[i].members, Squads[i].name,admin) 115 | writeLog("\nPlayer Joined Squad\n", 1) 116 | break 117 | end 118 | end 119 | end 120 | 121 | RegisterServerEvent("sendSquadMessage") 122 | AddEventHandler("sendSquadMessage", function(players,args) 123 | local msg = "" 124 | for i,arg in ipairs(args) do 125 | if i == 1 then 126 | msg = msg..arg 127 | else 128 | msg = msg.." "..arg 129 | end 130 | end 131 | for i,player in ipairs(players) do 132 | TriggerClientEvent("chat:addMessage", player, { templateId = "squad", args = { GetPlayerName(source), msg } }) 133 | end 134 | end) 135 | 136 | AddEventHandler('playerDropped', function(reason) 137 | local PlayerName = GetPlayerName(source) 138 | for i,theSquad in ipairs(Squads) do 139 | for theRow,theMember in ipairs(theSquad.members) do 140 | if theMember.name == PlayerName then 141 | table.remove(Squads[i].members, theRow) 142 | writeLog("\nPlayer Dropped, Removing them from their Squad..", 1) 143 | for ti,TM in ipairs(Squads[i].members) do 144 | TriggerClientEvent("SquadMemberLeft", TM.id, theMember.id, theMember.name) 145 | end 146 | end 147 | end 148 | break 149 | end 150 | end) 151 | end) 152 | -------------------------------------------------------------------------------- /server/gui/notifications_s.lua: -------------------------------------------------------------------------------- 1 | RegisterServerEvent('playerDied') 2 | AddEventHandler('playerDied',function(killer,reason,weapon) 3 | if killer == "**Invalid**" then --Can't figure out what's generating invalid, it's late. If you figure it out, let me know. I just handle it as a string for now. 4 | reason = 2 5 | end 6 | if reason == 0 then 7 | TriggerClientEvent('showNotification', -1,"~o~".. GetPlayerName(source).."~w~ committed suicide. ") 8 | elseif reason == 1 and weapon then 9 | TriggerClientEvent('showNotification', -1,"~o~".. killer .. "~w~ killed ~o~"..GetPlayerName(source).."~w~ with ~o~"..weapon.."~w~.") 10 | end 11 | writeLog("\nPlayer "..GetPlayerName(source).." died\n", 1) 12 | end) 13 | 14 | 15 | RegisterServerEvent("registerKill") 16 | AddEventHandler("registerKill", function(player,humanity,weapon) 17 | if (player) and player ~= 0 and GetPlayerName(player) then 18 | TriggerClientEvent("Z:killedPlayer", player,humanity,weapon) 19 | writeLog(GetPlayerName(source).." Registered a kill from "..GetPlayerName(player).."\n", 1) 20 | end 21 | end) 22 | 23 | AddEventHandler('rconCommand', function(commandName, args) 24 | local msg = table.concat(args, ' ') 25 | if commandName:lower() == 'notify' and msg ~= nil then 26 | TriggerClientEvent('chatMessage', -1, "^4ℹ️ Notice: " .. "^0" .. msg) 27 | CancelEvent() 28 | end 29 | end) -------------------------------------------------------------------------------- /server/handlers/hosthandler.lua: -------------------------------------------------------------------------------- 1 | players = {} 2 | 3 | RegisterServerEvent("Z:newplayer") 4 | AddEventHandler("Z:newplayer", function(id) 5 | players[source] = id 6 | 7 | if not host then 8 | host = source 9 | end 10 | end) 11 | 12 | AddEventHandler("playerDropped", function(reason) 13 | players[source] = nil 14 | 15 | if source == host then 16 | if #players > 0 then 17 | for mSource, _ in pairs(players) do 18 | host = mSource 19 | break 20 | end 21 | else 22 | host = nil 23 | end 24 | end 25 | end) 26 | 27 | time = {hour = 7, minute = 0} -- start time 28 | date = {day = 1, month = 2, year = 2018} -- start date 29 | 30 | RegisterServerEvent("tads:newplayer") 31 | AddEventHandler("tads:newplayer", function() 32 | TriggerClientEvent("tads:timeanddatesync", source, time, date) 33 | end) 34 | 35 | Citizen.CreateThread(function() 36 | while true do 37 | Citizen.Wait(2000) 38 | time.minute = time.minute+1 39 | if time.minute >= 60 then 40 | time.minute = 0 41 | time.hour = time.hour+1 42 | end 43 | if time.hour >= 24 then 44 | time.hour = 0 45 | end 46 | end 47 | end) -------------------------------------------------------------------------------- /server/hub/gamble_s.lua: -------------------------------------------------------------------------------- 1 | 2 | local WheelChances = { 3 | {type = "money", icon = 2, value = 500, chance = 50, label = "$%i"}, 4 | {type = "money", icon = 2, value = 1500, chance = 45, label = "$%i"}, 5 | {type = "money", icon = 2, value = 2000, chance = 40, label = "$%i"}, 6 | {type = "money", icon = 2, value = 5000, chance = 20, label = "$%i"}, 7 | {type = "money", icon = 2, value = 15000, chance = 6, label = "$%i"}, 8 | {type = "money", icon = 2, value = 35000, chance = 2, label = "$%i"}, 9 | {type = "money", icon = 2, value = 50000, chance = 0, label = "$%i"}, 10 | {type = "money", icon = 2, value = 100000, chance = 0, label = "$%i"}, 11 | {type = "armor", icon = 1,value = 100 ,chance = 50, label = "Armor Pack"}, 12 | {type = "health", icon = 1,value = 100 ,chance = 50, label = "Health Recharge"}, 13 | {type = "spin", icon = 5,value = 1,chance = 50, label = "%i Free Spin"}, 14 | {type = "spin", icon = 5,value = 2,chance = 30, label = "%i Free Spin"}, 15 | {type = "weapon", icon=4, value="randomWeapon", chance = 35, label = "%s" }, 16 | {type = "item", icon=3, value=26, chance=4, label = "%s"}, 17 | {type = "item", icon=3, value="randomItem", chance=45, label = "%s"}, 18 | 19 | } 20 | 21 | local condensedChances = {} 22 | for i,chance in ipairs(WheelChances) do 23 | for d = 1, chance.chance do 24 | table.insert(condensedChances, i) 25 | end 26 | end 27 | 28 | 29 | Citizen.CreateThread(function() 30 | RegisterServerEvent("RequestWheelspinResult") 31 | AddEventHandler("RequestWheelspinResult", function() 32 | local segments = {} 33 | local rndchance = condensedChances[ math.random( #condensedChances ) ] 34 | local win = deepcopy(WheelChances[rndchance]) 35 | local winningChance = math.random(0,10) 36 | for i=0, 10 do 37 | if i == winningChance then 38 | win.id = win.icon 39 | writeLog(win.label, win.value, 1) 40 | if win.value == "randomWeapon" then 41 | local rndwp = weaponChances[ math.random(#weaponChances) ] 42 | win.value = consumableItems[rndwp].name 43 | win.hash = consumableItems[rndwp].hash 44 | elseif win.value == "randomItem" then 45 | local rndit = itemChances[ math.random( #itemChances ) ] 46 | win.value = consumableItems[rndit].name 47 | win.item = rndit 48 | elseif win.type == "item" and win.value ~= "randomItem" then 49 | win.item = win.value 50 | win.value = consumableItems[win.item].name 51 | end 52 | table.insert(segments,win) 53 | else 54 | local gamble = WheelChances[ math.random( #WheelChances ) ] 55 | gamble.id = gamble.icon 56 | table.insert(segments,gamble) 57 | end 58 | end 59 | 60 | --[[ 61 | segments = { 62 | {id = 0, value = 0}, 63 | {id = 1, value = 1}, 64 | {id = 2, value = 2}, 65 | {id = 3, value = 3}, 66 | {id = 4, value = 4}, 67 | {id = 5, value = 5}, 68 | {id = 6, value = 6}, 69 | {id = 7, value = 7}, 70 | {id = 8, value = 8}, 71 | {id = 9, value = 9}, 72 | } 73 | ]] 74 | -- result, winicon, wintext, type, segments 75 | TriggerClientEvent("RequestWheelspinResult", source, winningChance,win.icon,"You Won: "..string.format(win.label,win.value),0,segments) 76 | local win = nil 77 | local segments = nil 78 | end) 79 | end) -------------------------------------------------------------------------------- /server/hub/itemshop_s.lua: -------------------------------------------------------------------------------- 1 | 2 | 3 | -- default stock for all items was moved to the item definitions file. 4 | 5 | itemStock = {} 6 | 7 | weaponStock = {} 8 | 9 | 10 | function stockShops(stockAll) 11 | for i,theStore in ipairs(Stores) do 12 | if theStore.itemStock then 13 | for i,theConsumable in ipairs(consumableItems) do 14 | if stockAll or theStore.itemStock[i] == 0 and not theConsumable.isWeapon then 15 | if type(theConsumable.stockAmount) == "table" then 16 | theStore.itemStock[i] = math.random(theConsumable.stockAmount[1],theConsumable.stockAmount[2]) 17 | elseif type(theConsumable.stockAmount) == "number" then 18 | theStore.itemStock[i] = theConsumable.stockAmount 19 | else 20 | theStore.itemStock[i] = 0 21 | end 22 | end 23 | end 24 | end 25 | end 26 | 27 | for i,theStore in ipairs(Stores) do 28 | if theStore.weaponStock then 29 | for i,theWeapon in ipairs(consumableItems) do 30 | if stockAll or weaponStock[i] == 0 and theWeapon.isWeapon then 31 | if type(theWeapon.stockAmount) == "table" then 32 | theStore.weaponStock[i] = math.random(theWeapon.stockAmount[1],theWeapon.stockAmount[2]) 33 | elseif type(theWeapon.stockAmount) == "number" then 34 | theStore.weaponStock[i] = theWeapon.stockAmount 35 | else 36 | theStore.weaponStock[i] = 0 37 | end 38 | end 39 | end 40 | end 41 | end 42 | end 43 | stockShops(true) 44 | 45 | Citizen.CreateThread(function() 46 | while true do 47 | Citizen.Wait(21600000) 48 | stockShops() 49 | end 50 | end) 51 | 52 | Citizen.CreateThread(function() 53 | 54 | 55 | RegisterServerEvent("requestHubStock") 56 | AddEventHandler("requestHubStock", function(shop,stockType) 57 | writeLog("\nPlayer Requested Hub Stock\n", 1) 58 | if stockType == "weapons" then 59 | TriggerClientEvent("recieveHubStock", source, stockType,Stores[shop].weaponStock) 60 | elseif stockType == "items" then 61 | TriggerClientEvent("recieveHubStock", source, stockType,Stores[shop].itemStock) 62 | end 63 | end) 64 | 65 | RegisterServerEvent("adjustHubStock") 66 | AddEventHandler("adjustHubStock", function(shop,stockType,item,count) -- we dont need seperate functions for this, just make sure we pass a negative or positive value to "count" 67 | writeLog("\nPlayer Adjusted Hub Stock\n", 1) 68 | if count > 1 or count < -1 then -- make sure the values actually make sense, otherwise we are most likely dealing with a cheeser 69 | TriggerEvent("RottenV:FuckCheaters", source, "Hub Alert!","Tried Adding "..count.." Items to the Hub") 70 | return 71 | end 72 | if stockType == "weapons" then 73 | Stores[shop].weaponStock[item] = Stores[shop].weaponStock[item]+count 74 | if Stores[shop].weaponStock[item] <= 0 then 75 | Stores[shop].weaponStock[item] = 0 76 | end 77 | elseif stockType == "items" then 78 | Stores[shop].itemStock[item] = Stores[shop].itemStock[item]+count 79 | if Stores[shop].itemStock[item] <= 0 then 80 | Stores[shop].itemStock[item] = 0 81 | end 82 | end 83 | end) 84 | 85 | end) -------------------------------------------------------------------------------- /server/hub/questshop_s.lua: -------------------------------------------------------------------------------- 1 | 2 | dailies = { 3 | 4 | { 5 | {banditkills = 0, herokills = 0, zombiekills = 500, items = {}, withweapon = 453432689 }, 6 | {humanity = 100, loot = {{id = 17, count = 2000}}}, 7 | }, 8 | { 9 | {banditkills = 0, herokills = 0, zombiekills = 500, items = {}, withweapon = 453432689 }, 10 | {humanity = 100, loot = {{id = 17, count = 2000}}}, 11 | }, 12 | { 13 | {banditkills = 0, herokills = 0, zombiekills = 500, items = {}, withweapon = 453432689 }, 14 | {humanity = 100, loot = {{id = 17, count = 2000}}}, 15 | }, 16 | 17 | } 18 | function GenerateDaily() 19 | local type = math.random(0,1) -- daily type 20 | local bonusitem = math.random(0,1) 21 | local bonusitemtype = math.random(0,1) 22 | local items = {} 23 | local killtype = math.random(1,4) 24 | local killamount = 0 25 | local useWeapon = math.random(0,1) 26 | local withweapon = nil 27 | local banditkills = 0 28 | local herokills = 0 29 | local zombiekills = 0 30 | local stopCamps = 0 31 | local humanity = 200 32 | local moneyreward = 2000 33 | 34 | 35 | 36 | if type == 0 then -- chose between items or kills 37 | local itemid = math.random(1,16) 38 | local itemcount = math.random(0,10) 39 | items = { {id = itemid, count = itemcount} } 40 | moneyreward = (consumableItems[itemid].price*itemcount)*1.3 41 | elseif type == 1 then 42 | local killtype = math.random(1,3) 43 | if killtype == 1 then 44 | banditkills = math.random(1,15) 45 | moneyreward = (banditkills*500)*0.6 46 | elseif killtype == 2 then 47 | herokills = math.random(1,15) 48 | moneyreward = (herokills*200)*0.6 49 | humanity = 50*herokills 50 | elseif killtype == 3 then 51 | zombiekills = math.random(10,100) 52 | moneyreward = (zombiekills*10) 53 | elseif killtype == 4 then 54 | stopCamps = math.random(1,4) 55 | moneyreward = (stopCamps*1300) 56 | useWeapon = 0 57 | end 58 | if useWeapon == 1 then 59 | randomWeapon = weaponChances[ math.random( #weaponChances ) ] 60 | withweapon = GetHashKey(consumableItems[randomWeapon].hash) 61 | end 62 | end 63 | local loot = {{id = 17, count = math.round(moneyreward)}} 64 | if bonusitem == 1 then 65 | if bonusitemtype == 0 then 66 | table.insert(loot, {id = weaponChances[math.random(1, #weaponChances)], count = math.random(10,60)}) 67 | elseif bonusitemtype == 1 then 68 | local item = itemChances[ math.random( #itemChances ) ] 69 | if consumableItems[item].randomFinds[1] then 70 | table.insert(loot, {id = item, count = math.random( consumableItems[item].randomFinds[1], consumableItems[item].randomFinds[2] )+0.0}) 71 | else 72 | table.insert(loot, {id = item, count = math.random( 1, 1 )+0.0}) 73 | end 74 | end 75 | end 76 | 77 | local daily = { 78 | finishrequirements = {withweapon = withweapon, banditkills = banditkills, herokills = herokills, zombiekills = zombiekills, stopCamps = stopCamps, items = items }, 79 | finishloot = {humanity = humanity, loot = loot}, 80 | } 81 | 82 | return daily 83 | end 84 | 85 | dailies[1] = GenerateDaily() 86 | dailies[2] = GenerateDaily() 87 | dailies[3] = GenerateDaily() 88 | 89 | RegisterServerEvent("requestDaily") 90 | AddEventHandler("requestDaily", function() 91 | TriggerClientEvent("requestDaily", source, dailies) 92 | end) -------------------------------------------------------------------------------- /server/inventory/inventory_s.lua: -------------------------------------------------------------------------------- 1 | Citizen.CreateThread(function() 2 | RegisterServerEvent("s_killedZombie") 3 | AddEventHandler("s_killedZombie", function(player,weapon) 4 | if player and player ~= 0 and GetPlayerName(player) then 5 | TriggerClientEvent("c_killedZombie",player,weapon) 6 | 7 | writeLog(GetPlayerName(source).." Registered a ZOMBIE kill from "..GetPlayerName(player).."\n", 1) 8 | end 9 | end) 10 | end) 11 | 12 | 13 | -- inventory management to prevent retard cheaters 14 | 15 | inventories = {} 16 | 17 | AddEventHandler("registerPlayerInv", function(client,inv) 18 | inventories[client] = inv 19 | writeLog("\nAdded Player Inventory to List\n", 1) 20 | end) 21 | 22 | RegisterServerEvent("SetLegitimateMoney") 23 | AddEventHandler("SetLegitimateMoney", function(newMoney) 24 | 25 | if not inventories[source] then 26 | TriggerEvent("SentryIO_Warning", "Player Inventory Data was Missing", "Player Tried Adding Legitimate Money but player didn't exist.") 27 | return 28 | end 29 | if newMoney == 0 then 30 | inventories[source].money=newMoney 31 | else 32 | TriggerEvent("RottenV:CheatingNotification", source,"Money Cheating Detected","Tried to set "..newMoney.." as their Legitimate Income!") 33 | end 34 | end) 35 | 36 | RegisterServerEvent("AddLegitimateMoney") 37 | AddEventHandler("AddLegitimateMoney", function(addedMoney) 38 | if not inventories[source].money then 39 | TriggerEvent("SentryIO_Warning", "Player Inventory Data was Missing", "Player Tried Adding Legitimate Money but player didn't exist.") 40 | return 41 | end 42 | inventories[source].money=inventories[source].money+addedMoney 43 | end) 44 | 45 | RegisterServerEvent("BuyItem") 46 | AddEventHandler("BuyItem", function(itemId,currentMoney,humanity) 47 | if not inventories[source].money then 48 | TriggerEvent("SentryIO_Warning", "Player Inventory Data was Missing", "Player Tried Adding Legitimate Money but player didn't exist.") 49 | return 50 | end 51 | local actualprice = math.floor(consumableItems[itemId].price*(1+calculateBonuses(humanity)/100)) 52 | if currentMoney ~= inventories[source].money then 53 | TriggerEvent("RottenV:CheatingNotification", source,"Money Cheating Detected","Server-Side Money was "..inventories[source].money..", Client Money was "..currentMoney) 54 | TriggerClientEvent("SetCorrectedMoney", source, inventories[source].money-actualprice) 55 | end 56 | if inventories[source].money >= consumableItems[itemId].price then 57 | inventories[source].money=inventories[source].money-actualprice 58 | end 59 | end) -------------------------------------------------------------------------------- /server/main.lua: -------------------------------------------------------------------------------- 1 | players = {} 2 | ServerReady = false 3 | 4 | RegisterServerEvent("Z:newplayer") 5 | AddEventHandler("Z:newplayer", function(id) 6 | players[source] = id 7 | TriggerClientEvent("Z:playerUpdate", -1, players) 8 | end) 9 | 10 | 11 | local bannedNameParts = {" 50) and not coord.used and (os.time()-coord.lastCreated > 1000) then 63 | writeLog("generating", 1) 64 | TriggerClientEvent("GenerateBanditCamp", player, {id = i, coords = coord, pedcount = math.random(2,8)} ) -- ask a random player to generate a camp 65 | end 66 | end 67 | end 68 | end 69 | end 70 | end) 71 | 72 | 73 | 74 | Citizen.CreateThread(function() 75 | RegisterServerEvent("Z:newplayerID") 76 | AddEventHandler("Z:newplayerID", function(playerid) 77 | TriggerClientEvent("LoadCamps", source, BanditCamps) 78 | end) 79 | end) 80 | -------------------------------------------------------------------------------- /server/missions/airdrop_s.lua: -------------------------------------------------------------------------------- 1 | RegisterServerEvent("AirdropStarted") 2 | RegisterServerEvent("AirdropLanded") 3 | RegisterServerEvent("AirdropFailed") 4 | RegisterServerEvent("RegisterAirdropPlane") 5 | RegisterServerEvent("TellAirdropToFuckOffAndUnregister") 6 | 7 | 8 | 9 | 10 | AddEventHandler("AirdropStarted", function(x,y,z) 11 | TriggerClientEvent("showNotification", -1, "An ~y~Airdrop~s~ has been called in by a player.") 12 | TriggerClientEvent("addAirdropBlip", -1, x,y,z) 13 | end) 14 | 15 | AddEventHandler("AirdropFailed", function(x,y,z) 16 | TriggerClientEvent("removeAirdropBlip", -1, x,y,z) 17 | end) 18 | 19 | AddEventHandler("AirdropLanded", function(x,y,z) 20 | TriggerClientEvent("removeAirdropBlip", -1, x,y,z) 21 | end) 22 | 23 | AddEventHandler("RegisterAirdropPlane", function(info) 24 | TriggerClientEvent("RegisterAirdropPlane", -1,info) 25 | end) 26 | 27 | AddEventHandler("TellAirdropToFuckOffAndUnregister", function(info) 28 | TriggerClientEvent("TellAirdropToFuckOffAndUnregister", -1,info) 29 | end) 30 | -------------------------------------------------------------------------------- /server/missions/power_s.lua: -------------------------------------------------------------------------------- 1 | blackoutEnabled = true 2 | -- 1800, 7200 3 | local blackoutTime = math.floor(math.random(1800,7200)) -- 30 minutes - 120 minutes? 4 | 5 | RegisterServerEvent("ActivatePower") 6 | AddEventHandler("ActivatePower", function(name) 7 | TriggerClientEvent("togglePower", -1, true) 8 | blackoutEnabled = false 9 | TriggerClientEvent("showNotification",-1,"~g~Power Grid Restored!~n~~s~Survivor ~o~"..name.."~s~ has successfully restored the power!") 10 | end) 11 | 12 | RegisterServerEvent("CutPower") 13 | AddEventHandler("CutPower", function() 14 | TriggerClientEvent("togglePower", -1, false) 15 | blackoutEnabled = true 16 | end) 17 | 18 | RegisterServerEvent("disableRepairAction") 19 | AddEventHandler("disableRepairAction", function(disable, station) 20 | TriggerClientEvent("disableRepairAction", -1, disable, station) 21 | end) 22 | 23 | 24 | RegisterServerEvent("Z:newplayerID") 25 | AddEventHandler("Z:newplayerID", function(id) 26 | TriggerClientEvent("togglePower", id, not blackoutEnabled) 27 | end) 28 | 29 | Citizen.CreateThread(function() 30 | while true do 31 | Wait(1000) 32 | if not blackoutEnabled then 33 | blackoutTime = blackoutTime - 1 34 | if blackoutTime <= 0 then 35 | blackoutEnabled = true 36 | blackoutTime = math.floor(math.random(1800,7200)) 37 | TriggerClientEvent("togglePower", -1, false) 38 | TriggerClientEvent("showNotification",-1,"~r~Power generators have malfunctioned!~n~~s~Go repair them again to turn the power back on!") 39 | end 40 | end 41 | end 42 | end) 43 | -------------------------------------------------------------------------------- /server/pingkick.lua: -------------------------------------------------------------------------------- 1 | RegisterServerEvent("CheckMyPing") 2 | AddEventHandler("CheckMyPing", function() 3 | local hostname = GetConvar("sv_hostname", "this will never be the case anyway") 4 | local pingstring = "" 5 | if string.find(hostname, "#1") then 6 | pingstring = "Looks like your ping is %s right now, i recommend you try joining our American Server ( 185.249.196.62:32030 )." 7 | else 8 | pingstring = "Looks like your ping is %s right now, i recommend you try joining our European Server ( 185.239.238.158:30120 )." 9 | end 10 | 11 | 12 | if GetPlayerPing(source) > 130 then 13 | TriggerClientEvent("chat:addMessage", source, { templateId = "defaultAlt", args = { string.format(pingstring, GetPlayerPing(source)) } }) 14 | end 15 | end) -------------------------------------------------------------------------------- /server/prometheus.lua: -------------------------------------------------------------------------------- 1 | local metricEvent = "prometheus:addMetric" 2 | 3 | Citizen.CreateThread(function() 4 | TriggerEvent(metricEvent, "Gauge", "fxs_rottenv_items", "RottenV: Items", function(cb) 5 | while true do 6 | Wait(5000) 7 | cb("set", #spawnedItems) 8 | end 9 | end) 10 | end) 11 | 12 | 13 | Citizen.CreateThread(function() 14 | TriggerEvent(metricEvent, "Gauge", "fxs_rottenv_huntedplayers", "RottenV: Hunted Players", function(cb) 15 | while true do 16 | Wait(5000) 17 | cb("set", #huntedPlayers) 18 | end 19 | end) 20 | end) 21 | 22 | Citizen.CreateThread(function() 23 | TriggerEvent(metricEvent, "Gauge", "fxs_rottenv_squads", "RottenV: Squads", function(cb) 24 | while true do 25 | Wait(5000) 26 | cb("set", #Squads) 27 | end 28 | end) 29 | end) 30 | 31 | Citizen.CreateThread(function() 32 | TriggerEvent(metricEvent, "Gauge", "fxs_rottenv_cars", "RottenV: Cars", function(cb) 33 | while true do 34 | Wait(5000) 35 | cb("set", #spawnedCars) 36 | end 37 | end) 38 | end) 39 | 40 | 41 | Citizen.CreateThread(function() 42 | TriggerEvent(metricEvent, "Gauge", "fxs_rottenv_safes", "RottenV: Safes", function(cb) 43 | while true do 44 | Wait(8000) 45 | cb("set", #safes) 46 | end 47 | end) 48 | end) 49 | 50 | 51 | Citizen.CreateThread(function() 52 | TriggerEvent(metricEvent, "Gauge", "fxs_rottenv_power", "RottenV: Power Generator Status", function(cb) 53 | while true do 54 | Wait(10000) 55 | local pwr = 0 56 | if blackoutEnabled then 57 | pwr = 0 58 | else 59 | pwr = 1 60 | end 61 | cb("set", pwr) 62 | end 63 | end) 64 | end) 65 | 66 | Citizen.CreateThread(function() 67 | TriggerEvent(metricEvent, "Gauge", "fxs_rottenv_banditcamps", "RottenV: Bandit Camps", function(cb) 68 | while true do 69 | Wait(8000) 70 | cb("set", #BanditCamps) 71 | end 72 | end) 73 | end) 74 | 75 | 76 | Citizen.CreateThread(function() 77 | TriggerEvent(metricEvent, "Gauge", "fxs_rottenv_activeweathersystems", "RottenV: Weather Systems", function(cb) 78 | while true do 79 | Wait(8000) 80 | cb("set", #activeWeatherSystems) 81 | end 82 | end) 83 | end) 84 | -------------------------------------------------------------------------------- /server/spawners/carspawner_server.lua: -------------------------------------------------------------------------------- 1 | spawnedCars = {} 2 | maxCars = config.maxVehicles 3 | 4 | vehPollResults = {} 5 | 6 | 7 | RegisterServerEvent("registerNewVehicle") 8 | RegisterServerEvent("removeOldVehicle") 9 | RegisterServerEvent("vehiclePoll") 10 | 11 | AddEventHandler("registerNewVehicle", function(netid) 12 | local t = {netid = netid, id = #spawnedCars+1} 13 | table.insert(spawnedCars,t) 14 | TriggerClientEvent("registerNewVehicle", -1, t) 15 | writeLog("\nRegistering Vehicle "..t.id, 1) 16 | end) 17 | 18 | AddEventHandler("removeOldVehicle", function(vehicle) 19 | for i,veh in ipairs(spawnedCars) do 20 | if veh.id == vehicle then 21 | table.remove(spawnedCars,i) 22 | end 23 | end 24 | TriggerClientEvent("removedOldVehicle", -1, vehicle) 25 | end) 26 | 27 | 28 | AddEventHandler("vehiclePoll", function(cars) 29 | table.insert(vehPollResults, cars) 30 | end) 31 | 32 | Citizen.CreateThread(function() 33 | while true do 34 | Wait(20000) 35 | local players = GetPlayers() 36 | if #spawnedCars < maxCars and #players > 0 then 37 | TriggerClientEvent("GenerateRandomVehicle", players[ math.random( #players ) ], maxCars ) -- ask a random player to generate a vehicle 38 | end 39 | end 40 | end) 41 | 42 | Citizen.CreateThread(function() 43 | while true do 44 | Wait(60000) -- polling thread 45 | if #GetPlayers() ~= 0 then 46 | vehPollResults = {} 47 | TriggerClientEvent("vehiclePoll", -1, spawnedCars) 48 | Wait(3000) 49 | for i,spawnedCar in ipairs(spawnedCars) do 50 | thisCarExists = false 51 | for i, pollresult in ipairs(vehPollResults) do 52 | for d,car in ipairs(pollresult) do 53 | if car.id == spawnedCar.id then 54 | if car.exists then 55 | thisCarExists=true 56 | end 57 | end 58 | end 59 | end 60 | if not thisCarExists then 61 | writeLog("\nDeleting Vehicle "..spawnedCar.id, 1) 62 | table.remove(spawnedCars, i) 63 | TriggerClientEvent("removedOldVehicle", -1, spawnedCar.id) 64 | end 65 | end 66 | else 67 | spawnedCars = {} 68 | end 69 | end 70 | end) 71 | 72 | 73 | Citizen.CreateThread(function() 74 | RegisterServerEvent("Z:newplayerID") 75 | AddEventHandler("Z:newplayerID", function(playerid) 76 | TriggerClientEvent("loadVehicles", source, spawnedCars) 77 | end) 78 | end) 79 | -------------------------------------------------------------------------------- /shared/hub/hubStores.lua: -------------------------------------------------------------------------------- 1 | Stores = { 2 | 3 | -- downtown stores 4 | { 5 | name = "Weapon Store", 6 | location = {182.86,-940.68,29.49,56.67}, 7 | wmid = "wepstore", 8 | blip = 110, 9 | weaponStock = {}, 10 | model = "rottenv_weapons", 11 | }, 12 | { 13 | name = "Item Store", 14 | location = {211.94,-928.42,29.90,240.77}, 15 | wmid = "itemstore", 16 | blip = 403, 17 | itemStock = {}, 18 | model = "rottenv_supplies", 19 | }, 20 | 21 | { 22 | name = "Quests", 23 | location = {199.95,-905.82,30.52,150.77}, 24 | wmid = "quests", 25 | blip = 280, 26 | model = "rottenv_daily", 27 | }, 28 | 29 | { 30 | name = "Money Locker", 31 | location = {221.12,-918.1,29.60,146.73}, 32 | wmid = "locker", 33 | blip = 207, 34 | model = "p_cs_locker_01_s", 35 | }, 36 | 37 | { 38 | name = "Wheel of Fortune", 39 | location = {199.45,-950.62,29.49,228.7}, 40 | wmid = "gamble", 41 | blip = 439, 42 | model = "rottenv_wheelspin", 43 | }, 44 | 45 | 46 | --[[ 47 | { 48 | name = "Skin Shop", 49 | location = {232.24,-903.84,29.72,236.40}, 50 | pedcoords = {258.81, -829.38, 72.66, 147.65}, 51 | camcoords = {257.38, -832.0, 72.66, 342.97}, 52 | wmid = "skinstore", 53 | blip = 366, 54 | }, 55 | 56 | ]] 57 | 58 | 59 | -- Sandy Shores Stores 60 | { 61 | name = "Weapon Store", 62 | location = {1404.83,3620.23,38.4,25.12}, 63 | wmid = "wepstore", 64 | blip = 110, 65 | weaponStock = {}, 66 | model = "rottenv_weapons", 67 | }, 68 | { 69 | name = "Item Store", 70 | location = {1408.76,3605.76,38.4,202.46}, 71 | wmid = "itemstore", 72 | blip = 403, 73 | itemStock = {}, 74 | model = "rottenv_supplies", 75 | }, 76 | 77 | { 78 | name = "Quests", 79 | location = {1409.18,3612.19,38.4,286.17}, 80 | wmid = "quests", 81 | blip = 280, 82 | model = "rottenv_daily", 83 | }, 84 | 85 | { 86 | name = "Money Locker", 87 | location = {1399.15,3610.76,38.0,117.0}, 88 | wmid = "locker", 89 | blip = 207, 90 | model = "p_cs_locker_01_s", 91 | }, 92 | 93 | { 94 | name = "Wheel of Fortune", 95 | location = {1396.86,3617.05,38.4,107.4}, 96 | wmid = "gamble", 97 | blip = 439, 98 | model = "rottenv_wheelspin", 99 | }, 100 | 101 | 102 | 103 | 104 | -- mount chilliad stores 105 | { 106 | name = "Item Store", 107 | location = {1439.59,6331.1,23.25,182.79}, 108 | wmid = "itemstore", 109 | blip = 403, 110 | itemStock = {}, 111 | model = "rottenv_supplies", 112 | }, 113 | { 114 | name = "Weapon Store", 115 | location = {1458.90,6346.43,23.25,205.80}, 116 | wmid = "wepstore", 117 | blip = 110, 118 | weaponStock = {}, 119 | model = "rottenv_weapons", 120 | }, 121 | 122 | { 123 | name = "Quests", 124 | location = {1458.24, 6366.62,23.17,31.70}, 125 | wmid = "quests", 126 | blip = 280, 127 | model = "rottenv_daily", 128 | }, 129 | 130 | { 131 | name = "Money Locker", 132 | location = {1474.34,6383.17,22.40,78.04}, 133 | wmid = "locker", 134 | blip = 207, 135 | model = "p_cs_locker_01_s", 136 | }, 137 | 138 | { 139 | name = "Wheel of Fortune", 140 | location = {1510.27,6328.6,23.47,238.96}, 141 | wmid = "gamble", 142 | blip = 439, 143 | model = "rottenv_wheelspin", 144 | }, 145 | 146 | 147 | --[[ 148 | { 149 | name = "Skin Shop", 150 | location = {1483.93,6371.01,23.0,342.0}, 151 | pedcoords = {1661.77, 6341.4, 57.62, 79.61}, 152 | camcoords = {1658.18, 6342.0, 57.62, 257.11}, 153 | wmid = "skinstore", 154 | blip = 366, 155 | }, 156 | ]] 157 | 158 | } -------------------------------------------------------------------------------- /shared/missions/quests.lua: -------------------------------------------------------------------------------- 1 | -- finish requirements can be: 2 | -- banditkills, herokills, zombiekills, items 3 | -- start requirements can be 4 | -- zombiekills, items, humanityMin, humanityMax, hunger, thirst 5 | 6 | Quests = { 7 | { 8 | id = 1, --mission id 9 | name = "Helping People.", -- mission title 10 | desc = "Hey, you! My Friend is infected and needs antibiotics,\nif you can bring me some you can have some of our loot.", -- request 11 | finishmessage = "Oh, Thank God, here, have some loot,\nI bet you can use it better than us!", -- message once you finish it 12 | hide = false, -- hide if requirements aren't met 13 | startRequirements = {}, -- can be the same as below 14 | finishrequirements = {banditkills = 0, herokills = 0, zombiekills = 0, items = { {id = 16, count = 2} } }, -- requirements to finish it 15 | finishloot = { humanity = 100, loot = {{id = 7, count = 2}, {id = 12, count = 4}, {id = 59, count = 60}} }, -- loot you get once you finish it 16 | }, 17 | { 18 | id = 2, --mission id 19 | name = "Cleaning out the Rat Nest.", -- mission title 20 | desc = "Whats up, i've seen what you did around here,\ngreat work, but we are not done yet,\nour looters keep getting attacked by bandits,\ncould you help us and kill some, please?", -- request 21 | hide = true, -- hide if requirements aren't met 22 | finishmessage = "Nice Work! Here, have some supplies.", -- message once you finish it 23 | startRequirements = {humanityMin = 500}, 24 | finishrequirements = {banditkills = 20, herokills = 0, zombiekills = 0, items = {} }, -- requirements to finish it 25 | finishloot = { humanity = 100, loot = {{id = 17, count = 5000}, {id = 11, count = 1}, {id = 16, count = 1}} } -- loot you get once you finish it 26 | }, 27 | { 28 | id = 3, --mission id 29 | name = "Cleansing the Weak.", -- mission title 30 | desc = "Those Heroes are ruining our work, make them fear us again.", -- request 31 | hide = true, -- hide if requirements aren't met 32 | finishmessage = "Very Nice, that'll teach them not to fuck with us.", -- message once you finish it 33 | startRequirements = {humanityMax = 200}, 34 | finishrequirements = {banditkills = 0, herokills = 20, zombiekills = 0, items = {} }, -- requirements to finish it 35 | finishloot = { humanity = -150, loot = {{id = 17, count = 3500}, {id = 11, count = 1}, {id = 16, count = 1}} } -- loot you get once you finish it 36 | }, 37 | 38 | { 39 | id = 4, --mission id 40 | name = "Land of the Dead.", -- mission title 41 | desc = "Hey, wanna earn some extra cash?\nGet rid of those pesky zombies, will ya.", -- request 42 | hide = false, -- hide if requirements aren't met 43 | finishmessage = "Good Job, Soldier, here, have some cash.", -- message once you finish it 44 | startRequirements = {}, 45 | finishrequirements = {banditkills = 0, herokills = 0, zombiekills = 20, items = {} }, -- requirements to finish it 46 | finishloot = { humanity = 100, loot = {{id = 17, count = 2000}} } -- loot you get once you finish it 47 | }, 48 | 49 | { 50 | id = 5, --mission id 51 | name = "Resupply Needed.", -- mission title 52 | desc = "We need some guns since we've been running out lately,\ncan you get us some? Would be great.", -- request 53 | hide = false, -- hide if requirements aren't met 54 | finishmessage = "Thanks, these will come in handy.", -- message once you finish it 55 | startRequirements = {}, 56 | finishrequirements = {banditkills = 0, herokills = 0, zombiekills = 0, items = { {id = 40, count = 30}, {id = 45, count = 15} } }, -- requirements to finish it 57 | finishloot = { humanity = 100, loot = {{id = 17, count = 3500}} } -- loot you get once you finish it 58 | }, 59 | 60 | { 61 | id = 6, --mission id 62 | name = "Fun Facts.", -- mission title 63 | desc = "Did you know that zombies drop loot sometimes?\nI didn't until recently!", -- request 64 | hide = false, -- hide if requirements aren't met 65 | finishmessage = "Nice Job! Here, have this marker, i don't have a use for it.", -- message once you finish it 66 | startRequirements = {}, 67 | finishrequirements = {banditkills = 0, herokills = 0, zombiekills = 300, items = { } }, -- requirements to finish it 68 | finishloot = { humanity = 50, loot = {{id = 87, count = 1},{id = 17, count = 15000}} } -- loot you get once you finish it 69 | }, 70 | 71 | { 72 | id = 7, --mission id 73 | name = "Eliminar Bandidos.", -- mission title 74 | desc = "Hey Amigo! These evil bandidos have been making life\nhard for me, please take care of this escoria.", -- request 75 | hide = true, -- hide if requirements aren't met 76 | finishmessage = "Gracias hermano, i owe you.", -- message once you finish it 77 | startRequirements = {humanityMin = 450, humanityMax = 9999999}, 78 | finishrequirements = {banditkills = 50, herokills = 0, zombiekills = 0, items = { } }, -- requirements to finish it 79 | finishloot = { humanity = 100, loot = {{id = 13, count = 1},{id = 17, count = 8000},{id = 7, count = 2}}} -- loot you get once you finish it 80 | }, 81 | 82 | { 83 | id = 8, --mission id 84 | name = "Stocking Up.", -- mission title 85 | desc = "Yo, we've been running low on food lately,\ncan you go out and get us some, we need about a month's worth.", -- request 86 | hide = true, -- hide if requirements aren't met 87 | finishmessage = "Thanks man, no idea what we would do without you.", -- message once you finish it 88 | startRequirements = {}, 89 | finishrequirements = {banditkills = 0, herokills = 0, zombiekills = 0, items = { {id = 5, count = 10},{id = 12, count = 10},{id = 22, count = 4},{id = 1, count = 10},{id = 24, count = 6} } }, -- requirements to finish it 90 | finishloot = { humanity = 100, loot = {{id = 81, count = 20},{id = 45, count = 20},{id = 17, count = 10000},{id = 12, count = 4},{id = 12, count = 4},{id = 11, count = 1} } } -- loot you get once you finish it 91 | }, 92 | 93 | -- add new missions here, below is a placeholder, you can replace it with whatever, just make sure you increment the mission id properly. 94 | { 95 | id = 9, --mission id 96 | name = "Getting a Signal.", -- mission title 97 | desc = "Hey, did you hear? A Heli crashed nearby and it dropped a load of CB Radios, if you can bring me some batteries i'll give you one.", -- request 98 | finishmessage = "Awesome! Here, this one looks to be good, i hope you need it more than i do.", -- message once you finish it 99 | startRequirements = {}, 100 | finishrequirements = {items = {{id = 91, count = 6}} }, -- requirements to finish it 101 | finishloot = { humanity = 50, loot = {{id = 93, count = 1}} } -- loot you get once you finish it 102 | }, 103 | 104 | { 105 | id = 10, --mission id 106 | name = "Campers.", -- mission title 107 | desc = "These pesky mercenaries have been building up camps in the whole city recently, please get rid of them, if you can.", -- request 108 | finishmessage = "Thank god, lets hope they dont come back.", -- message once you finish it 109 | startRequirements = {}, 110 | finishrequirements = {stopCamps = 3}, -- requirements to finish it 111 | finishloot = { humanity = 150, loot = {{id = 11, count = 2}, {id = 17, count = 6000}} } -- loot you get once you finish it 112 | }, 113 | 114 | [97] = { 115 | id = 97, 116 | name = "~g~Daily Quest 1~w~", 117 | daily = true, 118 | desc = "This is a Daily Quest, it will change every Day.", 119 | finishmessage = "Daily Completed.", 120 | startRequirements = {}, 121 | finishrequirements = {}, -- genererate daily requirement 122 | finishloot = {}, -- generate daily reward 123 | }, 124 | 125 | [98] = { 126 | id = 98, 127 | name = "~g~Daily Quest 2~w~", 128 | daily = true, 129 | desc = "This is a Daily Quest, it will change every Day.", 130 | finishmessage = "Daily Completed.", 131 | startRequirements = {}, 132 | finishrequirements = {}, -- genererate daily requirement 133 | finishloot = {}, -- generate daily reward 134 | }, 135 | [99] = { 136 | id = 99, 137 | name = "~g~Daily Quest 3~w~", 138 | daily = true, 139 | desc = "This is a Daily Quest, it will change every Day.", 140 | finishmessage = "Daily Completed.", 141 | startRequirements = {}, 142 | finishrequirements = {}, -- genererate daily requirement 143 | finishloot = {}, -- generate daily reward 144 | }, 145 | 146 | } 147 | -------------------------------------------------------------------------------- /shared/useful/functions.lua: -------------------------------------------------------------------------------- 1 | function DistanceBetweenCoords(x1,y1,z1,x2,y2,z2) 2 | local deltax = x1 - x2 3 | local deltay = y1 - y2 4 | local deltaz = z1 - z2 5 | 6 | local dist = math.sqrt((deltax * deltax) + (deltay * deltay) + (deltaz * deltaz)) 7 | --xout = math.abs(deltax) 8 | --yout = math.abs(deltay) 9 | --zout = math.abs(deltaz) 10 | --result = {distance = dist, x = xout, y = yout, z = zout} 11 | 12 | return dist 13 | end 14 | 15 | function DistanceBetweenCoords2D(x1,y1,x2,y2) 16 | local deltax = x1 - x2 17 | local deltay = y1 - y2 18 | 19 | dist = math.sqrt((deltax * deltax) + (deltay * deltay)) 20 | --xout = math.abs(deltax) 21 | --yout = math.abs(deltay) 22 | --result = {distance = dist, x = xout, y = yout} 23 | 24 | return dist 25 | end 26 | 27 | function mysplit(inputstr, sep) 28 | if sep == nil then 29 | sep = "%s" 30 | end 31 | local t={} ; i=1 32 | for str in string.gmatch(inputstr, "([^"..sep.."]+)") do 33 | t[i] = str 34 | i = i + 1 35 | end 36 | return t 37 | end 38 | 39 | function tobool(v) 40 | if v == "true" then 41 | return true 42 | else 43 | return false 44 | end 45 | end 46 | 47 | function calculateBonuses(humanity) 48 | local increase = 0 49 | for i=500,0,-100 do 50 | if humanity <= i then 51 | if i>500 then 52 | increase=increase-5 53 | else 54 | increase=increase+5 55 | end 56 | if i == 500 then increase = 0 end 57 | end 58 | end 59 | for i=500,1000,100 do 60 | if humanity >= i then 61 | if i>500 then 62 | increase=increase-5 63 | else 64 | increase=increase+5 65 | end 66 | if i == 500 then increase = 0 end 67 | end 68 | end 69 | return increase 70 | end 71 | 72 | function calculateAmmoBonuses(humanity) 73 | local increase = 0 74 | for i=500,0,-100 do 75 | if humanity <= i then 76 | if i>500 then 77 | increase=increase-3 78 | else 79 | increase=increase+3 80 | end 81 | if i == 500 then increase = 0 end 82 | end 83 | end 84 | for i=500,1000,100 do 85 | if humanity >= i then 86 | if i>500 then 87 | increase=increase-3 88 | else 89 | increase=increase+3 90 | end 91 | if i == 500 then increase = 0 end 92 | end 93 | end 94 | return increase 95 | end 96 | 97 | function reverseBonuses(humanity) 98 | local increase = 0 99 | for i=500,0,-100 do 100 | if humanity <= i then 101 | if i>500 then 102 | increase=increase+5 103 | else 104 | increase=increase-5 105 | end 106 | if i == 500 then increase = 0 end 107 | end 108 | end 109 | for i=500,1000,100 do 110 | if humanity >= i then 111 | if i>500 then 112 | increase=increase+5 113 | else 114 | increase=increase-5 115 | end 116 | if i == 500 then increase = 0 end 117 | end 118 | end 119 | return increase 120 | end 121 | 122 | function math.round(num, numDecimalPlaces) 123 | if numDecimalPlaces and numDecimalPlaces>0 then 124 | local mult = 10^numDecimalPlaces 125 | return math.floor(num * mult + 0.5) / mult 126 | end 127 | return math.floor(num + 0.5) 128 | end 129 | 130 | function deepcopy(orig) 131 | local orig_type = type(orig) 132 | local copy 133 | if orig_type == 'table' then 134 | copy = {} 135 | for orig_key, orig_value in next, orig, nil do 136 | copy[deepcopy(orig_key)] = deepcopy(orig_value) 137 | end 138 | setmetatable(copy, deepcopy(getmetatable(orig))) 139 | else -- number, string, boolean, etc 140 | copy = orig 141 | end 142 | return copy 143 | end -------------------------------------------------------------------------------- /shared/useful/loghandler.lua: -------------------------------------------------------------------------------- 1 | 2 | function writeLog(msg,level) 3 | if level <= config.LogLevel then 4 | print(msg) 5 | end 6 | end -------------------------------------------------------------------------------- /stream/def_props.ytyp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blumlaut/RottenV/64d9e4aa1966f8733b4990a2d78a48f285034540/stream/def_props.ytyp -------------------------------------------------------------------------------- /stream/rottenv.ytd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blumlaut/RottenV/64d9e4aa1966f8733b4990a2d78a48f285034540/stream/rottenv.ytd -------------------------------------------------------------------------------- /stream/rottenv_daily.ydr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blumlaut/RottenV/64d9e4aa1966f8733b4990a2d78a48f285034540/stream/rottenv_daily.ydr -------------------------------------------------------------------------------- /stream/rottenv_supplies.ydr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blumlaut/RottenV/64d9e4aa1966f8733b4990a2d78a48f285034540/stream/rottenv_supplies.ydr -------------------------------------------------------------------------------- /stream/rottenv_weapons.ydr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blumlaut/RottenV/64d9e4aa1966f8733b4990a2d78a48f285034540/stream/rottenv_weapons.ydr -------------------------------------------------------------------------------- /stream/rottenv_wheelspin.ydr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Blumlaut/RottenV/64d9e4aa1966f8733b4990a2d78a48f285034540/stream/rottenv_wheelspin.ydr --------------------------------------------------------------------------------