ed
This commit is contained in:
		
							parent
							
								
									84031a9c3f
								
							
						
					
					
						commit
						3cc1d14b39
					
				
					 91 changed files with 2596 additions and 2913 deletions
				
			
		|  | @ -0,0 +1,39 @@ | |||
| lib.addCommand('giveadminkey', { | ||||
|     help = 'Gives an admin a key to any vehicle by plate', | ||||
|     params = { | ||||
|         { | ||||
|             name = 'id', | ||||
|             type = 'number', | ||||
|             help = 'Player ID To Grant Key To', | ||||
|         }, | ||||
|         { | ||||
|             name = 'plate', | ||||
|             type = 'string', | ||||
|             help = 'Vehicle Plate Number', | ||||
|         }, | ||||
|     }, | ||||
|     restricted = 'group.admin' | ||||
| }, function(source, args, raw) | ||||
| 	local src = source | ||||
|     local plate = string.upper(args.plate) | ||||
| 	if not plate then return NotifyPlayer(src, locale("AdminCommands.NoVehicleNearby"), "error", 6000)  end | ||||
| 	local target = tonumber(args.id) | ||||
| 	if not target then target = src end | ||||
| 	local pedId = GetPlayerPed(target) | ||||
| 	if pedId == 0 then return NotifyPlayer(src, locale("AdminCommands.NoPlayerWithID"), "error", 6000)  end | ||||
| 	AddKeyByPlate(target, plate) | ||||
| 	NotifyPlayer(target, locale("AdminCommands.KeyGranted"), "success") | ||||
| end) | ||||
|  | ||||
| lib.addCommand('givenearbykey', { | ||||
|     help = 'Gives an admin a key to the closest vehicle', | ||||
|     restricted = 'group.admin' | ||||
| }, function(source, raw) | ||||
| 	local src = source | ||||
|     local coords = GetEntityCoords(GetPlayerPed(src)) | ||||
|     local vehicle = lib.getClosestVehicle(coords, 5) | ||||
|     if not vehicle then return NotifyPlayer(src, locale("AdminCommands.NoVehicleNearby"), "error", 6000) end | ||||
|     local netId = NetworkGetNetworkIdFromEntity(vehicle) | ||||
|     AddKeyByNetId(src, netId) | ||||
| 	NotifyPlayer(src, locale("AdminCommands.KeyGranted"), "success", 6000) | ||||
| end) | ||||
|  | @ -0,0 +1,28 @@ | |||
| if GetResourceState("ox_inventory") ~= "started" then return end | ||||
|  | ||||
| exports.ox_inventory:registerHook('swapItems', function(payload) | ||||
|     local src = payload.source | ||||
|     if payload.toType == "player" and payload.fromType == "player" then | ||||
|         if type(payload.toSlot) == "table" and payload.toSlot.name == Config.ItemBasedSettings.keyRingItem then | ||||
|             AddToKeyRing(src, payload.fromSlot, payload.toSlot.slot) | ||||
|         end | ||||
|     end | ||||
|     return true | ||||
| end, { | ||||
|     itemFilter = { | ||||
|         [Config.ItemBasedSettings.vehicleKeysItem] = true, | ||||
|     }, | ||||
| }) | ||||
|  | ||||
| RegisterNetEvent("MrNewbVehicleKeys_v2:Server:DestroyKey", function(slot) | ||||
|     local src = source | ||||
|     Bridge.Inventory.RemoveItem(src, Config.ItemBasedSettings.vehicleKeysItem, 1, slot, nil) | ||||
| end) | ||||
|  | ||||
| RegisterNetEvent("MrNewbVehicleKeys_v2:Server:RenameKeyring", function(slot, newlabel) | ||||
|     local src = source | ||||
|     local slotData = Bridge.Inventory.GetItemBySlot(src, slot) | ||||
|     if type(slotData) ~= "table" then return end | ||||
|     slotData.metadata.label = newlabel | ||||
|     Bridge.Inventory.SetMetadata(src, slotData.name, slot, slotData.metadata) | ||||
| end) | ||||
|  | @ -0,0 +1,33 @@ | |||
| RegisterNetEvent('MrNewbVehicleKeys:Server:SendLog', function(data) | ||||
| 	local src = source | ||||
| 	local identifier = Bridge.Framework.GetPlayerIdentifier(src) | ||||
| 	Bridge.Utility.SendLog(src, "Player:  | ID#" .. src .. " | "..identifier.." | ".. data) | ||||
| end) | ||||
|  | ||||
| RegisterNetEvent("MrNewb_VehicleKeysV2:Server:RemoveLockpick", function(lockPickType, slot) | ||||
| 	local src = source | ||||
| 	if not src then return DoDebugPrint("ERROR: RemoveLockpick No Source") end | ||||
| 	--If you want the advanced lockpicks to remove then uncomment out this stuff | ||||
| 	--if lockPickType then | ||||
| 		--Bridge.Inventory.RemoveItem(src, Config.ItemBasedSettings.advancedlockpickItemName, 1, slot, nil) | ||||
| 	--else | ||||
| 		Bridge.Inventory.RemoveItem(src, Config.ItemBasedSettings.lockpickItemName, 1, slot, nil) | ||||
| 	--end | ||||
| end) | ||||
|  | ||||
| function RemoveAccountBalance(src, account, price) | ||||
| 	return Bridge.Framework.RemoveAccountBalance(src, account, price) | ||||
| end | ||||
|  | ||||
| function GetAccountBalance(src, account) | ||||
| 	return Bridge.Framework.GetAccountBalance(src, account) | ||||
| end | ||||
|  | ||||
| function NotifyPlayer(src, message, _type) | ||||
|     if not _type then _type = "success" end | ||||
| 	return Bridge.Notify.SendNotify(src, message, _type, 6000) | ||||
| end | ||||
|  | ||||
| function GetPlayerIdentifier(src) | ||||
| 	return Bridge.Framework.GetPlayerIdentifier(src) | ||||
| end | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nordi98
						Nordi98