TriggerEvent("es:addGroup", "admin", "user", function(group) end)

--Help Commands
TriggerEvent('es:addCommand', 'help', function(source, args, user)
  TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "Player Commands ")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "-----------------------MONEY-------------------------")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "/donnercash <ID> <montant>")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "-----------------------Vehicule----------------------")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "Touche M menu vehicule")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "-----------------------Message-----------------------")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "/pm <ID> <text> - pour envoyer un message privé")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "-----------------------Skin--------------------------")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "F6 menu SKIN")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "-----------------------plainte-----------------------")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "/report <text> ")
end)
TriggerEvent('es:addCommand', 'cop', function(source, args, user)
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "-----------------------POLICE RANK-----------------------")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "recrue = rec")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "brigadier = brd")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "sergent = srg")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "lieutenant = lt")
	TriggerClientEvent("chatMessage", source, "^3SYSTEM", {255, 255, 255}, "swat = swat")
end)


TriggerEvent('es:addCommand', 'group', function(source, args, user)
	TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Group: ^2" .. user.group.group)
end)

-- Kicking
TriggerEvent('es:addGroupCommand', 'kick', "admin", function(source, args, user)
		if(GetPlayerName(tonumber(args[2])))then
			local player = tonumber(args[2])

			-- User permission check
			TriggerEvent("es:getPlayerFromId", player, function(target)
				if(tonumber(target.permission_level) > tonumber(user.permission_level))then
					TriggerClientEvent("chatMessage", source, "SYSTEM", {255, 0, 0}, "You're not allowed to target this person!")
					return
				end

				local reason = args
				table.remove(reason, 1)
				table.remove(reason, 1)
				if(#reason == 0)then
					reason = "Kicked: You have been kicked from the server"
				else
					reason = "Kicked: " .. table.concat(reason, " ")
				end

				TriggerClientEvent('chatMessage', -1, "SYSTEM", {255, 0, 0}, "Player ^2" .. GetPlayerName(player) .. "^0 has been kicked(^2" .. reason .. "^0)")
				DropPlayer(player, reason)
			end)
		else
			TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Incorrect player ID!")
		end
end, function(source, args, user)
	TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficienct permissions!")
end)