62 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
| 
 | |
| function DebugPrint(type, message)
 | |
|     if Config.Debug then
 | |
|         if type == "error" then
 | |
|             print('^1[TAXI]^7 ' .. message)
 | |
|         elseif type == "warning" then
 | |
|             print('^3[TAXI]^7 ' .. message)
 | |
|         else -- success/info
 | |
|             print('^2[TAXI]^7 ' .. message)
 | |
|         end
 | |
|     end
 | |
| end
 | |
| 
 | |
| local QBCore = exports['qb-core']:GetCoreObject()
 | |
| 
 | |
| 
 | |
| RegisterNetEvent('taxi:payFare', function(amount)
 | |
|     local src = source
 | |
|     local Player = QBCore.Functions.GetPlayer(src)
 | |
|     
 | |
|     if not Player then return end
 | |
|     
 | |
|     local playerMoney = Player.PlayerData.money.cash
 | |
|     
 | |
|     if playerMoney >= amount then
 | |
|         Player.Functions.RemoveMoney('cash', amount, 'taxi-fare')
 | |
|         TriggerClientEvent('QBCore:Notify', src, 'Du hast $' .. amount .. ' für die Taxifahrt bezahlt', 'success')
 | |
|         
 | |
|         -- Log für Admin
 | |
|         DebugPrint('^2[TAXI]^7 ' .. Player.PlayerData.name .. ' (' .. src .. ') hat $' .. amount .. ' für eine Taxifahrt bezahlt')
 | |
|     else
 | |
|         local bankMoney = Player.PlayerData.money.bank
 | |
|         if bankMoney >= amount then
 | |
|             Player.Functions.RemoveMoney('bank', amount, 'taxi-fare')
 | |
|             TriggerClientEvent('QBCore:Notify', src, 'Du hast $' .. amount .. ' per Karte für die Taxifahrt bezahlt', 'success')
 | |
|             
 | |
|             -- Log für Admin
 | |
|             DebugPrint('^2[TAXI]^7 ' .. Player.PlayerData.name .. ' (' .. src .. ') hat $' .. amount .. ' per Karte für eine Taxifahrt bezahlt')
 | |
|         else
 | |
|             TriggerClientEvent('QBCore:Notify', src, 'Du hast nicht genug Geld für die Taxifahrt!', 'error')
 | |
|             
 | |
|             -- Log für Admin
 | |
|             DebugPrint('^1[TAXI]^7 ' .. Player.PlayerData.name .. ' (' .. src .. ') konnte $' .. amount .. ' für eine Taxifahrt nicht bezahlen')
 | |
|         end
 | |
|     end
 | |
| end)
 | |
| 
 | |
| -- Admin Command zum Respawnen aller Taxi-Stationen
 | |
| QBCore.Commands.Add('respawntaxis', 'Respawne alle Taxi-Stationen (Admin Only)', {}, false, function(source, args)
 | |
|     local Player = QBCore.Functions.GetPlayer(source)
 | |
|     if Player.PlayerData.job.name == 'admin' or QBCore.Functions.HasPermission(source, 'admin') then
 | |
|         TriggerClientEvent('taxi:respawnAllStations', -1)
 | |
|         TriggerClientEvent('QBCore:Notify', source, 'Alle Taxi-Stationen wurden respawnt', 'success')
 | |
|     else
 | |
|         TriggerClientEvent('QBCore:Notify', source, 'Du hast keine Berechtigung für diesen Befehl', 'error')
 | |
|     end
 | |
| end, 'admin')
 | |
| 
 | |
| -- Event für das Respawnen der Stationen
 | |
| RegisterNetEvent('taxi:respawnAllStations', function()
 | |
|     -- Wird an alle Clients gesendet
 | |
| end)
 | 
